You are on page 1of 80

Advanced 8086 Microprocessor Trainer NV5586A

Learning Material Ver 1.0

Designed & Manufactured by:

141-B, Electronic Complex, Pardesipura, Indore- 452 010 India, Tel.: 91-731- 4211500, Telefax: 91-731-4202959, Toll free: 1800-103-5050, E-mail: info@nvistech.com Website: www.nvistech.com

NV5586A

Advanced 8086 Microprocessor Trainer NV5586A Table of Contents 1. System Introduction 2. System Specifications 3. System Capabilities 4. Hardware Description 5. Command Description 6. Memory I/O Mapping 7. Subroutines 8. Serial Communication 9. MASM Macro Assembler 10. Sample Programs 11. On-Board Interface 12. Parallel Commutation between two NV5586A Trainers using 8255 in i/o mode 13. Serial Commutation between two NV5586A Trainers 14. Connector/Jumper Details 15. Jumper/DIP switch Details 16. Block Diagram 17. Warranty 18. List of Service Centers 19. List of Accessories 3 4 5 6 18 28 30 40 44 47 68 71 72 73 76 77 78 79 80

Nvis Technologies Pvt. Ltd.

NV5586A

System Introduction General Description: NV5586A is a single board microprocessor training/development kit configured around the Intels 16 bit Microprocessor 8086. This kit can be used to train engineers, to control any industrial process and to develop software for 8086 systems. The kit has been designed to operate in the max. mode. Co-processor 8087 and I/O Processor 8089 can be added on board. The Kit communicates with the outside world through an IBM PC compatible Keyboard with 20x2 LCD Display. The kit also has the capacity of interacting with PC. NV5586A is packed up with powerful monitor in 128K Bytes of factory programmed EPROMS and 32K Bytes of Read/Write Memory. The total memory on the board is 144K Bytes. The system has 72 programmable I/O lines. The serial I/O Communication is made possible through 8251. For control applications, three 16 bit Timer/Counters are available through 8253. For real time applications, the 8 level of interrupt are provided through 8259. NV5586A provides onboard battery back up for onboard RAM. This saves the users program in case of power failure. The onboard resident system monitor software is very powerful. It provides various software commands like BLOCK MOVE, SINGLE STEP, EXECUTE, FILL etc. Which are helpful in debugging/developing software. An onboard line assembler provides user to write program in assembling language.

Nvis Technologies Pvt. Ltd.

NV5586A

System Specifications Central Processor : 8086, 16 bit Microprocessor operating in max. mode. Support 8087 Numeric Data Processor. Support 8089 I/O Processor. 128K Bytes of EPROM Loaded with monitor program. 32K bytes of CMOS RAM with Battery Backup using 3.6V Ni-Cd Battery. 72 I/O lines using three nos. of 8255. RS-232-C Interface using 8251. 8 different level interrupt using 8259. Three 16 bit Timer/Counter using 8253. 105 IBM PC Keyboard & 20x2 LCD Display. All address, data and control signals (TTL Compatible) available at 50 Pin & 20 Pin FRC Connector. 5V/ 2 Amps, 12V/250mA 32.6cm x 25.2cm 0 to 50C. Co-Processor Support : I/O Processor Support : EPROM RAM Parallel Serial Interrupt Timer/Counter Keyboard & Display BUS Power Supply Physical Size Operating Temp. : : : : : : : : : : :

Nvis Technologies Pvt. Ltd.

NV5586A

System Capabilities
Keyboard Mode:

1. Examine/Modify the memory byte locations. 2. Examine/Modify the contents of any of internal register of 8086. 3. Move a block of Data/Program from one location to another location. 4. Fill a particular memory area with a constant. 5. To execute the program in full clock speed. 6. To execute program in single instruction execution.
System Installation: To install NV5586A the following additional things are required.

1. Connect the External SMPS Power Supply to AC Power and 5 pin connector to the left side on NV5586A
Kit.

2. Switch on the Power Supply at the rear end of SMPS supply. 3. A message NV5586A 8086 Mic.Tr. will come on display (PRESS RESET if you do not get - NV5586A
8086 Mic.Tr.

4. Now NV5586A Kit is ready for the user's experiments for Keyboard Mode commands.

Nvis Technologies Pvt. Ltd.

NV5586A

Hardware Description
CPU: 8086 is a 16 bit, third generation microprocessor and is suitable for an exceptionally wide spectrum of microcomputer applications. This flexibility is one of most outstanding characteristics. 8086 has got 16 data lines and 20 address lines. The lower 16 address lines are multiplexed with 16 data lines. Hence it becomes necessary to latch the address lines. This is done by using 74 LS 373. In fact several of the 40 CPU pins have dual functions that are selected by a strapping pin. In this kit 8086 is used in the max. mode (MN/Mx input held logically low). The 8088 is designed with an 8-bit external path to memory and I/O. Except that the 8086 can transfer 16 bits at a time, the two processors & software are identical in almost every respect. Software identical in almost every respect. Software written for one CPU will execute on the other without alteration. The two processors are designed to operate with the 8089 I/O processors and other processors in multiprocessing and distributed processing systems. The INTR, TEST & Hold Inputs to 8086 are pulled down and are brought out at PCB FRC connector. The mask able interrupt INTR is available to the peripheral circuits through the expansion Bus. To use the mask able interrupt an interrupt vector pointer must be provided on the data bus when INTA is active. An interrupt Controller Circuit is provided to take care of more than one source of interrupt.

Co-Processor 8087:
The 8087 Co-processor hooks have been designed into the 8086 and 8088 so that these types of processor can be accommodated in the future. A co-processor differs from an independent processor in that it obtains its instructions from another processor, called a host. The co-processor monitors instructions fetched by the host and recognizes certain of these as its own and executes them. A co-processor, in effect, extends the instruction set of its host computer.

I/O Processor 8089:


The 8086 and 8088 are designed to be used with the 8089 in high performance I/O applications. The 8089 in conceptually resembles a microprocessor with two DMA channels and an instruction set specifically tailored for I/O operations. Unlike simple DMA controllers, the 8089 can service I/O devices directly, removing this task from the CPU. In addition, it can transfer data on its own bus or on the system bus, can match 8-bit or 16-bit peripherals to 8-bit or 16-bit buses, and can transfer data from memory to memory and from I/O devices to I/O device. 8089 has been used here in local mode. The system bus, can match 8-bit or 16-bit peripherals to 8-bit or 16-bit buses, and can transfer data from memory to memory and from I/O devices to I/O device. 8089 has been used here in local mode. Clock Generation: The clock generator circuit is an Intels 8284 clock generator/driver. The circuit accepts a crystal input which operates at a fundamental frequency of 6.144 MHz. (6.14 MHz was selected since this frequency is a multiple of the baud rate clock and also provides a suitable frequency for the CPU). The clock generator/driver divides the crystal frequency by three to produce the 2MHz CLK signal required by the CPU. Additionally, the clock generator performs a further divide-by-two output called PCLK (peripheral clock) which is the primary clock signal used by the remainder of the circuits. The clock generator/driver provides two control signal outputs which are synchronized (internally) to the 2 MHz CLK signal; RDY (ready) and RST (reset). RST is used to reset the NV5586A to an initialized state that occurs when the RES input goes low (when power first is applied or when the SYSTEM RESET key is pressed). The RDY output is active (logically high) when the RDY 1 input from the wait state generator is active. As will be explained in the next section, the RDY 1 input is active whenever onboard memory is addressed or when a selected number of wait states occurs. The system can operate at either 2 MHz or 1 MHz. This is selected by a set of jumpers JP3 on the right hand side of the 8284 clock generator as shown below:

1. 2 MHz (UPPER) 2. CLK 3. 1 MHz (LOWER)


The NV5586A is supplied in 2 MHz configuration. Nvis Technologies Pvt. Ltd. 6

NV5586A

Bus Controller:
The 8288 is a Bus Controller which decodes status signals output by an 8089, or a maximum mode 8086. When these signals indicate that the processor is to run a bus cycle, the 8288 issues a bus command that identifies the bus cycle as memory read, memory write, I/O read, I/O write, etc. It also provides a signal that strobes the address into latches. The 8288 provides the drive level needed for the bus control lines in medium to large systems.

Memory:
NV5586A provides 128K Bytes of EPROM loaded with monitor and 32K bytes of CMOS RAM. The total onboard memory can be configured as follows: EPROM RAM 128K Bytes of EPROM using two 27C512. 32K Bytes of RAM.

The system provides two 28 Pin sockets for the EPROM area named as EVEN-ROM & ODD-ROM and two 28 Pin sockets for the RAM area named as EVEN-RAM & ODD-RAM. EVEN-ROM & ODD-ROM can be defined to have EPROM 27512. With the 20 bit address of 8086, a total of 1 Mega Bytes of memory can be addressed with the address slot as 00000 to FFFFF. Although the total onboard memory capacity is 180K Bytes 128K Bytes of EPROM and 32K Bytes of RAM. 8255: 8255 is a programmable peripheral interface (PPI) designed to use with 8086 Microprocessor. This basically acts as a general purpose I/O component to interface peripheral equipments to the system bus. It is not necessary to have an external logic interface with peripheral devices since the functional configuration of 8255 is programmed by the system software. It has got three input/output ports of 8 lines each (PORT-A, PORT-B and PORT-C). Port-C can be divided into two ports of 4 lines each named as Port-C upper and Port-C lower. Any Input/Output combination of Port-A, Port-B, Port-C upper and Port-C lower can be defined using the appropriate software commands. The Port addresses for these ports are given here. NV5586A provides nine Input/Output ports of 8 lines each using three 8255 chips. These ports are brought out at connectors. 8253: This chip is a programmable interval timer/counter and can be used for the generation of accurate time delays under software control. Various other functions that can be implemented with this chip are programmable rate generator. Event Counter, Binary rate multiplier, real time clock etc. This chip has got three independent 16 bit counters each having a count rate of up to 2 MHz. The CLK, GATE & OUT signals of these timers are brought out at the connector. 8251: This chip is a programmable communication interface and is used as a peripheral device. This device accepts data characters from the CPU in parallel form and then converts them into a continuous serial data stream for transmission. Simultaneously it can receive serial data stream and converts them into parallel data characters for the CPU. This chip will signal the CPU whenever it can accept a new character for transmission or whenever it has received a character for the CPU. The CPU can read the complete status of it at any time. 8251 has been utilized in NV5586A for RS-232-C serial interface. 8259: The 8259 is a device specifically designed for use in real time, interrupt driven microcomputer systems. It manages eight levels of requests and has built in features for expandability to other 8259s. It is programmed by systems software as an I/O peripheral. A selection of priority modes in which the requests are processed by 8259 can be configured to match his system requirements. The priority modes can be changed or reconfigured dynamically at any time during the main program. Battery Backup: The NV5586A provides a battery back up for the onboard RAM area using 3.6V Ni-Cd Rechargeable battery. NV5586A has facility for connecting +5V to the RAM area if the Ni-Cd battery fails. The selection for +5V or Battery supply Jumper (JP2). Nvis Technologies Pvt. Ltd. 7

NV5586A Display: This display contains 2 lines and each line consists of 20 words (20x2). This is a cursor LCD display modular. The CPU receives each 8 bits letter which is locked into the internal display data of RAM (data display of RAM 80 bytes (D.D.RAM) allows 80 characters to be stored), and transfer to 5x7 dot of array word and appear on the displayed. This LCD modular contains the word generator ROM that will supply 160 different 5x7 dot of array word and also a 64 bytes word generator RAM. Users can define 8 types 5x7 dot of array word. The position of word display goes into the LCD Modular through the data bus in CPU. Next through the instruction register and finally write the words into the data register to display on a specific location. The LCD Modular will automatically increase or decrease the words in order to move to different addresses. The user can therefore continue sending in word code. The cursor as to moved around or moved in the right of left direction. Specification of Display: Display data RAM Character generator ROM Character generator RAM Kinds of instructions : : : : 80 x 8 BLT (80 words) 160 of 5x7 dot of array word 8 different users programmed 5x7 dot of array Clear the display, send cursor home (HOME), ON/OFF display. Cursor ON/OFF, character blinking cursor move to another position, display change position.

When the internal power is on, the circuit is reset. Internal circuit vibrator.

Functional Block Diagram


Nvis Technologies Pvt. Ltd.

Figure 1 8

NV5586A Note: Some models incorporate a temperature compensation circuit within the bias voltage generator.

The LCD modular has 2 8-bits register-one instruction register (IR) and one data register (DR). The instruction register stores the instruction code and address information, which contains display data RAM and address of character generator RAM. However, the content of IR is only for read-in but not read-out. The data register can only temporary store data, the input data first goes through LCD and is stored in the data register. It will then automatically be transferred to display data RAM or character generator RAM.When the CPU read the data from the displayed RAM or from the character generator RAM, it wills also temporary store the data in the data register. When the address information is input into the instruction register, the relative data will be moved from display register RAM or character generator RAM to the data register. Then the data can be read from data register by using the output instruction of CPU.
One way to select the two registers is to select the register signal (RS) like follow: RS 0 0 1 1 Busy Flag (B.F.): When busy flag is 1, it indicates that the LCD Modular is executing the inner instruction and no other instruction can be accepted. The LCD Modular can only accept information when BF is lower to 0. Address Counter (A.C.): The address counter is used to count the display data RAM, or address of character generator RAM. When the address setting instruction address will be sent into the address counter. When the data is sent into or read out from display register RAM or from the character generator RAM, the address counter will automatically add or subtract 1. When the content of address counter is in RS = 0 and R/W = 1, the output data line is DB0 DB6. Display Data RAM (D.D. RAM): This is an 80x8 bit RAM, which can store 80 8-bit character codes as the display data; it can be sent to CPU as the RAM data section without going through RAM section. Address setting of data display RAM is as followed: High level bus AC6 AC5 AC4 Low level bus AC3 AC2 AC1 AC0 R/W 0 1 0 1 Function Data Bus > instruction Register Read out busy flags (BUSY FLAG DB7) and address counter (DB0-DB6) Input into data register and execute the inner instruction: (D.R.RAM> D.R. OR C.G.RAM D.R.) Get the data out form register, and execute the inner instruction: (D.D.RAM> D.R. OR C.G.RAM> D.R.)

Data displays RAM and display position of LCD is as followed: Character Position: 1 (Decimal) First Line: (Hexadecimal) Second Line: (Hexadecimal) 2 3 4 5 6 7 8 9 10 1119 20

00 01 02 03 04 05 06 07 40 41 42 43 44 45 46 47

08 09 0A..16 17 48 49 4A...56 57

Nvis Technologies Pvt. Ltd.

NV5586A Character Generator ROM (C.G. ROM): This ROM generates 5x7 dot of array character has 160 different 8-bit character code. The shape and code are shown in Table 2 and 3. Character Generator RAM (C.G.RAM): This RAM stores 8 different 5x7 dot of array character which allows the user to design the program. When the character codes are stored in the C.G.RAM, which are the same as the characters in Table 2 and 3, they will be sent to display data RAM. The display data and characters are shown in Table 4. Timing Generator: Sending signals into the inner register during generating process. Character Codes:

Nvis Technologies Pvt. Ltd.

10

NV5586A Note:

1. The CG RAM generates character patterns in accordance with the users program. 2. Shaded areas indicate 5x10 dot character patterns.
Character code:

Note

: The CG RAM generates character patterns in accordance with the users program. Shaded areas indicate 5x10 dot character patterns.

1. 2.

Nvis Technologies Pvt. Ltd.

11

NV5586A Relationship among Character Code: (DD RAM), CG RAM Address, And Character Pattern (CG RAM) Character Pattern for 5x7 Foat

* Signifies a dont care bit. Note:

1. Character code bits 0-2 correspond to CG RAM address bits 3-5. Each of the 8 unique bit strings
designated one of the 8 character patterns.

2. A CG RAM address bit 0-2 designates the row position of each character pattern. The 8 the row is the
cursor position. CG RAM data in the 8 the row is ORed with the display cursor. Any 1 bits in the 8 the row will result in the displayed dot regardless of the cursor status (ON/OFF). Accordingly, if the cursor is to be used, CG RAM data for the 8 the row should be set to 0.

3. CG RAM data bits 0-4 correspond to the column position of each character pattern bit 4 corresponding to
the leftmost column of the character pattern CG RAM data bus are not used for displaying character patterns, but may be used as a general.

4. As shown in tables 2 and 3, character patterns in the CG RAM are accessed by character codes with bits 47 equal to 0. For example, the character code 00 (HEX) or 80 (HEX), since bit 3 of the character code is a dont care bit (i.e. can take either value 0 or 1).

5. CG RAM data 1 produces a dark dot, and data 0 produces a light dot in the corresponding position on
the display panel.

Nvis Technologies Pvt. Ltd.

12

NV5586A Functions of Reset: Using the Internal Reset Circuit to Start: LCD Modular internal has an automatic power supply to be used to RESET when the power rises. During RESET, the busy flag is set. When the voltage is raised to 4.5V in about 10ms, it is in the busy stage. The following instructions are then used to set the beginning stage of LCD. 1. 2. Clear display Function set DL = N= F= 3. D= C = B = 4. I/D = S= 1 0 0 1 0 0 1 0 8-bit data length interface (single line display) The source of 5x7 dot of array character Display OFF Cursor OFF Character flashing function OFF Increase mode Display OFF

Display ON/OFF control

Entry mode set

Note : If the time for the power to increases from 0.2V to 4.5V is greater than 0.1ms but less than 10ms, the current cut-off will drop to 0.2V before it rises again. If it takes more than 1ms, the LCD modular will automatically RESET. Otherwise, it has to depend on an external software instruction to RESET (As describe below).

Diagram of module RESET power. Figure 2

Nvis Technologies Pvt. Ltd.

13

NV5586A Instruction Set:

Note

1. Symbol * signifies a dont care bit 2. Correct input value for N is predetermined for each model

Nvis Technologies Pvt. Ltd.

14

NV5586A Initialization by Instructions: If the power conditions for the normal operation of the internal reset circuit are not satisfied. LCD unit must be initialized by executing a sense of the instructions. The procedure fro this initialization process is as follows.

Instruction Description: When the LCD is controlled by the CPU, only the instruction register (IR) and the data register (DR) can be read directly by the CPU. The commands from outside the modular can decide the internal operation of LCD. These commands include the register selection (RS) signals, read/write (R/W) signals, and data buffering signals (DB0DB6). Table 5 lists all the useful commands in the LCD modular and the execution time, these commands are divided into the following group:

1. 2. 3. 4.

Commands of set LCD module Commands of internal set address RAM Commands of data transfer in or out from the internal RAM Other commands

When the LCD modular is executing a command it will reject other commands. Except the busy flag/read address counter, the internal counting period of busy flag is set to as 1. If the CPU wants to send in other commands it will have to check the busy flag first, until it is cleared to 0 before it send in. The explanation is as followed: Nvis Technologies Pvt. Ltd. 15

NV5586A Display Clear command: This command will put the display data into a empty space code (20H), address counter will be cleared to 0. When executing this command, display OFF, the cursor or the character blinking function will be moved to the most left side if it is in the set condition. Display/Cursor Home: The address counter will be cleared to 0, content of D.D. RAM will not be influenced; but if the cursor or the character blinking function is in the set condition, it will be moved to the most left side position. Entry Mode Set: I/D bit = 1, 1 is added in the address counter after each time it read/write a display data RAM character code, so that the cursor or the character blinking function will move one place to the left and vise-versa when I/D=0. The read/write (R/W) character generator also has the same function. S bit = 1, but each time it read/write a display data RAM code, it will move to the display direction and move one space to the left (I/D=0) or one space to the right (I/D=1). When S=0, the display will not move. When data enters the character generator RAM, the display will not move. Display ON/OFF: D: D=1 C: D=0 C=1 C=0 Display ON Display OFF Cursor display on the display address of the display counter Cursor does not display

B: B=1 Character blinking of cursor position at feq or fosc=250KHz freq, therefore all black points and character display will exchange with each other. Each character display and overshadow 409.6ms. Display/Cursor Shift: S/C R/L 0 0 1 1 0 0 0 1 Cursor move to the left (AC <AC-1) Cursor move to the right (AC <AC+1) All the characters and cursor move to the left All the characters and cursor move to the right

Note: When the display moves, the address counter will not move. Function Set: DL : Select data length for the interface circuit. Using the 8 bits data length. Using the 4 bits data length. Select the display format (one or two lines)

DL=1 DL=0 N :

C.G. RAM Address Set: Address counter and character generator RAM have address which is driven by the binary 6-bit. When this instruction is driven in, data can be sent into the CPU and character generator -RAM. D.D. RAM Address Set: Address counter and display data RAM have addresses which are driven by the binary 7-bit. When this instruction is driven in, data can be sent into the CPU and the display data RAM. When N=0 (a single line display), binary code ADD between 00H and 4FH; when N=1 (a two lines display), the binary code ADD from 00H until 27H as the first line of from 40H until 67H as the second line. Read Busy Flag/Address Counter: The busy flag (BF) in LCD can be read from the CPU, using the instruction of LCD modular is the execution of the internal instruction BF = 1 represents the busy stage (execution of the internal instruction), it will not accept any instruction at this time until BF = 0.

Nvis Technologies Pvt. Ltd.

16

NV5586A Content of address counter and the busy flag will be read out at the same time, it is a 7-bit binary, the address counter will instruct one of the addresses, either the character generator RAM or display data RAM. This is determined by the final input address set instruction. Send Data Into C.G. RAM/D.D. RAM: Data with 8-bit in length can be sent into the character generator RAM or the display data RAM. The address of the input data is instructed by the address counter, however, the address of address counter is influenced by the final input address set instruction. After data input whether the address counter add 1 or minus 1 is determined by the design of the module. It can also be designed as location movement of the display. Read Data Out of C.G. RAM/D.D. RAM: Character generator RAM with 8-bit in length or the display data RAM can be read by the CPU. The read out data address is instructed by the address counter. The address counter is instructed by the final input address set instruction. This instruction has to be set in C.G. RAM/D.D. RAM address, once shift cursor instruction of the C.G. RAM/D.D. RAM data is read out, no other instruction can be read out. The address setting instruction will read the data address into address counter. Shift cursor command will allow the previous address setting to be used again in order to read the D.D. RAM data. The data can be read from the C.G. RAM/D.D. RAM after the cursor shift. After the execution of data address counter add 1 or minus 1 will be set in the LCD modular. After the execution of data read out, the display will not shift. The operation of this device is similarly with the operation of IBM PCs DEBUG system. For convenience, the operation instructions will be displayed when the device is being switched on or RESET. This device also has memory ability to preserve data for future use. There is a memory indicator on the display once the data being kept after Reset. The system program starts from 0000:0000 after reset, in order to check the length of the RAM, there is a byte to be inverted and returned to the original for every 4K in length, the verifying procedure will be repeated until none of the byte can be inverted. During this period, avoid using the RESET to prevent the data from unable to return to the original setting. The RAM address is to be displayed by 4 positions and up to FFFFH, however, 5 positions will be used if it exceeds FFFFH. Operating Commands: After power ON the system, it will display as follows:

After pressing <Enter>, the operating commands will be displayed:

Nvis Technologies Pvt. Ltd.

17

NV5586A

Command Description
A Assemble: This command is used to convert the input Assemble Language to the Machine Language in the memory. Once under this command, first set the address which is similar to the command D followed by an Enter or an Arrow Down key to go to a new step. However, only a maximum of 35 words are allowed for input.

The following are some useful keys used to move the cursor around:
Move one space to the left. Delete the character at the cursor.
BackSpace Space

Simply Press the key A. After the command, an A will appear on the screen:

Assembly language can be input at this time.

1. 2. 3.

Only contains the Effective address but the Segment base is included A 400. Input includes the segment base and the Effective address A 0000:400. Totally depends on the built in Segment base and Effective address A.

If one of the above is used, 0400 will appear on the screen and ready for input data. Example: Clear second line, display DX value, and DX values are altered by key-in to be displayed at LCD. 0:0400 0:0402 0:0407 0:040A 0:040F 0:0411 0:0413 MOV CALL MOV CALL CMP JNE HLT DL,C0 F000:F078 DH,00C2 F000:F068 AL,0D 040A

Before entering the above program connect the system to the power supply properly. Then the following menu will be displayed on LCD screen, if not, switch off the power supply and re-check.

The following steps are to be taken:

1.

Press the key A and the LCD display is as shown here:

2.

Now the user enter the segment address and effective address simultaneously as follows:

Nvis Technologies Pvt. Ltd.

18

NV5586A

3.

Now press Enter key, the effective address will appear.

From now onwards user can enter the program in assembly language. First pick the first instruction.

While entering this instruction, the following mistakes may happen: 1. If user has entered the wrong instruction as follows:

As user press the Enter key, then above instruction will not be converted into machine language. And the cursor will point left side of the instruction as follows:

Now by using the <Backspace> keys, user can move the cursor right side and indicate at the below of C.

Delete the character by using <Space >keys.

Press Enter key, then this input assemble language will be converted into machine language in the memory and jump to the next memory location. 2. Or user has entered the wrong instruction as follows:

As user press the <Enter > key, then above instruction will not be converted into machine language. And the cursor will point left side of the instruction as follows:

Now just type again the correct instruction it will replace the previous characters. Press Enter key, then this input assemble language will be converted into machine language in the memory and jump to the next memory location. 3. Or user has entered the wrong instruction as follows:

Nvis Technologies Pvt. Ltd.

19

NV5586A As user press the Enter key, then above instruction will not be converted into machine language. And the cursor will point left side of the instruction as follows:

And user wants to write whole instruction again, then by using the <Space> keys, the content at the location 400 will be erased as follows:

Now by using <Backspace> key user can come back again to initial position Now enter the instruction again.

Press <Enter> key, then this input assemble language will be converted into machine language in the memory and jump to the next memory location.

Now write the next instruction as follows:

In this way, user can enter the whole program, by pressing <Enter> key.

Now by using GO command, the machine language statements can be executed and the value of DX will be displayed in the second line of the LCD. Note : When A and U are being used, the operation used: 0000:1E00 0000:1FFF as the buffer. D - Display or modify the RAMs Hexadecimal: A.D.U. is the important commands in the compiling. The effective address or both the effective address and Segment base can be used during input. When the cursor is placed at the beginning, the key will immediately show F000 as the Segment base and the Effective address next. Syntax: D (If no input, press Enter key or ARROW UP/DOWN key would allow the built-in address to be used) 20

Nvis Technologies Pvt. Ltd.

NV5586A D 0400 D 0:0400 (Uses built-in Segment base but specify the Effective address) (Specify both the Segment base and Effective address)

If press the <Enter> or the ARROW UP key after specifying the address, the memory will display the data. Press ARROW UP key will allowed the address to ADD 8 and store in the memory as a whole number. Otherwise, an ARROW DOWN key indicates an subtraction of 8 in the address and these changes in the memory (as a machine language). Syntax:

If address is not a whole number 8, the following will show:

The above data shown at the location 400 are the arbitrary datas. Example: If the user wants to see the codes of the above program, the following steps are to be taken:

1.

Press F7 key, the menu will display.

2.

Press D key, and write the effective address. The following will be displayed:

3.

Press <Enter> key, then the following will be displayed:

Use

key for further view.

F - Fill data into the RAM: By setting the starting, ending address and the details, an <Enter> key will allow the data to enter the RAM. Syntax:

Once F is entered, the command can be preceded. Nvis Technologies Pvt. Ltd. 21

NV5586A

The ending position has to be bigger than or equal to the starting position, otherwise the smaller user will become the ending position and the bigger user is the starting position.

G - Proceed to the address for execution:


The GO command, which causes the machine language statements to be executed. This command executes the loaded program and allows the user to specify the addresses at which program execution will stop. The syntax is as followed:

When the G key has been applied, the procedure can be taken place.

It shows the address 0000:0400 by default if your program resides on another location than user have to change address. Once the GO command has been executed, it will completely leave the system and proceed to the users program. Flowchart of G-Command

I Interrupt: Three Interrupts (Effective address) can be set in for the program execution, the CPU will continuously make a single-step subprogram for checking IP values. When the IP register has the same value as the Interrupts address, it will enter the Interrupts subprogram. Enter command I will interrupt the program.

Syntax:

The I key allows interruption to be shown on the screen.

Nvis Technologies Pvt. Ltd.

22

NV5586A Note:

1. 2. 3.

During interrupt setting, the address alternation register has commands like POP ES, MOV DS, AS, etc. to execute with the next command. The program will be delayed for due to the fact that CPU has to send each command individually into the subprogram. During the interruption, the command GO would allow the program to execute until the next INTERRUPT.

Example: To break point at 0402, 0407 and 0411 in the example given on Page-3, the following steps are to be taken:

1.

Press the key F7 and the LCD display is as shown here:

2.

Now press the key I and the LCD display is as shown here:

Modify using

<Space> and <Backspace >keys as follows:

3.

Press the key F7 and then G. The display will be as follows:

4.

Press the Enter key and then F7.

This indicates the first break-point is at 0402. To proceed further, press G, Enter, and then F7 .

This indicates the second break-point is at 0407. To proceed further, press G, Enter, and then F7 .

This indicates the third break-point is at 0411. One can use any commands including Examine Register by pressing the key R. Note: In above figure observe the command R is also displayed this command only appears during step execution of program or when Breakpoints are applied at some addresses using I command.

Display Register:
Command R displays the content in the register. This command allows the user to examine the content of the register in the CPU. Each time during display, 4 registers will be shown. The following are some of the display and criteria of the register: Nvis Technologies Pvt. Ltd. 23

NV5586A

The first group register (AX, BX, CX, DX) will be shown first when enter the command R. The jump to the second group; the fourth group can return to the first group.

key will

When the content in the register is displayed, the cursor will not appear, the user therefore cannot change the content in the register M - Moving Data: The command MOVE is used to move data in the memory from a specified address to another address by input the starting address, the ending address and the desire address. A RETURN key is then used to execute the changes. Syntax: The M key allows the data to be moved to another address:

The ending address must be greater than or equal to the starting address. The sum of the starting address in plus the corrected ending address in the target can not exceed FFFF. Otherwise, it will cause an input error and have to redo the whole procedure.

T - Trace Program (an N-step designed command):


This command is used for program execution. TRACE will enter the INTERRUPT subprogram every time the program execute. N has a decimal range from 1-99 with 10 as the rounding off number, and only operate if N is not 0; other-wise it will clear the function. Syntax: T 00 - STEP Decimal TRACE setting Only 0-9 numerical keys are allowed to use to operate for this command but not any other keys. Example: Enter the following program using A 0000:0400 and press Enter key.

Nvis Technologies Pvt. Ltd.

24

NV5586A

Now if user wants to see the process of the above program, then the procedure is as follows:

1.

After entering the above program, press F7 key, then the menu will be displayed as follows:

2.

Press the Key T. The screen displays as follows:

3.

Now the user can view the program after the one instruction, two instructions, and so on by defining the number which is to be entered through keyboard.

Example: The instruction pointer stops after every single instruction.

After completion, press F7 for a menu display.

4.

Press the key G, the menu will appear.

5. 6.

Press Enter key. Press F7 key, the single stepping will start and the following menu will be displayed: 1ST instruction is executed.

Press G key and next F7 key for further view, the following results will be displayed: Nvis Technologies Pvt. Ltd. 25

NV5586A 2nd instruction is executed.

Press G key and next F7 key for further view, the following results will be displayed: 3rd instruction is executed.

Press G key and next F7 key for further view, the following results will be displayed: 4th instruction is executed.

Press G key and next F7 key for further view, the following results will be displayed:

Here user can observe the process of program execution, because data 30 is greater than 20 so that carry will not generate and the program execution will jump to the desired label. Now again press G key and next F7 key Anywhere during trace command, one can examine/modify the registers using R command (refer Register Command Description). Note: Refer to the INTERRUPT command for precaution.

U Unassemble:
The UNASSEMBLE command decodes the value of a group memory location mnemonics, and display on the displayed. Once enter this command, input the proper design address. The following is the correct way to input address:

1. 2.

The content of the Unassemble 0400 will start if only the starting address is entered. The built-in segment base is used here if it is not entered. The content of the Unassemble 0000:0400 will start if only the starting address is entered with segment address as 0000:0400.

Press U key would enter the Unassemble design:

Nvis Technologies Pvt. Ltd.

26

NV5586A Display the address first, then display the machine code (if the machine code is too long, they will be continued on the second line). The second line displays the assemble program and the process is completely done. To see further press F7 key and then U again and then again enter next address. If the user needs to modify the instruction, press key F7 will move to the command Assemble (A). And write the address of the instruction which is to be modified. Press Enter key and write the correct instruction and again press Enter key. Press key F7 another time would bring the instruction back to the Unassembled. The U command can be used to examine the program but not more than 127 instructions in forward direction. When the program reaches the end, the U command can be used to decode the program again or forward. Example: The example entered earlier can be seen as follows:

1.

Press U key, and enter the starting address of the program.

2.

Press Enter key, the following will be displayed:

3.

Press F7 and then U and enter the next address for further view.

4.

If the user want to modify at the address 0404, then following steps are to be taken:

a. b.

Press F7 key, the menu will display. Press A key and enter the address 0404 as follows:

c. d.

Press Enter key and write the instruction again. Press Enter key so that the modifications has been taken place.

Note: When commands A and U are executed, the system program uses 0000:1E00 -1FFF as the buffer, therefore during the execution of A and U, this segment cannot be used.

Nvis Technologies Pvt. Ltd.

27

NV5586A

Memory / I/O Mapping Memory Section:


Address 0000:0000 0000:7FFF F000:0000 F000:FFFF Purposes RAM AREA {ODD RAM & EVENRAM } ROM MONITOR AREA {ODD ROM & EVEN ROM}

I/O Address:
The addresses of the various chips in I/O mapped in NV5586A are as follows: Device No. 8255-I 70 72 74 76 8255-II 80 82 84 86 8255-III 10 12 14 16 8253 00 02 04 06 8259 30 32 8251 50 52 Port No. Selected Device PPI Port A Port B Port C Control Word PPI Port A Port B Port C Control Word PPI Port A Port B Port C Control Word PIT Counter 0 Counter 1 Counter 2 Counter 3 Interrupt controller Data Word Command/Status Word Data Register Controller Word Register

Nvis Technologies Pvt. Ltd.

28

NV5586A

RAM Memory:
Address 0000:0000 0000:0390 0000:039B 0000:93E0 0000:0400 to 0000:7FFF Purposes Interrupt Vector Section (INTI, INT2, INT3 have arranged the interrupt section and stack segment Stack Segment BUFFER SYSTEM DATA BUFFER (Only if needed) USERS RAM AREA

System Data of RAM:


0000:039B Store 9B, will stop at the subprogram exit next to the WAIT command each time it leave the interrupt display subprogram, waiting for F2 to continue execution (is used in TRACE to convert to single-step hardware). TRACE Buffer Flags, function of each byte is as followed: BIT: 0 1 2 3 4 5 6 7 : : : : : : : : Enter NMI as 1, otherwise as 0
After the G key, will be set to as 0, SHIFT + F7

0000:039C 0000:039D 0000:039F

During subprogram, is set to as 1 Set to 1 after entering INTERRUPT Use in interrupt system Use in interrupt System Set 0 to INTERRUPT, and set 1 to TRACE Set TRACE or INTERRUPT as TF flags, timer 1 0000:03A0 0000:03A5 0000:03AE 0000:03AF 0000:039E 0000:03B0 0000:03D8 Data stored in the register monitor during interruption Flags, use the command A Preserved battery to test bit Buffer of Interrupt setting

Note: Address 4350 to 4900 is used for internal operation of trainer and this area in not user accessible.
Nvis Technologies Pvt. Ltd. 29

NV5586A

Subroutines
Address F000:F000 F000:F003 Address F000:F040 F000:F042 F000:F044 F000:F047 F000:F048 F000:F04B F000:F04C F000:F04F F000:F050 F000:F053 F000:F054 Text JMP BCBA JMP BB00 Text CALL SI RETF CALL FEEO RETF CALL FEFO RETF CALL FFOO RETF CALL FE7A RETF CALL FE8A Description Recorder Program RS-232 Program Description

Practical Use of Subprogram (ROMS Content)

Write ALs instruction into LCD Write ALs data into LCD Read LCD and store data in AL Input keys and store value in AL Convert input numerical values into ASCII code and store in AL. If it is not a number than it will be set to C-Flags as 1. Convert the input alphabetical values into ASCII code. If it is not an alphabet then it will be set to C-Flags as 1.
Convert the input symbols into ASCII code and store in AL. If it is not a symbol than set to C-Flags as 1.

F000:F058

CALL FEAO

F000:F05B F000:F05C

RETF CALL FEB5

F000:F05F F000:F060

RETF CALL FDF5

Convert the input functional keys into ASCII code and store in AL. Otherwise, set to CFlags as 1. Call for the above 4 sub-program and change input key into ASCII to store in AL. Save the input 4 digits in DX, display position from BL to BH instruction.

F000:F063 F000:F064

RETF CALL FB35

F000:F067 F000:F068

RETF CALL EA35

F000:F06B F000:F06C

RETF CALL FAAO Store input 4 digits in DX as SEGMENT BASE 30

Nvis Technologies Pvt. Ltd.

NV5586A AND ANOTHER 4 digits as the Effective address in DI (DX: DI). F000:F06F F000:F070 F000:F073 F000:F074 F000:F077 F000:F078 F000:F07B F000:F07C F000:F07F F000:F080 F000:F083 F000:F084 F000:F088 F000:F08B F000:F08C F000:F08F F000:F094 RETF CALL FE15 RETF CALL FE30 RETF CALL FF2B RETF CALL FCD5 REFT CALL FD20 RETF CALL FDCO CALL FFOA RETF CALL FF20 RETF CALL F39A Convert the ASCII code in AL to hexadecimal Convert the hexadecimal in AL to ASCII code and
store in between AH and AL

Delete one line Clear the screen Cursor blinking movement Insert the lower 4 bits into the DX with BH instruction Write the hexadecimal in AL into cursor address Write the hexadecimal in AX into cursor address Write the hexadecimal in AX into BL designated address Read in 2 letters from BL designated position, change to hexadecimal and store in AX Read in 4 letters from BL designated position, change to hexadecimal and store in AX Beep...... Extended subprogram can be planned. Plan 8253 #2 counter as the extended counting and check key-in
when leaving the subprogram

F000:F097 F000:F098

RETF CALL FD4A

F000:F09B F000:F09C

RETF CALL FD7A

F000:F09F F000:F0A0 F000:F0A3 F000:F0A4

RETF CALL FE55 RETF CALL EFDA

F000:F0A7 Codes Table:

RETF

The key-in code in transferred to ASCII and the ability to transfer the address, FF means empty codes that have not been defined. Character Code: (F000:FF60 - FF83) F000:FF60 : ASCII Number 30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 38 8 39 9 41 A

Nvis Technologies Pvt. Ltd.

31

NV5586A :FF70 : ASCII 42 43 C 44 D 45 E 50 P 46 F 51 Q 47 G 52 R 48 H 53 S 49 I 54 T 4A 4B 4C J 55 U K 56 V FF L 57 W FF

Alphabet B ASCII

4D 4E 4F N 59 Y O

Alphabet M FF80 : ASCII 58

5A FF FF FF FF FF FF Z

Alphabet X

Symbols Code: (F000:FF90-FFBF) F000:FF90 : ASCII Symbols ASCII Symbols :FFA0 : ASCII 29 FF 3D 5F = 7E ^ 2C 2E , . FF FF 5B 5D 7B [ ] 7D FF { } FF FF 2F / 2D 7F FF < 26 & 3C > 3E ? 28 ( 3F

2A 2B * +

Symbols ) ASCII :FFB0 : Symbols ASCII 21

FF FF

3B 3A 22 ; : 25 % "

23 #

24 $

Symbols ! Functional key: (F000: FFBC-FF9B)

2D SP 93 Note: 90 CLS 91 GO 92 20 SP 0D FF D4 INS D3

0D D0 EDIT

FF FI D1 LIST

94 DEL D2

1. CTRL ON conditions have not been defined. 2. SP and area use under the key SHIFT ON and OFF.
Checking section of interrupt vector position After RESET, the system program will allow the stored data to begin from 0:0000 until Interrupt vector position. FF is the undefined interrupt that for the user to decide. FF F000:FFC0 : 30 FF FF FF FF FF F7 INT2 FF FF FF FF FF 00 FF FF FF FF FF F0 FF FF FF FF CA 1A INT3 FF FF FF FF F7 INT1 F7 FF FF FF FF 00 00 FF FF FF FF F0 F0 FF FF FF FF

FFD0 FFE0

: :

Nvis Technologies Pvt. Ltd.

32

NV5586A Sub-Program: The 8086/8088 so-called subprogram has both the same segment calling and the different segment calling. The different segment calling is used towards the different. The different segment calling is used towards the different segment of subprogram. The subprogram of this system program has to be all in the same segment in order to call the same subprogram (the same segment and different segment subprogram are different from RET command). For user convenience, the system program will start from F000:F040 as the catalog section of the subprogram. In the subprogram catalog segment, if the same segment subprogram RET is changed to different segment subprogram RET is changed to different segment subprogram RETF. The user can therefore choose the different segment calling from any segment to call one of the subprogram in the catalog segment. Another method of using system subprogram is to use the M command to move all the programs in the system into the users segment. This allows direct access to the calling commands in the segment. Since there are other subprogram that can be called from the subprogram, all the programs have to be moved together in order to protect each other address (when every subprogram is being used in the catalog, it should start moving from F000:EA00-FF4F), it is therefore a waste of space. The user can add new program into the empty space of catalog section.

Operation description of sub-program:


F000 : F040 CALL SI The calling of the implied address will allow the subprogram address to be registered into the SI calling if a called program is not in the catalog section. Input Parameter Output Parameter F000 : : : The calling of subprogram address is instructed by SI.However, others depend on the needs of the subprogram calling. Depends on the execution of subprogram. F044 CALL FEEO

Write all the commands in the AL into the LCD modular. Input Parameter Output Parameter F000 : : : AL stores the LCD modular orders that have been written in. None F048 CALL FEFO

Write all the data from AL into the cursor position of the LCD (the position of the address counter). Input Parameter Output Parameter F000 : : : Written data is stored in AL None F04C CALL FF00

Read out data from cursor position of LCD (the instructed position of address counter) into AL. Input Parameter Output Parameter F000 : : : None AL stores the read in data. F050 CALL FE7A

Read out the key-in from 8279 (execute only when the key is pressed). Input Parameter Output Parameter F000 : : : None The key-in value is stored in AL. F054 CALL FE8A

Change the numerical key-in value into ASCII code, clear the C-Flag to 0 for numerical key otherwise set 1 for non-numerical key with out changing AL value. Input Parameter : The key-in value is stored in AL

Nvis Technologies Pvt. Ltd.

33

NV5586A Output Parameter : If it is a numerical key, transfer into the relative ASCII values, store in AL and clear all flags. All non-numerical keys are set in C-Flag, and AL value changes. F000 : F058 CALL FEAO Change the alphabetical key-in value into ASCII code; clear the C-Flags to 0 for alphabetical keys otherwise set 1 for non-alphabetical keys without changing the AL value. Input Parameter Output Parameter F000 : : : The key-in value is stored in AL If is an alphabetical key, transfer to ASCII code to be stored in AL and clear the C-Flags. Otherwise, the AL value will not change. F05C CALL FEB5

Change the signs key-in into ASCII code, the undefined signs key will be transferred to FF to be stored in AL, and clear the C-Flag to 0; otherwise set the flags to 1 without changing the AL values. Input Parameter : The key-in value is stored in AL. Output Parameter : If it is a sign, transfer to ASCII code to be stored in AL and clear the C-Flag, otherwise, set the C-Flags to 1 without changing AL values. F000 : F060 CALL FDE5 Change the functional keys into the key-in values (Enter and SP keys as the ASCII code, whereas others are set by the system program), those undefined one will be stored as FF in AL and clear the C-Flag to 0. Input Parameter : The key-in codes are stored in AL. Output Parameter : If it is functional key, transfer to key-in code to be stored in AL and clear the C-Flags, otherwise set the C-flags to 1 without changing AL values. F000 : F064 CALL FB35 A combination of (6) (7) (8) (9) function. Input Parameter : The key-in values are stored in AL. Output Parameter : The AL not only transfers the code but also clear the C-Flags to 0. Otherwise set the C-Flag to 1 without changing AL values. F000 : F068 CALL EA35 Input a 4 digits number at the BX appointed location and store in DX in order to be displayed in LCD modular. BL will appoint the first position. BH will appoint BL where to start, BH has to be smaller than 4 & follows the address counter in the LCD modular. When BL=X0XX XXXX, it is the first line; when BL = X1XX XXXX, it is the second line. The exact location is the sum of BL and BH. When input, key and key will operate the cursor location. If the key-in function is changed to key code, it will leave the subprogram after it is stored in AL. The BH is set to 0 for first time entry, the rest will be according to the key-in to determine the code. Input Parameter: DX BL BH Output Parameter: AL DX F000 : : : The code used for storing functional key. Store the displayed numbers. F06C CALL FAA0 : : : The first displayed number after the entry The display location of word at the most left side. Which location from BL the character starts.

The appointed location of BL and BH, the code of input section and effective address are stored consequently in DX and DI (i.e. DX: DI).

Nvis Technologies Pvt. Ltd.

34

NV5586A The displayed location of most left side character is instructed by BL, BH instructs the position from the first character onwards. If BH is smaller than 9 but not equal to 4, BL add to BH will be the exact location of display location. The keys, are used to operate the cursor while input numbers. It will also allow the cursor to move between segment and effective address. Other than these three functional keys, the rest will transfer to code number and jump out of subprogram. Input parameter : BL BH Output Parameter F000 : : : : Instruct the most left side word to display location. The rules is the same as (1). Instruct the position starting from BL, first entry into the subprogram is set to 0, program execution will follow the operation whether to add or subtract. Al stores the key-in code of functional keys. F070 CALL FE15

Transfer the numbers in AL from ASCII code to hexadecimal to be stored in lower 4 bits of AL , clear to C-Flag at the same time to 0. But set the C-Flag of non-numerical ASCII code to 1, without changing the code of AL. Input Parameter Output Parameter : : ASCII code of numbers that are stored in AL. The ASCII code of the numbers in AL will be transferred to hexadecimal to be stored in the lower 4 bit, clear the C-flag to 0 otherwise set C-Flags to 1 with-out changing the AL code. F074 CALL FE30

F000

After changing the hexadecimal in AL to ASCII code, the higher level is stored in AH and the lower level is stored in AL. Input Parameter Output Parameter F000 : : : AL stores the exchanged hexadecimal. AH stores the higher level ASCII, AL stores the lower level ASCII. F078 CALL FF2B

Clear the first line display of the BL, display of D.D. RAM will be stored into the blank code 20, and then the cursor will move back to the starting point. BL = X0XX XXXX means clearing the first line. BL = X1XX XXXX means clearing the second line. Input parameter Output Parameter F000 Input Parameter Output Parameter F000 Input Parameter Output Parameter F000 : : : : : : : : : BL indicates the number of cleared lines. BL stores 80 (first line) or CO (second line). F07C None None f080 None AL stores the key-in code from 8279. F084 CALL FDC0 CALL FD20 CALL FCD5

Clear display (blank code 20 is stored in the display)

The cursor blink, waiting for the key to jump out.

Insert the AL lower 4 bit hexadecimal into the DX, the location is determined by BH. BH must be smaller than r, BH = 0 represents it is inserted into the most left-sided position of DX. Input Parameter : The AL lower 4 bit means an insert into hexadecimal. 35

Nvis Technologies Pvt. Ltd.

NV5586A DX - means inserted numbers. BH - indicates inserted location. Output Parameter F000 Input Parameter Output Parameter F000 Input Parameter Output Parameter F000 Input Parameter Output parameter F000 : : : : : : : : : : : Dx is the code after insertion. F088 CALL FFOA AL stores the code that is ready for input. None F08C CALL FF20 AX stores the code that is ready for input. None F094 CALL F39A BL indicates the most left-sided location of the word. AX stores the codes that are ready for input. None F098 CALL FD4A

Write the AL code into cursor location (inside the address of the address counter).

Write the AX code into the cursor location.

Write the AX code into the BL indicated location of LCD, BL indicates the first line or second line as in (11).

The LCD which instructed by BL read out 2-bit and change it to hexadecimal to be stored in AL, also clear the C-Flag as 0. If it is a non-numerical character, the C-Flag will be set to 1 and return once AL is back. The instruction of BL location is the same as (11). Input Parameter Output Parameter : : BL indicates the read-in of the first word on the left. If read a number, then will transfer to hexadecimal to be stored in AL. The C-flag has to be cleared to 0, otherwise it is taken back to AL, and moreover the C-Flag is set to 1 in order to return. F09C CALL FD7A

F000

The LCD which instructed by BL read out 4-bit, changes to hexadecimal to be stored in AX, and Clear the CFlag to 0. If it is non-numerical code, the C-Flag is set to 1 and is also taken back into AX before it returns. Bl instructed the number on the most left, the rule ins the same as in (11). Input Parameter Output Parameter F000 Make a beep sound. Input Parameter Output Parameter F000 : : : None None F0A4 CALL FEDA : : : BL instructs the first word that is ready to read out from the most left side. The number read will be transfer to hexadecimal to be stored in AX, and clear the C-Flag to 0. Otherwise, the AL code will return and the C-Flag will be set to 1. F0A0 CALL FE55

Delay subprogram that can be designed, the delay is counted by the counter # 2 of 8253. It will check the key at the end, in order to jump out the subprogram after it read. Input Parameter Output Parameter : : Before input, counter # 2 of 8253 has to be programmed. The subprogram will check counter # 2 and Jump out once react the end. ALAL code 00 represents no key-in, otherwise AL code will be the key-in code. If AH is influenced, it will change (indefinite value). 36

Nvis Technologies Pvt. Ltd.

NV5586A Practical Examples of Subprogram: NOTE: Programs in Assembly language directly compile on Trainer Assembler while writing program in Assembly language in Trainer do not add prefix Zero (0) or any postfix like H as shown in figure and use address of label names in place of Label name in trainer.

Example-1 Input alphabetical key, and display at LCD 0:0400 0:0402 0:0407 MOV CALL MOV AL,01 F000:F044 AL,0D Clear display commands to be stored in AL Calling instruction is input into LCD subprogram Command that display ON/OFF is stored in AL 0D = 0000 1101 Letter blinking cursor OFF display ON Display ON/OFF order Call for write-in instruction subprogram Call for the read key-in Call the alphabetical key code and transfer into the subprogram Ignore the alphabetical key-in, return to original key-in; otherwise execute the next instruction. Key-in code enter into LCD modular

0:0409 0:040E 0:0413

CALL CALL CALL

F000:F044 F000:F050 F000:F058

0:0418

JB

040E

0:041A

CALL

F000:F048

0:041F JMP 040E 0:0422 HLT Program input starts executing from 400, the first word blinking can be seen at this time, they can be input again in order to be displayed on LCD. 21st to 41st word will exceed the first line display boundary, therefore they are stored in LCD modular but will not be shown. The 41st word will be the first letter on the second line. Similarly, 61st to 80th word will not be shown.

Nvis Technologies Pvt. Ltd.

37

NV5586A Example-2 Clear second line, display DX value, and DX values are altered by key-in to be display at LCD. 0:0400 MOV AL,01 0:0402 MOV BL,C0 Clear display commands to be stored in AL
Write the set LCD address counter commands into BL.

CO=1100 0000 represent the position of second line 0:0404 CALL F000:F078 Clear second line 0:0409 MOV BX,00C2 Input parameter of subprogram is stored in BX.

B0-B5 set the word at the most left side to display position, B6=1 represents the second line, B7 can be any number. After entering subprogram, it is automatically set to 1 (B=Bit). BH as 00 instructs the cursor and the first word location, first time entering subprogram is set to 0, the rest will automatically add or subtract.
0:040C CALL F000:F068 Input 4 bits. 0:0411 CMP 0:0413 JNZ AL,0D 040A whether it is Enter key Non-Enter key will jump back to input subprogram, otherwise it will execute the next command. Program will clear the second line first, but display 4 bits (DX value) on the second line and wait for input. After the key-in numbers, the display value can be altered and stored in DX. Press Enter key would stop the program. Example-3 Display 4 bits (AX value) on BL instructed location. 0:0400 MOV BL,80 Input parameter of subprogram is stored in BL. B6=0 represents 1st line 0:0402 CALL F000:F078 Clear the first line. 0:0407 MOV AX,8088 Input parameter of subprogram is stored in BL. Among 84=1000 0100, B0 to B5 display the first word on the most left side. B6 as 0 represents the 1st line display, B7 can be any value that automatically set to 1 once enter the subprogram. It is the D.D. RAM address command. 0:040A CALL F000:F094 Display AX. 0:040F HLT Program will first clear the first line, then store 8088 into AX to display the first line.

Nvis Technologies Pvt. Ltd.

38

NV5586A Example-4 Check table to display one line of letter. 0:0400 MOV BL,CO 0:0402 CALL F000:F078 Clear the second line 0:0407 MOV AL,C2 Parameter of subprogram stored in AL. B)-B5 is written into LCD address counter, instructed the word on the most left side. B6 as 1 represents the second line.B7 as 1 represents the set D.D. RAM address instruction. 0:0409 CALL F000:F044 Commands in AL are written into LCD 0:040E PUSH CS 0:040F POP DS Segment value set for table checking 0:0410 MOV SI,600 Starting address of table checking is stored into SI 0:0413 MOV CX,0A Store table checking length in CX 0:0416 CLD Clear directional flag 0:0417 LODSB Read in data from table checking section until AL. 0:0418 CALL F000:F048 Input AL data into LCD modular. 0:041D LOOP 0416 CX not equal to 0 would continue execution loop. 0:041F HLT Program execution at address 0:0600 is stored into the ASCII code of display data, like followed (can be set oneself): 0:0600 41 42 43 44 45 46 47 48 49 4A Program starts from 0:600 to be stored as ASCII data code and display on LCD modular i.e. A B C D E F G H I J.

Nvis Technologies Pvt. Ltd.

39

NV5586A
Serial Communication

NV5586A has facility of Serial Interface with PC for any serial Transmission & Reception. Through this facility one can upload & download data from / to PC. For Downloading & Uploading microprocessor lab software is provided. Microprocessor lab is simple software for IBM-PC compatible computers. It allows the user to communicate with the computer through serial port with the facility of downloading & uploading of the data between the computer and the other serial devices. The user can communicate NV5586A trainer with PC using software as below procedure mentioned.

Fig 1a First run the microprocessor lab software setup. After the installation is complete above window is appear on screen (fig 1a). Close the entire programs (like HyperTerminal) which use same com port. In software NV5585 is set as default so its image appear on screen

Fig 2a For selecting the com port of PC use selection button Select Com Port (fig2a) For connecting the NV5586A use button Connect to port, and that particular button become red. For disconnect click on same button. 40

Nvis Technologies Pvt. Ltd.

NV5586A

Fig 3a
For selecting the trainer click button Connect NV5586A and it change to Disconnect NV5586A.For disconnect the trainer click on same button.

Uploading: Microprocessor lab software provides a feature by which the data stored in NV5586A can be stored in the disk of PC. This can be achieved by following the instructions given as below: Example We are storing the program/data of NV5586A from 0000:0400 (Starting address) to 0000:04FF (End address) as an example to demonstrate the UPLOADING features.

1. On NV5586A, execute from F000:F003 using G command as follows:

Press Enter key and the following will come on the display:

Press F7 key to come in the OUT mode.

1st location indicates the starting address (F000:0400) and the 2nd location indicates the end address (0400) of the memory area to be transmitted on to the Serial Port. Change this to 0000:0400 to 04FF as follows:

Nvis Technologies Pvt. Ltd.

41

NV5586A

Fig 4a For uploading the file press Capture text (fig 4) button on lower right of window and another window shown below is appears (fig 5).

Fig 5a

2. Then give any name with extension .TXT and Click <Start>. 3. After that press <Enter> key of NV5586A trainer. 4. Now you will see Data on the Response window.

Fig 6a

5. After file transfer complete click on button Save File (fig 6) 6. Now your file is saved in the PC. By this procedure one can upload data in PC.
Downloading: The following procedure is to be adopted for downloading the file from PC to NV5586A. For Down Loading the .KIT or .TXT from PC to NV5586A trainer click button Send File on right lower side of screen and screen appear for selecting the file form given location .And follow the procedure given below in section Down Loading.

Nvis Technologies Pvt. Ltd.

42

NV5586A

Fig 7a

Fig 8a On NV5586A, execute from F000:F003 using G command as follows:

Press Enter key and the following will come on the display:

Change the location from F000:0400 to 0000:0400. This is the 1st RAM location data will be received from the PC and this address will keep on incrementing on receipt of each Data Byte.

Press Enter key of trainer keyboard and then click on open button on screen appear on PC 1. Then type File to be downloaded i.e. ABC.TXT. 2. After that address field on NV5586A will go on incrementing will display till the last address field at where user have saved ABC.TXT File.

Nvis Technologies Pvt. Ltd.

43

NV5586A

MASM Macro-Assembler
To use MASM Software and download generated file to Trainer please follow these steps Write program given in following format for 8086 NOTE: While writing Programs for MASM Compiler add prefix Zero (0) and postfix H as shown in figure and use label names.

; TEST PROGRAM FOR 8255 EM03 TO GENERATE SQUARE WAVE OUTPUT CODE SEGMENT ASSUME CS: CODE, DS: CODE PROG PROC FAR ORG 400H MOV AL, 80H OUT 66H, AL ;Step-1 ;0400 B0 80 ;0402 E6 66 for inbuilt 8255 change 66H to 76H ;Step-2 ;0404 B0 55 ;Step-3 ;0406 E6 60 for inbuilt 8255 change 60H to 70H ;Step-4 ;0408 E6 62 for inbuilt 8255 change 62H to 72H ;Step-5 ;040A E6 64 for inbuilt 8255 change 64H to 74H ;040C E8 0D 00 ;040F B0 AA ;Step-6 ;0411 E6 60 for inbuilt 8255 change 60H to 70H ;Step-7 ;0413 E6 62 for inbuilt 8255 change 62H to 72H ;Step-8 ;0415 E6 64 for inbuilt 8255 change 64H to 74H ;0417 E8 02 00 ;Step-9

START:

MOV AL, 55H OUT 60H, AL

OUT

62H, AL

OUT

64H, AL

CALL DELAY1 MOV AL, 0AAH OUT 60H, AL

OUT

62H, AL

OUT

64H, AL

CALL DELAY1 JMP DL1:

DELAY1:

START; 041A EB E8 MOV CX, 0000H ;041C B9 0000 DEC CX ;041F 49 44

Nvis Technologies Pvt. Ltd.

NV5586A JNZ DL1 RET PROG ENDP CODE ENDS END ;0420 75 FD ;0422 C3

Starting Portion and ending portion should be there. In between this we can write any instructions with initial address Org 400H program NOTE: We can write above file in any window or dos editor directly. And change extension to .ASM Step2>save above file suppose file name ABC.ASM in same folder where the assembler is saved. Step3>Now do the following steps Open command prompt window by typing cmd in run command a window appears as shown below

Now enter into the cross assembler directory for my system it is in C: drive

Run MASM file in below mention format

Nvis Technologies Pvt. Ltd.

45

NV5586A Then press ENTER key of PC keyboard four times .The PC screen will display SUCCESSFUL 0 WARNING & 0 SERVE ERROR Note: The ASM file should be in same folder where MASM assembler is placed Step4>Run LINK file in below mention format C :> LINK.exe ABC (No need to give any extension.) Then press ENTER key of PC keyboard four times PC screen will display SUCCESSFUL 0 WARNING TO STACK SEGMENT. Step 5>Run EXE2BIN file in below mention format. C:>EXE2BIN.exe ABC (No need to give any extension) Then ENTER key of PC keyboard once. It will generate binary file of your program Step 6>Now run Ascbin.exe in the below mention format C:>Ascbin.exe then ENTER(from PC keyboard) This is a Program to convert ascii file to bin file & bin file to ascii file After pressing ENTER it will show Press <ESC> to exit program Press <s> & <enter> to exit now Press <c> & <Enter> to continue Now Press C for continues. Step 7> Window will open asking for 1) BIN to ASCII 2) ASCII to BIN Select no 1 for BIN to ASCII then ENTER (from PC keyboard) Step 8>Again window will open asking for Enter the BIN filename? Enter the filename with extension ABC.bin Enter the BIN filename? ABC.bin After pressing ENTER it will again prompt for ASCII filename Enter the ASCII filename? ABC.ASC Note: In these fields extensions are necessary Enter origin? 0000:0400 then ENTER (from PC keyboard) Our ASCII file will be generated named ABC.asc down load this file into M808602 Connect HyperTerminal with kit then select transfer then send text file. Our file will be down loaded into kit.

Nvis Technologies Pvt. Ltd.

46

NV5586A Sample Programs The monitor software of NV5586A resides in 128K Byte of EPROM. The system software has certain useful routines, which can be utilized by the user for developing his programs. The address of these routines is given in the Subroutine chapter. Example The following sample programs are given here to make the user familiarize with the operation of NV5586A.

1. 16-bit addition 2. 16- bit subtraction 3. 16-bit multiplication 4. 32- bit division 5. Program for addition of two no and display it on LCD 6. Moving data form 500 memory location to 600 memory location 7. Program for moving string form one memory location to other 8. Searching a no in given array 9. Program for comparing two string 10. Program for comparing two string 11. Find the largest number in a given string. 12. Sort a string of bytes in descending order. 13. ASCII multiplication. 14. Divide a string of unpacked ASCII digits. 15. Calculate the no. of bytes in a string of data. 16. Convert the string of data to its compliment form.
NOTE: Programs in Assembly language directly compile on Trainer Assembler while writing program in Assembly language in Trainer do not add prefix Zero (0) or any postfix like H as shown in figure and use address of label names in place of Label name in trainer.

Program-1:

16-BIT ADDITION:
MEMORY ADDRESS OPCODES MNEMONICS

400 403 406 40A 40E INPUT: 1234+ 5678

B8 34 12 05 78 56 88 26 20 04 88 66 21 04 F4

MOV AX,1234 ; Load 1234 in AX ADD AX,5678 ; Add 5678 to content of AX MOV [420],AH ; Load result on ram location420 & 421 MOV [421],AL HLT

RESULT: Result at 420 and 421 = 68AC

Nvis Technologies Pvt. Ltd.

47

NV5586A Program-2:

16- BIT SUBTRACTION:


MEMORY ADDRESS OPCODES MNEMONICS

400 403 406 40A 40E INPUT: 4343 - 2121

B8 43 43 2D 21 21 88 26 20 04 88 06 21 04 F4

MOV AX,4343 ; Load 4343 to AX SUB AX,2121 ; Sub content of AX to 2121 MOV [420],AH ;Load result on ram location 420 MOV [421],AL ;Load result on ram location 421 HLT

RESULT: Result at 420 and 421= 2222


Program-3:

16-BIT MULTIPLICATION:
MEMORY ADDRESS OPCODES MNEMONICS

400 403 406 408 40C 410 414 418 INPUT:

B8 34 12 BB 11 11 F7 E3 88 36 50 04 88 16 51 04 88 26 52 04 88 06 53 04 F4 FEDC*BA98

MOV AX, FEDC ; Load FEDC to AX MOV BX, BA98 ;Load BA98 to BX MUL BX MOV [450],DH ;Load result to 450 memory location MOV [451],DL ;Load result to 451 memory location MOV [452],AH ;Load result to 452 memory location MOV [453],AL ;Load result to 453 memory location HLT

RESULT: 450 & 451 = B9C3 452 & 453 = 2AA0.


Program-4:

32- BIT DIVISION:


MEMORY ADDRESS OPCODES MNEMONICS

400 403 406 408 40B 40F 413 417 41B

BA 00 00 B8 FF FF B9 FF FF F7 F1 88 26 50 04 88 06 51 04 88 36 52 04 04 16 53 04 F4

MOV DX,0000 MOV AX,FFFF MOV CX, FFFF DIV CX MOV [450],AH MOV [451],AL MOV [452],DH MOV [453],DL HLT

;Load dividend to DX ;Load to AX ;Load divisor to CX ;Load result to 450 ram location ;Load result to 451 ram location ;Load result to 452 ram location ;Load result to 450 ram location

INPUT: DIVIDEND: DX = 0000 AX = FFFF DIVISOR: CX = FFFF

Nvis Technologies Pvt. Ltd.

48

NV5586A

RESULT: 450 & 451 = 0001 452 & 453 = 0000


Program-5:

Program for addition of two no and display it on LCD Memory Opcode Address 400 B8 30 00 403 05 30 00 406 88 C2 Mnemonics MOV AX,30 ADD AX,30 MOV DL,AL Comments Move data in AX ADD data to content of AX Move lower 8 bit of AX in to lower 8 bit of DX Call to display function Move higher 8 bit of AX to higher 8 bit of DX Call to LCD display function Unconditional jump to 408 MEMORY location

408 40D

9A 78 F0 00 F0 88 E6

CALL F000 :F078 MOV DH,AH

40F 414

9A 68 F0 00 F068 CALL F000;F068 75 F2 JNE 0408

416

F4

HLT

Here the data is break in to part because we can transfer 8 bit at a time on LCD using given function Operand 30+30 Result =60
Program- 6:

Moving data form 500 memory locations to 600 memory locations Address 400 403 406 409 40B 40D 40E 40F 410 412 OPCODE BE 0005 BF 0006 B9 0F 00 8B 04 89 05 46 47 49 75 F7 F4 MNEMONICS MOV SI,500 MOV DI,600 MOV CX,000F MOV AX,[SI] MOV [DI],AX INC SI INC DI DEC CX JNE 409 HLT Comments Starting Location Destination Location No byte to transfer

Enter the data at 500 location Ex-01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16 And after running the code above data is transfer to 600 locations

Nvis Technologies Pvt. Ltd.

49

NV5586A Program -7:

Program for moving string form one memory location to other Address 400 404 408 40C 40D 40E 40F OPCODE 8B 0E 00 05 8D 36 50 05 8D 3E 00 06 FC F3 A4 HLT MNEMONICS MOV CX,[500] LEA SI,[550] LEA DI,[600] CLD REP MOVSB F4 Comments Size of string is store at 500 location Load effective address

Move string byte

1. Enter the size of string on 500 memory location 2. Enter the string on 550 memory location 3. String copy to 600 memory location
Program -8:

Searching a no in given array Memory Address 400 403 406 408 409 40B 40C 40E 410 411 413 415 417 419 41B 41D 41F INPUT: Opcode BE 00 05 BF 00 06 8A 0C 46 8A 04 46 3A 04 74 09 46 FE C9 75 F7 B0 FF 88 04 8A 1C 88 1D CD 02 F4 Mnemonics MOV SI,500 MOV DI,600 MOV CL,[SI] INC SI MOV AL,[SI] INC SI CMP AL,[SI] JZ END INC SI DEC CL JNZ 40C MOV MOV [SI],AL MOV BL,[SI] MOV [DI],BL INT 02H HLT Comments

LOOP:

AL,0FFH END:

500 = 04H (LENGTH 0F ARRAY) 501 = 35H 502 = 18H 503 = 35H 504 = 54H 505 = 72H Note: The element which one we want to search is stored at location 501h & The number of elements in an array is stored at location 500h.
Nvis Technologies Pvt. Ltd. 50

NV5586A

RESULT: 1. If the elment which one we want to search is in an array, then it will be store at the location [500] i.e 35 is stored 2. If the element which one we want of search is not in an array, then FF will be stored at location 600 to indicate ERROR condition.
Program -9:

Program for comparing two string Address 400 404 408 40B 40D 40E 410 412 416 OPCODE 8D 36 00 05 8D 3E 50 05 B9 03 00 FC F3 A6 75 07 B0 01 FF MNEMONICS LEA SI,[500] LEA DI,[550] MOC CX,0003 CLD REP CMPSB JNE 417 MOV AL,01 HLT

Location of 1 string Location of 2 string Size of string

Enter the string at address 500 Ex-AA,BB,CC Enter the 2 string at address 550 Ex-AA,BB,CC If both string are same then result is 01 at 600 location and string are not matching then 00 at 600 memory location
Program-10: To ADD two Binary numbers each 8 Bytes long: Add, Op Code Mnemonic Comments 0 400 F8 CLC Clear Carry Flag. 0401 B9 04 00 MOV CX,0004 Load Counter register with no. of times addition to be performed(i.e. Initialize the counter register). 0404 BE 00 05 MOV SI,0500 Load source Index Reg. with starting address of Ist Binary no. (LSBs array). 0407 BF 08 05 MOV DI, 0508 Load Destination Index Reg. with Dest. Address (where the result of add. is to be started storing). Also its the starting address of MSBs of array. 040A 8B 04 MOV AX,[SI] Load Data bytes (which are in location Nvis Technologies Pvt. Ltd. 51

NV5586A 0500 and 0501 in 16 bit ACC. i.e. (0500) AH (0501) AL ADC [DI],AX Add the contents (MS Bytes) of 0508, 0509 with the contents (LS Bytes) of 0500 + 0501 and store the result in location 0508 onwards. INC SI Point at 0502 LOCN (Next relevant source LOCN). INC DI Point at next relevant LOCN, i.e. INC DI 0504. DEC CX Decrement the counter. JNE 040A If not zero (i.e. CX =0000) then continue addition. HLT Else, Halt. After Execution 0500 0501 0502 0503 0504 0505 0506 0507 : : : : : : : : 01 02 03 04 05 06 07 08 0508 0509 050A 050B 050C 050D 050E 050F : : : : : : : : 0A 0B 0C 0E 0F 10 11 12 0508 0509 050A 050B 050C 050D 050E 050F : : : : : : : : 0B 0D 0F 12 14 16 18 1A

040C

11 05

040E

46

0410 0411 0412 0413

47 47 49 75 F5

0415

F4

For example:

Program - 11: To find the maximum no. in a given string (16 Bytes long) and store it in location 0510. Add. 0400 Op Code BE 00 05 Mnemonic Comments MOV SI, 0500 Load SI reg. with starting address of string. MOV CX, 0010 Initialize Counter Reg. (with the length of string i.e. no. of bytes). MOV AH, 00 Initialize the 8 bit Acc. CMP AH,[SI] The 1st data byte of the string with 00. JNB 040E If both bytes match (above is equal) then branch to (l). MOV AH,[SI] Else, move the contents of (0500)

0403

B9 10 00

0406 0408

B4 00 3A 24

040A

73 02

040C

8A 24

Nvis Technologies Pvt. Ltd.

52

NV5586A into 8 bit ACC, i.e., a real no. in AH. Point at the next address of string. Decrement the counter value, if not zero, continue processing (searching to the Max. No. continued.) Max. No. in 0510 address. Halt.

040E 040F

46 E0 F7

INC SI LOOPNE 0408

0411

88 24

MOV[SI],AH HLT After Execution

0413 F4 For example 0500 0501 0502 0503 0504 0505 0506 0507 : : : : : : : : 01 02 03 04 05 06 15 07

0508 0509 050A 050B 050C 050D 050E 050F 0510

: : : : : : : : :

12 08 09 0A 0B 0E 0C 0D 15

Program - 12: To sort a string of a no. of bytes in descending order: Add. 0400 Op Code BE 00 05 Mnemonic MOV SI,0500 Comments Initialize SI Reg. with Mem LOCN 0500. BX has the no. of bytes (to be used for sorting) LOCNS 0500 & 0501. Decrement the no. of bytes by one. Also CX has the no. of bytes in LOCNS 0500 and 0501. Decrement the no. of bytes by one. Initialize SI reg. with the starting address of string (having data bytes). Move the first data byte of string into AL. Point at the next bytes of the string. Compare the two bytes of string. If two bytes are 53

0403

8B 1C

MOV BX, [SI]

0405 0406

4B 8B 0C

DEC BX MOV CX [SI]

0408 0409

49 BE 02 05

DEC CX MOV SI, 0502

040C

8A 04

MOV AL, [SI]

040E 040F 0411

46 3A 04 73 06

INC SI CMP AL,[SI] JAE 0419

Nvis Technologies Pvt. Ltd.

NV5586A equal or 1st byte is above that the second Byte Branch to (1). Else Second byte is less than first byte and swap (interchange) the two bytes. Point at the next LOCN of the string. Loop if CX is not zero (i.e. continue processing till z=0) At this juncture, first sorting will be over i.e. first no. is logically compared with the rest of the nos. For the correct sorting, all the nos. must be compared with each other logically, i.e. above processing should be carried out no. of bytes times. Halt.

0413 0415

86 04 4E

XCHG AL, [SI] DEC SI

0416 0418 0419

88 04 46 E2 F1 (1)

MOV [SI],AL INC SI LOOP 040C

041B

4B

DEC BX

041C

BE 00 05

MOV SI,0500

041F 0421

75 E5 F4

JNE 0406 HLT After Execution

For Example 0500 : 0501 : 0502 : 0503 : 0504 : 0505 : 0506 : 05 00 20 25 28 15 07 0502 : 0503 : 0504 : 0505 : 0506 : 28 25 20 15 07

Program - 13: ASCII Multiplication To multiply an ASCII string of eight numbers by a single ASCII digit. The result is a string of unpacked BCD digits. Add. 0400 Op Code BE 00 05 Mnemonic MOV SI,0500 Comments Load SI reg. with starting address of string. Load DI reg. with the starting address of result 54

0403

BF 08 05

MOV DI,0508

Nvis Technologies Pvt. Ltd.

NV5586A LOCNS. Load DL with the. Multiplier ASCII Digit. Load counter reg. with the no. of bytes in the string. MS nibble of Multiplier is zeroed. First ASCII no. of string in AL. Point at the next LOCN in string (of ASCII Nos.) MS nibble at Multiplier no gap and is also zeroed. Perform the fn. AX = AL* DL Perform the fn. AH=AL/0A, AL=remainder. The contents of AL (remainder obtained by performing the above operation) Added with 00 which are in 1st Dest. LOCN. The contents of AL are unpacked Decimal no. and are stored in 1st Dest. LOCN (=0508). Point at the next Dest. LOCN. Contents of AH (Quotient got in AAM operation) are moved in next best. LOCN (0509). Decrement the Counter reg. If not zero, continue multiply and storing unpacked BCD digits, ELSE. HALT.

0406

B2 34

MOV DL,34

0408

B9 08 00

MOV CX,0008

040B 040E 0411 0413

C6 05 00 80 E2 0F 8A 04 46

MOV BYTE[DI],00

AND DL, 0F MOV AL, [SI] INC SI

0414

24 0F

AND AL, 0F

0416 0418

F6 E2 D4 0A

MUL DL AAM

041A

02 05

ADD AL,[DI]

041C

37

AAA

041D 041F 0420

88 05 47 88 25

MOV [DI],AL INC DI MOV [DI],AH

0422 0423

49 75 EB

DEC CX JNE 0411

0425

F4

HLT

For Example After Execution (Unpacked BCD Digits) 0500 : 31 0508 : 04

Nvis Technologies Pvt. Ltd.

55

NV5586A 0501 0502 0503 0504 0505 0506 0507 : : : : : : : 32 33 34 35 36 31 32 0509 : 050A : 050B : 050C : 050D : 050E : 050F : 08 02 07 01 06 06 08

Program - 14: To Divide a String of Unpacked ASCII Digits: Add. 0400 Op Code B2 36 Mnemonic MOV DL, 36 Comments DL having the divisor, a single 8 bit ASCII Digit. MOV SI, 0500 Load SI with the starting address of ASCII string. MOV DI, 0508 Load DI with the starting address of the result LOCNS. MOV CX, 0008 Initialize the counter Reg. with the no. of bytes in the string. AND DL, 0F MS nibble of DL contents is zeroed. XOR AH,AH Initialize the 8 bit ACC (=00) LODSB Load AL with the contents of address accessed by SI reg. and increment SI reg. i.e. point at the next address LOCN. AND AL,0F MS nibble of AL contents is also zeroed. AAD Perform the fn. AL=(AH * OA) + AL), AH = 00. DIV DL Perform the fn. AD/DL AL = Quotient and AH = reminder. STOSB The contents of AL are stored in the Address pointed to by the DI reg. and next address LOCN in DI reg. is pointed (i.e. current address LOCN of DI reg. is incremented by one). LOOPNE 0410 Continue dividing the unpacked ASCII 56

0402

BE 00 05

0405

BF 08 05

0408

B9 08 00

040B 040E 0410

80 E2 0F 32 E4 AC

0411 0414

80 E0 0F D5 0A

0416

F6 F2

0418

AA

0419

E0 F5

Nvis Technologies Pvt. Ltd.

NV5586A digits if the contents of C are not zeroed; else. Halt.

041B

F4

HLT

For Example After Execution 0500 : 0501 : 0502 : 0503 : 0504 : 0505 : 0506 : 0507 : 31 32 33 34 35 36 31 32 0508 0509 050A 050B 050C 050D 050E 050F : : : : : : : : 00 02 00 05 07 06 00 02

Program - 15:

To calculate the no. of bytes in a string starting from 0502 up to an identifier (data byte) placed in AL reg. The actual count will be in LOCN 0500 & 0501.
Add. OpCode Mnemonic
0400 BE 00 05 MOV SI, 0500

Comments

Load SI reg. with the starting Address where the result is to be stored. 0403 B9 FF FF MOV CX, FFFF Initialize the counter register. 0406 BF 02 05 MOV DI, 0502 Load DI reg. with the starting address of string. 0409 B0 03 MOV AL, 03 Store the identifier in ASL. 040B F2 REPNE 040C AE SCASB Data byte accessed by DI reg. compared with identifier without altering either of the contents, this comparing continuous with the incrementing of DI contents (Address LOCN) till the two bytes match. With each scanning the contents of CX go on decrement by one. 040D F7 D1 NOT CX ZS complemented CX & Move CX 89 OC MOV (si),CX 040F contents into 0500. 040F F4 HLT Halt.

Nvis Technologies Pvt. Ltd.

57

NV5586A For Example Let (509) = 03 Let (0502) = 03 Then after executing the program CX = 0008 & (0500) = 08 (0501) = 00 Program - 16: A Data string of no. of bytes (to be specified in CX reg.) is located from the starting address 0500. This data string is to be converted to its equivalent 2' S complement Form and the result is to be stored from 0600 on wards. Add. Op Code 0400 BE 00 05 Mnemonic MOV SI, 0500 Comments Load SI reg., with the starting address of data string. MOV DI, 0600 Load DI with the starting address of result LOCNS. MOV CX, 0010 Load CX with the no. of bytes in the string. LODSB Load AL with Data byte accessed by SI reg. and increment the address LOCN in SI reg. NEG AL The contents of AL are 2s complemented. STOSB Store AL contents in LOCN pointed to by DI ref. & increment the current Location in DI reg. Loop NE 0409 If CX = 0000, continue 2s complementing the data in string else; HLT Halt.

0403 BF 00 06

0406 B9 10 00

0409 AC (1)

040A F6 D8

040C AA

040D E0 FA

040F F4 For Example

After Execution 0500 0501 0502 0503 0504 0505 0506 0507 : : : : : : : : 01 02 03 04 05 06 07 08 0600 0601 0602 0603 0604 0605 0606 0607 : : : : : : : : FF FE FD FC FB FA F9 F8

Nvis Technologies Pvt. Ltd.

58

NV5586A 0508 0509 050A 050B 050C 050D 050E 050F : : : : : : : : 09 0A 0B 0C 0D 0E 0F 10 0608 0609 060A 060B 060C 060D 060E 060F : : : : : : : : F7 F6 F5 F4 F3 F2 F1 F0

Program 17: Serial Port Programming This following program will character from PC and displayed on LCD. The baud rate parameters to be set are same as described earlier in this chapter. Use Hyper Terminal communication software on your PC which is mentioned in Serial Communication Chapter. A). This program receives the character from PC and display it on LCD. Add. OpCode
0400 B0 B7 0402 E6 03 0404 B0 13

Mnemonic
MOV AL,B7 OUT 03,AL MOV AL,13

Comments
control word format of 8253 count is given to set the baud rate at 4800

0406 0408 040A 040C

E6 02 B0 00 E6 02 B0 4E

OUT MOV OUT MOV

02,AL AL,00 02,AL AL,4E

mode instruction format in asynchronous mode command instruction format make transit enable and receive enable high

040E E6 51 0410 B0 05

OUT 51,AL MOV AL,05

0412 E6 51 OUT 51,AL 0414 9A 7C F0 00 F0 LM: CALLF000:F07Cclear the display 0419 B3 80 MOV BL,80 delete the first line 041B 9A 78 F0 00 F0 CALLF000:F078 0420 B9 14 00 MOV CX,0014 0423 E4 51 L1: IN AL,51 check for Rx RDY signal 0425 24 02 AND AL,02 0427 74 FA JE 0423 0429 E4 50 IN AL,50 character is received from PC terminal & displayed into LCD modulator in first line 042B 9A 48 F0 00 F0 CALLF000:F048 0430 E2 F1 LOOP 0423 0432 B3 C0 MOV BL,C0 delete second line 0434 9A 78 F0 00 F0 CALLF000:F078 0439 B9 14 00 MOV CX,0014 043C E4 51 L2: IN AL,51 check for Rx RDY

Nvis Technologies Pvt. Ltd.

59

NV5586A
signal 043E 2402 0440 74FA 0442 E4 50 AND AL,02 JE 043C IN AL,50

received the character in second line

0444 9A 48 F0 00 F0 0449 E2 F1 044B E9 C6 FF

CALLF000:F048 LOOP 043C JMP 0414

Execute using G 000:0400 and press any key on the PC keyboard, same will be displayed on the LCD display of the NV5586A. B). The following example will transmits characters to PC and simultaneously display on LCD. Add. Op Code
0400 B0 B7 0402 E6 03 0404 B0 13

Mnemonic
MOV OUT MOV AL,B7 03,AL AL,13

Comments
control word format for 8253 count is given to set the baud rate at 4800

0406 0408 040A 040C

E6 02 B0 00 E6 02 B0 4E

OUT MOV OUT MOV

02,AL AL,00 02,AL AL,4E

mode instruction format in asynchronous mode ;make transmit enable and receive enable high

040E E6 51 0410 B0 05

OUT MOV

51,AL AL,05

0412 0414 0419 041C 041E 0423 0424

E6 51 B9 14 00 B3 80

OUT

51,AL CX,0014 BL,80 F000:F078 CX F000:F050

9A 7C F0 00 F0 L3: CALL F000:F07C clear the display

MOV MOV 9A 78 F0 00 F0 CALL 51 L2: PUSH 9A 50 F0 00 F0 CALL

delete the first line

0429 9A 58 F0 00 F0 042E 0433 0434 0436

CALL F000:F058

call for the read key in CALL F000:F058;call the alphabetical key code and transfer into subprogram key in code enter into LCD modulator. AX check for TxRDY signal

9A 48 F0 00 F0 CALL F000:F048 50 PUSH E4 51 L1: IN AL,51 24 01 AND AL,01 JE POP OUT 0434 AX 50,AL

0438 74 FA 043A 58 043B E6 50

transmit the character to CRT terminal

043D 043E 0440 0443

59 E2 E3 B9 14 00 B3 80

POP LOOP MOV MOV

0445 9A 78 F0 00 F0

CX 0423 CX,0014 BL,80 delete the first line CALL F000:F078

Nvis Technologies Pvt. Ltd.

60

NV5586A
044A 51 L5: 044B 9A 50 F0 00 F0 0450 9A 58 F0 00 F0 PUSH CX CALL F000:F050 call for the read key in CALL F000:F058 call the alphabetical key code & transfer into subprogram CALL F000:F048 key in code enter into LCD modulator PUSH AX IN AL,51 check for TxRDY signal AND AL,01 JE 045B POP AX OUT 50,AL Transmit the character to CRT terminal POP CX LOOP 044A JMP 0414

0455 9A 48 F0 00 F0 045A 50 045B E4 51 045D 045F 0461 0462 24 01 74 FA 58 E6 50

L4:

0464 59 0465 E2 E3 0467 E9 AA FF

Execute using G command from 0000:0400 and press any NV5586A keyboard, the same will be displayed on the LCD and on the screen of PC. Program 18: 8259 Interrupt Controller

key

of

the

The following program illustrates the use of IRQ0 of 8259. Whenever user made Pin 18 of 8259 OR Pin 1 of Connector CN6 is made low. The 0000:400 program branches to 2000 address. Note: Keep SW2 in ON position while running this program. Add. Op Code
0400 B8 00 00 0403 8E D8 0405 B8 00 20 0408 040C 040F 0413 0415 0417 0419 041B 041D 041F 0421 0423 0428 89 06 00 00 B8 00 00 89 06 02 00 B0 17 E6 30 B0 00 E6 31 B0 01 E6 31 B0 FE E6 31 9A 7C F0 00 F0 B3 80

Mnemonic
MOV MOV MOV MOV MOV MOV MOV OUT MOV OUT MOV OUT MOV OUT CALL MOV AX,0000 DS,AX AX,2000 [0000],AX AX,0000 [0002],AX AL,17 30,AL AL,00 31,AL AL,01 31,AL AL,FE 31,AL F0000:F07C BL,80

Comments
data segment is initialize to zero interrupt location is defined

ICW1 Command ICW2 Command ICW4 Command unmask IRQ0 clear display input parameter of subprogram is stored in BL, clear 1st line write all the commands in AL into LCD modulator

042A 9A 78 F0 00 F0 042F B080

CALL F000:F078 MOV AL,80

0431 9A 44 F0 00 F0 0436 0E

CALL F000:F044 PUSH CS

Nvis Technologies Pvt. Ltd.

61

NV5586A
0437 1F 0438 B3 00 06 POP MOV DS SI,600

043B BE 0F 00

MOV

CX,000F

043E FC

L1:

CLD L0DSB CALL F000:F048

starting addr of table is stored into SI store table checking length in CX clear direction flag input AL data into LCD modulator

043F AC 0440 9A 48 F0 00 F0

0445 E2 F7 0447 FB 0448 E9 FD FF

LOOP STI JMP

043E 0448

2000 9A 7C F0 00 F0 2005 B3 80 2007 9A 78 F0 00 F0 200C B0 86

200E 2013 2014 2015

9A 44 F0 00 F0 0E 1F BE 21 06

2018 B9 0D 00 201B FC L3: 201C AC 201D 9A 48 F0 00 F0

2022 E2 F7 2024 CF

set interrupt flag Interrupt subroutine at 0000:2000 CALL F000:F07C clear the display MOV BL,80 delete the first line CALL F000:F078 MOV AL,86 write all the commands in AL into LCD modulator CALL F000:F044 PUSH CS POP DS MOV SI,621 addr of table is stored in SI MOV CX,00S0D table length stored in CX CLD L0DSB CALL F000:F048 input AL data into LCD modulator LOOP 201B IRET return to the execution program

0600 0621

57 41 49 54 49 4E 47 20 46 4F 52 20 49 4E 54 FF 49 52 30 20 49 4E 54 45 52 52 55 50 54

Waiting For IRQ0 Interrupt

Nvis Technologies Pvt. Ltd.

62

NV5586A Use of 8087 Processor: The following programs illustrate the use of 8087 processor. Problem 19: Write a program to calculate N3= N12 + N22 32 bit integer value stored at 300 H and 304H respectively. The result should be store at 308H. Steps Required:

1. 2. 3. 4.

Load N1 and calculate its N12 value Load N2 and calculate its N22 value Add the two. Take the square root and store it in 308 location. Mnemonic Comments

Addr. Op Code Step-1


0200 0204 0206

9B BB 00 03 MOV BX,0300H BX POINTS TO N1 DB 07 FLD (BX) Load N1 9B DA 0F FMUL (DX) Give wait calculate N12

Step-2 0209 9B DD D9 FSTP ST (1) Load N2 in ST (1) 020C 9B BB 04 03 MOV BX, 0304 H Load Bx to point N2 0210 DB 07 FLD (Bx) Load N2 0212 9B DA 0F FMUL (Bx) Get N22 Step-3 0215 9B D8 C1 FADD ST (1) Add the N12 + N22 the result is on TOP of stack. Step-4 0218 9B D9 FA FSQRT Calculate square root of N12 + 22 021B 9B BB 08 03 MOV BX, 0308 Load BX with 0308 for storing result. 021F DB 17 FST (BX) Store the result (TOS) 0221 9B FWAIT ON 0308. 0222 CC INT 3 Give Break Point.

Steps required for running the program:

1. 2.

Enter the program from 0000: 0200 location. Set up the data in memory location 300 and 304. N1 N2 0300 0304 : : 09 04 00 00 00 00 00 00

3.

Run the program by GO Command and see the result as follows: N3 0308 : 0A 00 00 00

Nvis Technologies Pvt. Ltd.

63

NV5586A Problem: Write a program to calculate Sin (z) where Z - is defined in degrees. Solution: Sin (z) is calculated using tangent function of 8087. tan (Z/2) then Sin (z) = = Y/X
2XY X+Y

The FPTAN instruction has to be given data in radians. The value of degrees is to be converted in radian. On execution of FPTAN the result is return in Y/X format where X is written on top of stack and Y is the next to top of stack. Further the argument must satisfy 0< argument < P1/4. This is the reason we restrict Z to satisfy 0< Z < 90. This restriction can be eliminated, by more computation. If Z is unrestricted, then the use of FPREM function of 8087 to reduce the argument to the required range and use the relation Sin (P1 + Z) = -Sin z The above problem is solved by calculating Z/2, then converting the degrees into radians and then calculating the tangents. The resulting values of X and Y are used for calculating Sin (Z). The following steps are required to implement this program.

1. Calculating the Z/2 2. Calculate the angle in radians. 3. Calculate tan (Z/2) = X/Y format. 4. Calculate Sin Z =
2XY X2 + Y2

5. Get the integer value argument - 4.


Add. Opcode
Step-1 0200 B4 00 0202 D1 E8 0204 A3 00 03 0207 DF 06 00 03 Step-2 020B C7 06 02 03

Mnemonic
MOV AH, 00 SHR AX, 01 MOV, W ARGI,AX FILD ARGI

Comments
Clear AH Z = Z/2. Load AX in Arg.1 Loading Z\2 on TOS

MOVWARG 2,00B4 ARG 2 I is loaded with B4 i.e. 180 value in hex. Insert F Wait and load AR G2. Wait and divide ST (O) = z/180. ST (O) = PI ST (O) = PI X Z/180

020F B4 00 0211 9B DF 06 02 03 FILD ARG 2 0216 9B DE F9 0219 9B D9 EB 021C 9B DE C9 FDIVRP FILDP FMULRP

Total Angle In Radians


Step-3 021F 9B D9 F2 0222 Step-4 0225 0228 022B 022E 9B D9 F0 FTAN FILD ST(O) Calculate tan Z/2 as Y/X. Duplicate X on top of stack. ST (O) =X * X ST (O) = Y. ST (O) = Y * Y YXY is popped of and top of stack

9B D8 C9 9B D9 C2 9B D8 CB 9B DE C1

FMUL ST,ST(1) FILD ST (2) FMUL ST (O),ST 3 FADDP ST (1),ST(O)

Nvis Technologies Pvt. Ltd.

64

NV5586A
0231 0234 0237 023A 9B DE F9 9B DE C9 9B D9 C0 9B DE C1 FDIVRP FMULRP FLD ST (O) FADDP ST(I),ST(O)
ST(O) = X2 + Y2. ST (O) = x/x2 + Y2 ST (O) = XY/X2+Y2

Duplicate the top of stack. ST(O)= 2XY/ (X2+Y2) =Sing(Z). Load ARG3 with 10 2710,000 value FILD ARG 3 ST (0)=10,000* SIN(Z) Round the integer. Store it in BCD form. The result is stored at 0306 and Ax. Go to monitor. Go to monitor.

Step-5 023D C7 06 04 03

MOV,W ARG E 2710H

0243 0248 024B 024E 0253 0254

9B DF 06 04 03 9B DE C9 FMURP 9B D9 FC FRND INT 9B DF 36 06 03 FSTP ARG4 9B A1 06 03 FWAIT MOV,AX,ARG4

0257

CC

CC

In the addition to above, the stack operation on each instruction execution is shown. This will help to understand the program in details. This way of writing will help user to gain confidence in writing the program for 8087. Steps required implementing the program:

1. 2. 3. 4. 5.

Enter the above program. Do not use any memory location from 0300 to 0308 as they are required for implementing the program. Enter the value of angle in AL, say for calculating Sin 30, the AL should be 1EH. Execute the program and observe the value in AX, the result will be AX=5000H. The output in packed BCD form is available in the register AX. A decimal point is to be assumed before the first BCD digit. Execute the program for various values of Sin Z Input (AL) 10 2E 3C 56 Output Sin Z (AX) 2756 7193 8660 9976 Sin 16 Sin 46 Sin 60 Sin 86

The stack operation on execution of each instruction.

1.

FLDI ARGI ST (0)

->

ARGI z ARG 180 ARGI Z Z/180

2.

FILD ARG2 ST (0) ST (1) FDIVRP ST (0) FLDPI

--- --

3. 4.

Nvis Technologies Pvt. Ltd.

65

NV5586A ST (0) ST (1) --> PI Z/180 PI * Z/180 Z/180 X Y Z/180 X X Y Z/180 X2 X Y Z/180 Y X2 X Y Z/180 X2 X2 X Y Z/180 X2 + Y2 X Y Z/180 X/X2 + Y2 Y Z/180 XY/X2 + Y2 Z/180 XY/X2 + Y2 66

5.

FMULRP ST (0) ST (1) FPTAN ST (0) ST (1) ST (2) FLX ST (0) ST (0) ST (1) ST (2) ST (3)

--

6.

--

7.

8.

FMUL ST (0), ST (1) ST (0) ST (1) ST (2) ST (3) FLD ST (2) ST (0) ST (1) ST (2) ST (3) ST (4) FLD ST (0), ST (3) ST (0) ST (1) ST (2) ST (3) ST (4) FADDP ST (1) ST (0) ST (0) ST (1) ST (2) ST (3) FDIVRP ST (0) ST (1) ST (2) FMULRP ST (0) ST (1) FLD ST (0) ST (0)

9.

10.

11.

12.

13.

14.

Nvis Technologies Pvt. Ltd.

NV5586A ST (1) ST (2) XY/X2 + Y2 Z/180

15.

FADD P ST (1), ST (0) ST (0) 2XY/X2 + Y2 ST (0) =SIN (Z) FLDI ARG 3 ST (0) ST (1) FMUR P ST (0) FRNDINT ST (0) 10,000 SIN(Z) 10,000 X SIN Z Rounding the integer

16.

17.

18. 19.

FSTP AR G 4 The argument has the result.

Program 20: This is a sample program for Port A,B,C of 8255-I generating square wave output at Connector 8255-I.

Address
0400 B0 80 0402 E6 76

Code

LABEL
MOV AL,80H OUT 66H,AL MOV AL,55H

Mnemonic
;INIT 8255 CWR ;PA,PB,PC AS OUTPUT PORT ;MOVE ACC DATA 55H ;OUT AT PA ; OUT AT PB ;OUT AT PB ;Move Acc data AAH ;OUT AT PA ; OUT AT PB ;OUT AT PB

Comments

0404 B0 55 Start: 0406 0408 040A 040C 040F 0411 0413 0415 0417 041A 041C 041F 0420 0422 E6 70 E6 72 E6 74 E8 0D 00 B0 AA

OUT 60H,AL OUT 62H,AL OUT 64H,AL CALLDELAY1 MOV AL,0AAH

E6 70 OUT 60H,AL E6 72 OUT 62H,AL E6 74 OUT 64H,AL E8 02 00 CALLDELAY1 EB E8 JMP START ;JUMP TO START B9 0000Delay1:MOV CX,0FFFFH ;DELAY ROUTINE 49 DL1: DEC CX 75 FD JNE DL1 C3 RET

Nvis Technologies Pvt. Ltd.

67

NV5586A

On-Board Interface
ADC-0809 (Analog Input): NV5586A provides an onboard interface for ADC 0809 chip which allows the user to have 8 analog input channels, namely A0 to A7. These input points are brought out at the block Channels. ADC0809 is an 8 bit A/D chip designed here to provide an input level of 0 to 5 volts. The procedure to be followed for using ADC 0809 is as follows:

1. ADC0809 is internally interfaced with 8255-I so port address for 8255-I should be followed for
communicating with ADC chip.

2. Select ADC with the help of Rotary provided on Trainer 3. Select channel by outputting the code 00 to 07 at Port address 01. 4. Send a SOC and ALE (Start of conversion by outputting 00,03 at Port address 02). 5. Input from Port address 02 to check for EOC (end of conversion) at D0. 6. Read the ADC 0809 by inputting from Port address 00.
These addresses are given in I/O MAPPING details. After executing the below program, it displays all 8 channels in the LCD screen. The input for 8 Channel ADC are provided on trainer A0 to A7. Program: The following program reads the Input voltage from A0 to A7 i.e.Channel-1 to Channel-8 and displays the same on the LCD screen. Port A Port B Port C 70H 72H 74H

Control Word 76H Put this program directly on any Text Editor and give Extension as .ASM and compile with MASM Assembler CODE SEGMENT ASSUME CS: CODE, DS: CODE PROG PROC FAR
ORG 0400H MOV AL,98H OUT 76H,AL; ;INTIALISE 8255 ;PA & PC Upper as Input & PB & PC Lower as Output

CH1:

MOV AL,00H CALL ATD

CH2:

CH3:

CH4:

;Select Channel A0 ;Send SOC and ALE Pulse and Check for EOC CALL CLEAR ;Clear LCD MOV BL,80H ;SELECT LCD LOCATION CALL ATDAT ;Send Data to LCD MOV AL,01H ;Select Channel A1 CALL ATD MOV BL,085H ;SELECT LCD LOCATION CALL ATDAT MOV AL,02H ;Select Channel A2 CALL ATD MOV BL,8AH ;SELECT LCD LOCATION CALL ATDAT MOV AL,03H ;Select Channel A3 CALL ATD

Nvis Technologies Pvt. Ltd.

68

NV5586A
MOV BL,8FH CALL ATDAT CH5: MOV AL,04H CALL ATD MOV BL,0C0H CALL ATDAT CH6: MOV AL,05H CALL ATD MOV BL,0C5H CALL ATDAT CH7: MOV AL,06H CALL ATD MOV BL,0CAH CALL ATDAT CH8: MOV AL,07H CALL ATD MOV BL,0CFH CALL ATDAT JMP CH1 PROG ENDP ATD: OUT 72H,AL MOV AL,00H OUT 74H,AL MOV AL,03H OUT 74H,AL MOV AL,00H OUT 74H,AL EOC1: IN AL,74H AND AL,10H JZ EOC1 MOV AL,04H OUT 74H,AL IN AL,70H ;SELECT LCD LOCATION ;Select Channel A4 ;SELECT LCD LOCATION ;Select Channel A5 ;SELECT LCD LOCATION ;Select Channel A6 ;SELECT LCD LOCATION ;Select Channel A7 ;SELECT LCD LOCATION

;OUT AT PORT-B ;GIVE SOC & ALE PULSE AS 0 ;OUT AT PORT-C ;GIVE SOC & ALE PULSE AS 1 ;OUT AT PORT-C ;GIVE SOC & ALE PULSE AS 0 ;OUT AT PORT-C ;READ EOC FROM PORT-C ;CHECK EOC AT PC4 BIT ;JUMP TILL EOC=1 ;GIVE OUTPUT ENABLE AS 1 ;OUT AT PORT-C ;READ 8 BIT ADC DATA FROM PORT-A

CLEAR:

RET DB 9AH,7CH, 0F0H,00H,0F0H ;CALL 0F000:F07C clear LCD Screen RET

ATDAT:MOVAH,00H ;Put 00 in AH DB 9AH,94H, 0F0H,00H,0F0H ;CALL DISPLAY ROUTINE CALL F000:F094 MOV CX,0555H ;Give some time LP1: DEC CX JNZ LP1 RET CODE ENDS END

DAC-0800 (Analog Output): A D/A converter chip DAC 0800 has been provided on the board of NV5585A to enable the user to have analog output. This can be used for generating various waveforms or for any closed loop applications. The chip has been interfaced with 8255-I internally and has an address of (00 to 04). This chip has been designed to give an output of 0 to 8 Volts. The output of DAC 0800 is coming at Xout and Yout terminal. After executing the below program RAMP OUTPUT is displayed in the CRO.

Nvis Technologies Pvt. Ltd.

69

NV5586A Program: The following program will generate a Ramp (a triangular waveform) output at Xout and Yout. PROGRAM TO GIVE RAMP OUTPUT AT X-OUT & Y-OUT Add. Opcodes
0400 B0 80 0402 BA FE FF 0405 EE 0406 B0 00

Mnemonics
MOV AL,80H MOV DX,0FFFEH OUT DX,AL MOV AL,0H

Comments

;INTIALISE 8255
;PA & PB AS OUTPUT ;SELECT A AS DATA 00

0408 BA F8 FF START: MOV DX,0FFF8H 040B EE 040C BA FA FF 040F EE 0410 FE C0 0412 EB F4 OUT DX,AL MOV DX,0FFFAH OUT DX,AL INC AL JMP START ;OUT AT Y-OUT ;INCREMENT A ;JUMP TO START ;OUT AT X-OUT

Program: The following program will generate a Sine wave output at Xout and Yout. For finding Sine wave Angles Value=(5+(5* sin)) * 25.6 Where = 0 360 Here Samples are for 10 degree Add. Code
0400 B0 80 0402 E6 76

Labels

Mnemonics

Comments

MOV AL,80H ; using Port A, B for output OUT 76H,AL ; setting CW

0404 BE 1604 Loop2: MOV SI,0416H ; place samples in memory 0407 B1 24 MOV CL,24H 0409 8A 04 Loop1: MOV AL,[SI] ; Get whatever is at 0416 040B E6 70 OUT 70H,AL ; Output DAC 1, Port A, 040D E6 72 OUT 72H,AL 040F 46 INC SI ; Increase memory location 0410 FE C9 DEC CL ; Decrement Counter 0412 75 F5 JNE LOOP1 0414 EB EE JMP LOOP2 ; keep on doing this

Put this data manually using D command at address 0000:0416 0416 80, 96, AC, C0, D2 , E2, EE, F8, FE, FF, FE, F8, EE, E2, D2, C0, AC, 96, 80 69, 54, 40, 2D, 1E, 11, 07, 02, 00, 02, 07, 11, 1E, 2D, 40, 54, 69, 80

Nvis Technologies Pvt. Ltd.

70

NV5586A

Parallel Commutation between two NV5586A Trainers using 8255 in i/o mode Note-: Power on the supply of both trainers before connecting the 26 Pin FRC cable Connect the 8255-1 of both trainers using 26 FRC cable For transmit data fill the program given below in trainer Memory Address 400 402 404 406 408 Opcode B0 82 E6 76 B0 99 E6 70 9A 7C F000 F0 B4 00 B3 80 9A 94 F000 F0 E0 EB FF Mnemonics MOV AL,82 OUT 76,AL MOV AL,99 OUT 70,AL CALL F000: F07C MOV AH,00 MOV BL ,80 CALL F000:F094 JMP 404 Comments

Data to transfer Send data to 8255-1 Call the display function

40D 40F 411 416

Jump to 404 location

For receiver fill the program given below in second trainer Memory Address 400 402 404 406 40B 40D 40F 414 Opcode B0 82 E6 76 E4 70 9A 7C F000 F0 B4 00 B3 00 9A 94 F000 F0 E9 ED FF Menemonic MOV AL,82 OUT 76,AL IN AL,70 CALL F000:F07C MOV AH, 00 MOV BL, 00 CALL F000:F094 JMP 404 Comments Set 8255-1 for i/o Read the port

Jump to location 404

When both program entered then data entered at transmit trainer is displayed on receiving trainer. For above programs 99 are displayed on receiving trainer LCD.

Nvis Technologies Pvt. Ltd.

71

NV5586A

Serial Commutation between two NV5586A Trainers For serial commutation between the two trainers connect the male to male RS232 cable provided with NV5586A trainers. And follow the procedure given below
1. On NV5586A, execute from F000:F003 using G command as follows:

2. Press Enter key and the following will come on the display:

For serial commutation one trainer transmits data and other receives the data: Procedure for transmitter trainer:
1. For transmit data press F7 on trainer keyboard to come in the OUT mode.

2. 1st location indicates the starting address (F000:0400) and the 2nd location indicates the end

address (0400) of the memory area to be transmitted on to the Serial Port. Change this to 0000:0400 to 04FF as follows:

Then press the enter to transmit data Procedure for receiver trainer: 1. On NV5586A, execute from F000:F003 using G command as follows:

2. Press Enter key and the following will come on the display:

Change the location from F000:0400 to 0000:0400. This is the 1st RAM location data will be received from the transmitter trainer and this address will keep on incrementing on receipt of each Data Byte.

3. Press enter button on trainer button & then press the enter button on transmitter trainer Note: Please short the jumper JP4 of both trainer on pin 1 & 2 for clock settings.

Nvis Technologies Pvt. Ltd.

72

NV5586A

Connector/Jumper Detail
The details of the various connectors on the board of NV5586A are as follows: Bus Connector 50 Pin: Pin Signal Pin 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 Signal A10 A1 A9 IOWR IORD S2 S2 MEMWR MEMRD ALE ALE S1 S0 HLDA HOLD INTA INTR READY NMI RESET OUT RESET IN CLK OUT I/O-CS MEM-CS MEM-CS 1 +5V 2 +5V 3 GND 4 GND 5 AD3 6 AD7 7 AD2 8 AD6 9 AD1 10 AD5 11 AD0 12 AD4 13 A8 14 A16 15 A7 16 A15 17 A6 18 A14 19 A5 20 A13 21 A4 22 A12 23 A3 24 A11 25 A2 RS-232C Serial Connector: Pin Signal 1 NC 2 Rxd 3 Txd 4 DTR 5 GND 6 DSR 7 RTS 8 CTS 9 NC Power Supply Connector Left and Right side: Pin 1 2 3 4 Signal +5V GND +12V -12V

Nvis Technologies Pvt. Ltd.

73

NV5586A 8255-II Connector: Pin Signal 1 2 3 4 5 6 7 8 9 10 11 12 13 8255-I Connector: Pin 1 2 3 4 5 6 7 8 9 10 11 12 13 8255-III Connector: Pin 1 2 3 4 5 6 7 8 9 10 11 12 13 Signal P3C4 P3C5 P3C2 P3C3 P3C0 P3C1 P3B6 P3B7 P3B4 P3B5 P3B2 P3B3 P3B0 14 15 16 17 18 19 20 21 22 23 24 25 26 P3B1 P3A6 P3A7 P3A4 P3A5 P3A2 P3A3 P3A0 P3A1 P3C6 P3C7 GND +5V(VCC) P2C4 P2C5 P2C2 P2C3 P2C0 P2C1 P2B6 P2B7 P2B4 P2B5 P2B2 P2B3 P2B0 Signal P1C4 P1C5 P1C2 P1C3 P1C0 P1C1 P1B6 P1B7 P1B4 P1B5 P1B2 P1B3 P1B0

Pin 14 15 16 17 18 19 20 21 22 23 24 25 26 14 15 16 17 18 19 20 21 22 23 24 25 26

Signal P2B1 P2A6 P2A7 P2A4 P2A5 P2A2 P2A3 P2A0 P2A1 P2C6 P2C7 GND +5V (VCC) P1B1 P1A6 P1A7 P1A4 P1A5 P1A2 P1A3 P1A0 P1A1 P1C6 P1C7 GND +5V (VCC)

Nvis Technologies Pvt. Ltd.

74

NV5586A 8259/8253 Connector: Pin 1 2 3 4 5 6 7 8 9 10 Mode Selection Rotary: Signal IR0 IR1 IR2 IR3 IR4 IR5 IR6 IR7 CLK0 OUT0 11 12 13 14 15 16 17 18 19 20 GATE0 OUT1 GATE1 CLK1 GATE2 OUT2 CLK2 NC GND +5V (VCC)

Normal : NV5586A works in Normal Mode ADC : NV5586A works with inbuilt ADC support DAC : NV5586A works with inbuilt DAC support POT P1: Variable input for Channel 0 of inbuilt ADC when Jumper JP3 pin 2 & 3 is shorted ADC CHANNELS: Input channels A0 to A7 for inbuilt ADC DAC Output: 2 Output channels of inbuilt DAC RST: To Reset system.

Nvis Technologies Pvt. Ltd.

75

NV5586A

Jumper/Dip Switch Details

Short 1 & 2 for default RAM Factory setting: Short 1 & 2

Short 1 & 2 for +5V to RAM Short 2 & 3 for Battery Supply to RAM Factory setting: Short 1 & 2

Short 1 & 2 for External ADC Input at Channel 0 Short 2 & 3 for Internal ADC Input at Channel 0 from POT P1 Factory setting: Short 2 & 3

Short 1 & 2 for 2 MHz Clock to 8086 CPU Short 2 & 3 for 1 MHz Clock to 8086 CPU Factory setting: Short 2 & 3

Reserved for Future SW1: OFF- All switches from 1-4 by default When running External 8259 Interrupt Controller please modify switch positions as defined 1. ON 2. OFF 3. OFF 4. OFF

Nvis Technologies Pvt. Ltd.

76

NV5586A

Block Diagram

Nvis Technologies Pvt. Ltd.

77

NV5586A

Warranty
1. 2. We guarantee the instrument against all manufacturing defects during 24 months from the date of sale by us or through our dealers. The guarantee covers manufacturing defects in respect of indigenous components and material limited to the warranty extended to us by the original manufacturer, and defect will be rectified as far as lies within our control. The guarantee does not cover perishable item like cathode ray tubes, crystals, batteries, photocells etc. other imported components. The guarantee will become INVALID. a) b) c) d) 5. If the instrument is not operated as per instruction given in the learning material. If the agreed payment terms and other conditions of sale are not followed. If the customer resells the instrument to another party. Provided no attempt have been made to service and modify the instrument.

3. 4.

The non-working of the instrument is to be communicated to us immediately giving full details of the complaints and defects noticed specifically mentioning the type and sr. no. of the instrument, date of purchase etc. The repair work will be carried out, provided the instrument is dispatched securely packed and insured with the railways. To and fro charges will be to the account of the customer.

6.

Nvis Technologies Pvt. Ltd.

78

NV5586A

List of Service Center Baroda Flat No. A/1, Mudra Complex, Behind Sudha Hotel, Ellora Park, Baroda-390023 (Gujarat) Tel: +91-0265-3089505 Fax : +91- 0265-3089506 email : baroda@scientech.bz New Delhi First Floor, C-19, F.I.E., Patparganj Industrial Area, Delhi-110092 (INDIA) Ph: 011- 22157370, 22157371, Fax: +91-011-22157369 email: ndel@scientech.bz Mumbai E Type, Bldg No. 5/1/3, Sector 1,Vashi, Navi Mumbai-400703 Ph: +91-022-27826616, 65266616 email: mumbai@scientech.bz Hyderabad Plot No. 24, Flat no. 203, Laxmi Residency, Chandragiri Housing Society, Trimulgherry Secunderabad- 500015. Ph:040-27740147,9247712763 email: hyd@scientech.bz Pune 105/106, 1st floor, Ajinkyatara, Ganesh Mala, Sinhgad Road, Pune - 411030 Ph.: +91-020-24254244/55 Fax: +91-020-24254244 email: pune@scientech.bz Guwahati Avijit Roy Building, A.K. Dev Road, Fatashil Ambari, Near jalaram Mandir, Guwahati-25 Assam Mobile: 09435144068 email: guwahati@scientech.bz Bangalore 202/19, 4th Main Street, Ganganagar, Bangalore - 560032 Ph.: +91-080-41285011 T.Fax: +91-080-41285022 email: bangalore@scientech.bz Jaipur Flat No. G-2, S-101, Bhagat Vatika North, Civil Lines, Jaipur - 302006 (Raj.) Mobile: 097998-10236 email: jaipur@scientech.bz Cochin/Kochi C/o Pragalbha Valsan, Poriyamadathil house, ABMS Lane, Asoka Road, Near Mathrubhumi, Kaloor, Kochi - 682 017 Ph: 0484-2409441 email: kochi@scientech.bz Chennai Flat C, 1st Floor, Old No. 49 New No. 64, Bajanai Koil Street, Sriram Nagar Extention, Pallipattu, Chennai-600113 Tel: 044-43514212, 43514213 email: chennai@scientech.bz Indore 94, Electronic Complex, Pardesipura, Indore-452 010 Tel: 91-731-2570301/02, 4211100, Fax: 91-731-2555643 E-mail: info@scientech.bz Kolkata AC-101, Prafullla Kanan, Near Kestopur Bus Stop, Krishnapur, Kolkata- 700059 (West Bengal) Tel: +91 33-65266800 Mob: 9433029888 email: kolkata@scientech.bz Lucknow First Floor, 279/54/20/A, Chuhar Singh Colony, Pan . Dariba, Lucknow (U.P.) Mobile: 09918670737 email: lucknow@scientech.bz Chandigarh 201, 2nd floor KMB HospItality Services, SCO 19, Near Kabir Petrol Pump, AmbalaZirakpur Highway Zirakpur, Mohali - 140603 Ph.: 0172-6530329 email: chandigarh@scientech.bz Orissa Plot No-67 (1st Floor) A erodrom Area,Vimpur mouza Near Vimpur Primary School Bhubaneswar- 751020 Mobile: 09238307873 email: orissa@scientech.bz

Nvis Technologies Pvt. Ltd.

79

NV5586A

List of Accessories 1. Learning Material 2. 26 Pin FRC Cable 3. 50 Pin FRC Cable 4. RS232 Cable 5. SMPS Supply 6. Mains Cord 6. Jumpers 7. Phoenix Connector 8. Keyboard 9. Keyboard Adaptor 10. 20 Pin FRC Cable 1No. 3 Nos. 1 No. 1 No. 1 No. 1 No. 4 Nos. 1 No. 1 No. 1 No 1 No

Nvis Technologies Pvt. Ltd.

80

You might also like