• No results found

8086 Lab Manual

N/A
N/A
Protected

Academic year: 2021

Share "8086 Lab Manual"

Copied!
154
0
0

Loading.... (view fulltext now)

Full text

(1)

8086

Microprocessor

Laboratory Experiments Manual

Using MicroTalk-8086 and MDA-8086 Trainers

MicroTalk-8086 ( Bangladesh ) MDA-8086 ( Korea )

Golam Mostafa

(2)

Preface

Dear Readers,

First of all, you must say that you wish to learn ‘things’. And only then, we may tell you something like: “Look for the things that work and play with them”. This is one of the proven methods of ‘Self Learning’.

This book is prepared for those who are willing to learn things by doing themselves. Take an experiment and “follow” every step. Be patient and keep waiting until you are rewarded with a result.

Now, you have an experiment, which works. Repeatedly study and practice every step of the experiment. You will soon discover the reason for having a particular step included in the experiment. Try to build the experiment in your own way. Execute the program and monitor the result.

Good Luck!

Golam Mostafa

Segun Bagicha, Dhaka 6/1/2009

(3)

Contents

Experiment – 1A Familiarization with the Components Organization and the Operating

Procedures of the MicroTalk-8086 Trainer 1/Expt-1A

Experiment – 1B Familiarization with the Organization and the Operating Procedures of the

MDA-8086 Trainer 1/Expt-1B.

Experiment – 2 Familiarization with the Assembly Instructions of 8086 Microprocessors by

Adding Two 8-bit Unsigned Hexadecimal Numbers. 1/Expt-2

Experiment – 3 Familiarization with the Assembly Instructions of 8086 Microprocessors by

Multiplying Two 8-bit Hex Numbers by Repetitive Additions. 1/Expt-3

Experiment – 4 Familiarization with the Procedures of Programming the 8255 Parallel IO

Controller. 1/Expt-4

Experiment – 5A Familiarization with the Procedures of Interfacing a Text Mode LCD Panel

with MicroTalk-8086 Trainer. 1/Expt-5A

Experiment – 5B Familiarization with the Procedures of Programming the Text Mode LCD

Panel of the MDA-8086 Trainer. 1/Expt-

Experiment – 6A Familiarization with the Functionality Check of the NMI-interrupt of 8086

using MicroTalk-8086 Trainer. 1/Expt-6A

Experiment – 6B Familiarization with the Functionality Check of the NMI-interrupt of 8086

using MDA-8086 Trainer. 1/Expt-6B

Experiment – 7 Task-7.1 [BCD-to-BINary]

Conversion of 2-digit BCD Number (range: 00 – 99) into Equivalent BINary Number by Counting Method. 1/Expt-7

(4)

ii

Experiment – 8 Task-8.1 [BINary-to-BCD]

Conversion of Tw-digit BINary Number (range: 00h – 63h) into BCD Number by Counting Method. 1/Expt-8

Task-8.2 [BINary-to-BCD]

Conversion of n-bit BINary Number into equivalent BCD Number by Horner Method (Fast Method) 2/Expt-8

Experiment – 9 [BINary Multiplication] Multiplication of two 16-bit unsigned BINary

Numbers 1/Expt-9

Experiment – 10A Familiarization with the Procedures of Converting MicroTalk-8086 Trainer

into a Digital Weighing Machine 1/Expt-10A

Experiment – 10B Familiarization with the Procedures of Converting MDA-8086 Trainer into a

Digital Weighing Machine 1/Expt-10B

Experiment – 11A Study of the Asynchronous Serial Communication Link Between IBMPC and

MicroTalk-8086 Trainer. 1/Expt-11A

Experiment – 11B Study of the Asynchronous Serial Communication Link Between IBMPC and

MDA-8086 Trainer. 1/Expt-11B

Experiment – 12 Programming of the 8279-Based Display Unit of the MicroTalk-8086 Learning

System. 1/Expt-12

Experiment – 13A Programming of the 8279-Based Keyboard Unit of the MicroTalk-8086

Learning System. 1/Expt-13A

Experiment – 13B Programming the Discrete Components-Based Keyboard Unit of the

MDA-8086 Learning System. 1/Expt-13B

(5)

Experiment – 8

Converting BINary Number into Equivalent BCD

Read Every Step of a Task and then Work accordingly. Whenever, a Step is Done, put Tick Mark (

) on that Step using a Wood Pencil. Ask Teacher for Help when necessary.

Task-8.1

Converting Two-digit BINary number (range: 00h – 63h) into equivalent BCD number (range: 00 – 99) using Counting Method (Slow Process).

1. Draw Input/Out Data Structure. Keep Input BIN at location 03010h and the Output BCD at

location 04010h.

2. Convert the following conversion Pseudo Codes into 8086 ASM codes and save as:

bin2bcdc..asm.

MYCODE SEGMENT

ASSUME cs:MYCODE

ORG 1000h

START: nop

L1: Bring BINary ah-register from location 03010h mov al, 00h ; IPBCD

L2: add al, 01h

If ((al3 – al0) > 9)

Goto L6

L3: dec ah

jnz L2

L4: mov BYTE PTR [bx+1010h], al ; BCD result at location: 04010h

L5: hlt

L6: add al, 06h

jmp L3

MYCODE ENDS

END START

4. Assemble the above program and down load it. 5. Enter the input BINary number as: 25h

6. Execute the program:

7. Open memory location 04010h and we must see 37 (the desired BCD number).

8. Enter different values for the input Binary and check that the program produces correct BCD

(6)

Task-8.2

Converting 4-digit BINary number (range: (0000h – FFFFh) into equivalent BCD number (range: 0000h – 065535) using Horner Method (Fast Process).

1. Review the following Horner Rule foe conversion.

BIN = b15b14, ………., b1b0

= b15x215 + b14 x 214 +, ……….., +b1 x 21 + b0 x20

= (……….(b15)2 + b14) 2 +, ………, + b1 ) 2 + b0

BCD = (……….(b15)2 + b14) 2 +, ………., + b1 ) 2 + b0

= (……….(IPBCD x 2 + b15) 2 + b14) 2 +,………..+ b1 ) 2 + b0

where: IPBCD = Initial Partial BCD = 000000

2. Computation Philosophy

a. Extract b15 and compute: (IPBCD x 2 + b15) → IPBCD

b. Carry out Step-a, for all the bits of the input BINary number. 3. Draw DSM-based Data Structure for the Input/Output numbers.

3. Draw the following Register-based Data Structure for the Input/Output Numbers.

bl bh Cl, bh, bl = IPBCD 0 15 si = BIN 538 cl 0 23 (Six BCD Digits)

4. Convert the following Pseudo Codes into ASM codes. Save as: bcd2binh.asm. Download

and execute it. The DSM locations: 04011h and 04010h would contain the Binary number.

L1: 000000 → cl, bh, bl (IPBCD)

mov si, WORD PTR [di+10h] ; getting the input BINary from DSM mov ah, 10h ; number of bits in the input Binary number L2: ; Extrcat b15

rcl si, 01h ; b15 is in C-bit

call BCDC ; BCD Computation

L3: dec ah

Jnz L2 ; extract next bit (b14, …….b0)

L4: mov BYTE PTR [di+1012h], cl

Mov WORD PTR [di+1010h], bx ; BCD at locations: 04012, 04011, 04010

L5: hlt BCDC: mov al, bl adc al, al daa mov bl, al mov al, bh adc al, al daa mov bh, al mov al, cl adc al, al daa mov cl, al ret

2/Expt-8

(7)
(8)

Experiment – 1B

Familiarization with Components Organization and the Operating

Procedures of the MDA-8086 Microprocessor Learning System

Read Every Step of a Task and then Work accordingly. Whenever, a Step is Done, put Tick Mark (

) on that Step using a Wood Pencil. Ask Teacher for Help when necessary.

Task-1B.1 Familiarization with the Components Layout

In this task you will be locating and getting familiar with the following functional units of the MDA-8086 trainer. These units are considered as the Building Blocks of a microprocessor based system. The MDA-8086 is an 8086 microprocessor learning system made in Korea.

i. 8086 Microprocessor

ii. RAM (Random Access Read and Write Memory)

iii. EPROM (Ultraviolet Erasable and Electrically Programmable Random Access Read Only Memory)

iv. Input Device (The Keyboard)

v. Keyboard Interface Controller (not visible) vi. Output Devices:

a. Liquid Crystal Display Unit (LCD)

b. Common Anode Type 7-Segment Display Device (CA7SDD) c. Light Emitting Diodes (LED11-LED14)

d. 8x8 Bicolor Dot Matrix LED [DOTLED]. Each dot contains Red and Green LEDs. vii. Output Device Interface Controllers (not visible)

viii. Primary Memory Decoder (not visible) ix. Primary Port Decoder (not visible)

Procedures:

1. Collect the MDA-8086 trainer from the lab attendant. 2. Open the top cover of the trainer.

3. Look at the PCB (Printed Circuit Board) of the trainer and the component layout of Fig-1B.8. 4. Now, on the PCB, locate the circuit designation U1. This is the 8086 microprocessor chip. 5. Look very carefully on the top of the U1-chip and you will find the inscription ‘8086’.

6. Locate the keyboard on the trainer. The keyboard interface circuitry is there but is not

obvious.

7. Locate the following output devices on the PCB of the trainer.

a. The LCD unit. The interface controller of the LCD device is built-in within the LCD panel. b. The 7-segment display device, which has the circuit designation – FND in Fig-1B.8. This is

a common-anode type display device. Let us agree to call it by the symbolic name CA7SD

(Common Anode 7-Segment Display Device). A CA-type display device is opposite to

CC-type display device. The interface controller for this device is the chip, U29 (8255).

c. The LED assembly, LED11-LED13. The interface controller for these LEDs is the chip, U29. 8. Locate the RAM chips U9, U10 on the PCB. Bit capacity of each RAM is: 32x1024x8.

9. Locate the EPROM chips U7 and U8 on the PCB. These chips contain the Monitor Program of

the MDA-8086 trainer. Bit capacity of each EPROM is: 32x1024x8.

(9)

Task-1.2 Familiarization with the Hardware Block Diagram of MDA-8086 : AD 0 1 2 3 4 5 6 7 8 9 A B C D E F - DA + REG G0STP NMI RES 546 CS/ D15-D8 D7-D0 DR:01h

KBIC : 74244 :U24 CPU : 8086 : U1

CS/ D7-D0 D7-D0 LCDIC 9600 Bd RS : 01h IR SR DR 16 Characters x 2 Lines LCD CR:1Eh PA:18h 0V PB:1Ah PC:1Ch D7-D0 D7-D0 PIO: 8255:U30 8x8 Common Cathode Type Bi-color LED Array CS/ +5V Vin MIC TH1 DIP2 DAC:U33 CR:18h DR:18h VR 2 ADC: 0804: U31 CS/ D7-D0 D7-D0 P6 Speaker D CS/ Out SPKIC: U25 DR: 11h D7-D0 D7-D0 CS/

SIO: 8251:U14 TTL <----> RS232 : U15 TTL TxRS TxTTL RxRS TTL RxTTL CON: DB9 SR: 0Ah CR: 0Ah DR: 08h 9600 Bd CS/ PUT: U41 :8253 D15-D7-D0 TC-1:0Bh TC-0:09h TC-2:0Dh CR:0Fh D8 CON10

Users Interface Controller 20h, 22h,CS/ 24h, 26h D7-D0 D15-D8 EVN: ROM:U7 F0000, ... FFFFE ODD: ROM:U8 F0001,... ,FFFFF

Mem/Port Decoder : U16

CS/ CS/ D7-D0 D7-D0 Sx/ A,M-IO/,BHE/ D15-D7- D7-D0 CS/ CS/ D7-D0

CS/ ODD: RAM : U10

00001, ... 0FFFF EVN : RAM : U9 00000,... 0FFFE D8 D0 D7-D0 D7-D0 CR:10h DR:12h IR7 CK0 IR6 IR5 IR4 IR3 IR2 (41h)IR1 (40h)IR0 CK1 CK2 Sy/ PCLK: 2.4576MHz +5V GT0 OT0 TxC,RxC CLK for 9600 Bd GT1 GATE1 0V OT1 0V GATE2 GT2 OT2 +5V IR2 IPC U42 8259 27256 27256 62256 62256 INT IN INTA/ IN

There are many more interface controllers on the PCB of the MDA-8086, which we could not describe in Task-1B.1. The following Hardware Block Diagram of Fig-1B.1 contains the total IO scenario of the trainer. For complete circuit diagram, consult user manual for MDA-8086 trainer.

TR TA / NMI +5V NMI 0V D8 CR:1Fh PCR:1Dh PBR:1Bh PAR:19h CA7SD PB0-PB3 LED11-LED14

Step. Motor Int.PB4-PB7 DACU33 LM:U38 ADC:U31 P8 CS/ D D15-D8 PIO:8255 U29 RxRDY 0V 0V TxRDY

(10)

Task-1B.3 Getting Familiar with Keyboard Layout of MDA-8086 Trainer

3/Expt-1B

Figure-1B.2: keyboard Layout of MDA-8086 Learning System

: AD 0 1 2 3 4 5 6 7 8 9 A B C D E F - DA + REG G0 STP MON RES 546

The 26 keys of the keypad may be classified into the following categories:

A: CPU Control Key

1. RES (system RESet) : When this key is pressed down and then released, the 8086 is reset and

starts from the cold state. The PC looks for a valid instruction at memory location: FFFF (CS):0000 (IP) = FFFF0h. Activation of the RES key displays the following message on the LCD monitor. Note that the jumper at P1 must be set to ‘Local Monitor (the left side)’ position.

MDE – 8086 kit ! ! Midas 335-0964/5

2. MON (Monitor) /NMI (Non Maskable Interrupt): When pressed, the CPU is immediately

interrupted

B: Command Keys

1. AD (set memory ADdress) : This command key allows the user to set the 20-bit address of a

memory location in the format of [Segment:Offset]. Press this key and we will see the following message on the LCD with the cursor blinking at the Segment Field.

Seg. Oset data

xxxx yyyy zz

a. ‘Seg.’ stands for ‘Memory Segment’, ‘Oset’ stands for ‘Memory Offset’ and ‘data’ refers to the 8-bit content of the memory location, xxxx:yyyy.

b. Now, we can set the ‘Segment’ part of our desired memory location. Let us assume that we wish to

examine the content of the memory location F000h (F000:0000) of the ROM area of Fig-11.1. We may use the data keys (0 to F) to change the segment into: F000h.

c. Now is the turn to change the ‘Offset’. Press [:] key.

2. : (set the Offset) : This key allows editing the Offset part of a memory location. When this is

pressed, the cursor moves to the Offset Field. And now, the user can use the data keys to set the offset to the desired value.

3. DA (update address and allow Data entry) : This key brings cursor to the Data Field. Now, the

user may use the data key (0 to F) to enter new data (assume that the present memory location is a RAM location).

4. + (increment by One) : This key allows moving to the next memory location. 5. - (decrement by One): This key allows moving in the previous memory location.

6. GO (GO to the beginning point of the program to be executed): This key allows executing a

program.

7. REG (examing and changing REGister contents): This key allows checking and editing the

content of the internal registers of the 8086.

8. STP (Single STep): This key allows executing one instruction at a time. C: Data Keys

(11)

Task-1B.4 Familiarization with the Operation of MDA-8086 Trainer by Blinking Character 3 on the CA7SDD.

Brief Theory: The CA7SDD is connected with the 8086 CPU as per diagram depicted in Fig-1B.3.

03010 03011 B0FF MLoc Content al ah +5V CA a b c d e f g p CA7SD 8255 : U29 Port-A 19h PA7-PA0 CR: 1Fh xxxxx TDELAY D7-D0 D15-D8 PC = CS:IP (1) (1) (2) (3) (3) (4)

RAM: U9, U10 8086 : U1

CS/

548

CA Code for Blank CA Code for 3 Comment 01000 DSM CSM Program Codes

Figure-1B.3: Connection Diagram between CA7SD and the CPU

To show character 3 on CA7SD (output device), we need to send code B0h (1011 0000) into Port-A register of U29. B0h is the 8-bit CA-code for character 3 (see Fig-1.4 for the internal structure of CA7SD). To blank (nothing) the output device, we need to send code FFh into Port-A. After sending B0h, we need to wait for sometimes (Time Delay) so that the character 3 remains visible for a while. Likewise, after sending code for blank, we also need to insert some time delay so that the display remains OFF for sometimes. To blink 3 on the CA7SD, we may follow the steps:

A. Use keyboard and store data B0h (CA-code for 3) at memory location 03010h (0000:3010) of the DSM of Fig-1B.3. Keep data FFh (CA-code for) Blank) at memory location 03011h.

B. Use keyboard and store Program Codes into the memory locations of the CSM of Fig-1B.3. The programs read the data for character 3 from DSM and send it to Port-A register. As a result, 3 appear on CA7SDD. The program inserts time delay. After that the data for blank is sent to Port-A to show nothing on the CA7SDD.

C. Now, let us carry out the following:

1. Power up the MDA-8086 trainer.

2. Carry out the steps of Table-A to enter data into memory locations of DSM.

3. Carry out the steps of Table-B to enter Program Codes into memory locations of CSM.

Table-A

Entry of Common Anode Code for Character 3 and Blank

Sn: Press Key LCD Display Remarks

1 RES MDE8086 Kit V9.5 Midas 935-0964/5

The trainer is ready to accept valid command 2 AD Seg. Oset Data

xxxx yyyy zz

The 20-bit address of an arbitrary memory location is opened in the format of: ‘Segment: Offset’. The present content of the memory location has also appeared in the data field.

(12)

5/Expt-1B

4 : Seg. Oset Data 0000 yyyy _ zz

The cursor has moved to the offset field and is blinking. Use the data keys (0 to F) to set the value of the offset.

5 3 0 1 0 Seg. Oset Data 0000 3010 _ zz

The 20-bit address, 03010 (0000:3010) is entered. Now, deposit the cacode data (B0h) for character ‘3’.

6 DA Seg. Oset Data 0000 3010 zz _

The cursor has moved at the data field. Now, use data keys (0 to 9) to deposit the cacode, B0h at the indicated memory Location. 7 B 0 Seg. Oset Data

0000 3010 B0 _

The data value B0h is deposited at location, 0000:3010. Now, deposit cacode (FFh) for the ‘blank’ character at the memory location, 0000:3010.

8 + Seg. Oset Data 0000 3011 zz _

The next memory location is opened. Enter data, FFh at the indicated memory location using the data keys (0 to 9). To move to the previous memory location, use the ‘ – ‘ command. 9 F F Seg. Oset Data

0000 3011 FF _

The CA-code for blank is entered at memory location: 03011 10 RESET MDE8086 Kit V9.5

Midas 935-0964/5

The trainer is ready to accept valid command

Table-B

Enter the Machine Codes of the following Program starting at location: 01000h (0000:1000)

Label: Mem. Loc Assembly Codes Machine Codes Meaning

START: L1: L2: L2A: HERE1: L3: HERE2: L4: 0000:1000 – 0000:1001 - 0000:100E – 0000:1015 - 0000:101D- 0000:101F - 0000:1027 - 0000:1029- nop mov ax, 0000h mov ds, ax mov ax, 0000h mov ss, ax mov sp, 8FFEh mov al, 80h out CRU29(1Fh), al mov bx, 3000h

mov al, BYTE PTR ds;[bx+10h] out PARU29(19h), al mov cx, 0FFFFh loop HERE1

mov al, BYTE PTR ds:[bx+11h] out PARU((19h), al mov cx, 0FFFFh loop HERE2 jmp L2A 90 B8 00 00 8E D8 B8 00 00 8E D0 BC FE 8F B0 80 E6 1F BB 00 30 8A 47 10 E6 19 B9 FF FF E2 FE 8A 47 11 E6 19 B9 FF FF E2 FE EA 15 10 00 00

; 00000h = Base Add.of Data Seg. ; 00000h = Base Add of Stack Seg. ; Stack Pointer Reg. set to: 08FFEh ; Control Byte to set PAR as output ; bx-register to work as pointer ; reading cacode for ‘3’ ; sending cacode of ‘3’ to PAR ; Insert Time Delay

; reading cacode for ‘blank’ ; sending cacode of ‘blank’ to PAR ; Insert Time Delay

; repeat the process

4. Carry out the steps of Table-C to execute the above program of Table-B. Table-C

Program Execution: Carry Out the following steps:

Sn: Press Key LCD Display Remarks

1 RESET MDE8086 Kit V9.5 Midas 935-0964/5

The trainer is ready 2 AD Seg. Ost Data

xxxx yyyy zz

The cursor blinks at the segment field. Use data keys to set the segment at: 0000h.

3 : Seg. Ost Data 0000 yyyy _ zz

The cursor blinks at the offset field. Use data key to set the address at : 1000h

4 GO Statring Address

0000:1000

(13)

Task-1B.5 Familiarization with Internal Structure of CA 7-Segment Display Device 1 2 3 4 5 6 7 8 9 10 538 e d ca c p b a ca f g ca a b c d g 7 p 6 5 4 2 538 e f 10 ca a(7) 538 b(6) c(4) d(2) e(1) f(9) g(10) p(5)

(a) Physical View (b) Internal LED Structure (c) Electrical Equivalent Figure-1B.4: Structure of Common Anode Type 7-Segment Display Device

Task-1B.6 Enter appropriate data at the appropriate memory locations of DSM to blink character A on the CA7SD. Make CA-code for A looking at the diagram of Fig-1B.3.

Task-1B.7 Learning How to Get Machine Codes of Character Blinking of Task-1B.4

In this task, we will get familiar with the procedures of getting the machine codes for the character-blinking program of Table-B of Task-1B.4. We shall use MASM (Macro Assembler) program and the IBM-PC to obtain the machine codes for the assembly instructions of Table-B of Task-1B.4. The procedures are:

(a) Create a directory named as MDA8086 in the hard drive C. And now accommodate the following program files under this directory. These programs may easily be collected from the CD that has been supplied with the MDA-8086 trainer. If the directory already exists and contains these files then go to step-b

Sno. File Name Purpose

1 COMM.EXE Serial Monitor of the MDA-8086 Trainer 2 LINK.EXE To create relocatable *.EXE file from *.OBJ file 3 LOD186.EXE To create ‘Absolute (*.ABS)’ file from *.obj file 4 MASM.EXE To create *.LST and *.OBJ files form *.ASM file

5 EDIT.EXE To create Assembly Program (Source Code) for 80x86 MPUs 6 EXER <DIR> A Working Directory

(b) Boot the IBMPC in Windows 98/XP and then go to DOS path using the Start Menu. The

monitor would show as: c:\windows>_

Bring the IBM-PC in the following DOS path: c:\mda8086>--

The procedures:

1. Type cd.. and then press enter key 2. Type mda8086 and then press enter key.

(c) Type EDIT at the cursor position of the above DOS prompt. Press Enter key. As a result, a screen appears called DOS Screen will appear.

(14)

7/Expt-1B

(e) Save the screen (what you have typed in the screen) with the file name of: P1B.asm. Save the file as: c:\mda8086\P1B.asm

The Procedures:

1. Press Alt key and then release. And then press Enter key.

2. Choose ‘Save As...’ from the menu using the arrow keys. 3. Now type the file name: P1B.asm and then press Enter key.

(f) Type the following lines (called Assembler Statements) at the top of your program.

MYCODE SEGMENT para public ‘code’ ; declaring logical segment ASSUME cs:MYCODE

ORG 1000h

(g) Type the following assembler statements at the end of your assembly program.

MYCODE ENDS

END START

(h) Update your file (P1B.asm) in the following ways:

The Procedures:

1. Press Alt key and then release. And then press Enter key.

2. Choose ‘Save’ from the menu using the arrow keys. 3. Now press Enter key.

(i) Now leave the screen and come back to the DOS prompt in the following ways:

The Procedures:

1. Press Alt key and then release. And then press Enter key.

2. Choose ‘Exit’ from the menu using the arrow keys. 3. Now press Enter key.

(j) Type cls and press Enter key for clearing up the screen.

(k) Now, convert the source codes of your program c:\mda8086\P1B.asm into machine codes in the following ways: This is known as assembling.

The Procedures:

1. Type MASM at the cursor position of the DOS prompt. Press Enter key. 2. Type P1B.asm (assembly) and press Enter key

3. Type P1B.obj (object) and then Press Enter key 4. Type P1B.lst (list) and press Enter key.

5. Press Enter key

(l) You are back to the DOS prompt. Your assembly program has already been converted into machine codes and the codes have been saved in the path: c:\mda8086\P1B.lst. Show the error messages to the teacher if any. Remember that there should not be any error in the program. If there are errors, take help from the teacher to correct these errors and then and go to Step-k. After error free assembling go to Step-m.

(m) Open the P1B.lst file in the following ways to see its contents:

The Procedures:

1. Type ‘EDIT’ at the DOS prompt. And then press Enter key.

2. Press Alt key and then press Enter key.

3. Choose ‘Open...’ from the menu using the arrow keys. Press Enter key.

4. Use ‘tab’ key and ‘arrow’ key to choose the file, P1B.lst from the menu. Press Enter. 5. Now the machine codes of your program are in the screen.

(n) Look at the machine codes of your program on the screen. Compare these codes with the machine codes of Table-B of Task-1B.4. Write down the codes where they differ.

(o) Look for the jumper ‘P1’ (Fig-1B.5) or switch ‘KIT/PC’ of the MDA-8086 trainer. Bring the jumper at the ‘Local Monitor’ or KIT position.

(15)

+5V GND

Jumper Position at: Local Monitor

P1

538

Jumper Position at: Serial Monitor

Figure-1B.5: Jumper P1 is at Local Monitor Environment

(p) Power OFF and then ON of the MDA-8086 trainer and then press the RESET key. (q) The LCD display of the trainer shows the following prompt message:

MDE8086 Kit V9.5

Midas 335-0964/5

(r) Use keyboard of the trainer and enter the machine codes of Step-n in the CSM starting at memory location. 0000:1000. Take help of the lab teacher to know the ways of entering the differing codes in the CSM. For multi-byte data, the lower bytes should be entered first.

(s) Enter the data B0h (for character 3) at RAM location 0000:3010 and FFh (for Blank) at RAM location 0000:3011 of the data segment memory.

(t) Execute the program at location: 0000:1000 using the GO command.

(u) Observe that the device 3 is blinking on the CA7SD device.

(v) The Task-1B.7 is well done.

Task-1B.8 In this Task, we will learn how to transfer the machine codes of the Step-n of

Task-1B.7 from the IBMPC to the CSM of the MDA-8086 trainer. This method is known as Down

Loading. To do it, we will be using the COM1 port of the IBMPC. This method saves a lot of time

while developing a large program. We do not need to enter the data and codes manually in the memory locations. The procedures are:

1. Power down the MDA-8086 trainer. Bring P1 jumper (Switch) at the ‘Serial Monitor’/KIT position. Connect the serial cable of the trainer with the COM1 port of the IBMPC.

2. Bring the IBM-PC in the following DOS prompt:

c:\mda8086> _

3. From the start icon of the IBMPC execute the WinComm and then goto Step-4 below.

OR

Type COMM at the cursor position and then press Enter key. A communication screen will appear. Press F5 function key and modify the screen as follows:

Serial Port (1/2) : [X] = = > 1 press Enter key Serial baud rate Set

1200 = 1 2400 = 2 4800 = 3 9600 = 4 19.2K = 5 38.4 = 6

Baud Rate Select (1 – 6) : [X] = = > 4 (always) press Enter key Parity bit NP =0, Po = 1, Pe = 2 : [X] = = > 0 press Enter key Word Size 7-bit=2, 8-bit=3 : [X] = = > 3 press Enter key Stop bit 1-bit=0, 2-bit=1 : [X] = = > 0 press Enter key

(16)

4. Power down and Power up the MDA-8086 trainer. Press the RESET key of the trainer to get the prompt message on the screen of the IBMPC.

* * 8086 Monitor 9.5 * * * * Midas 335-0964/5 * * 8086> _

5. To bring the IBMPC into DOS mode, press Alt and hold and then press X key. And then press the Enter key.

6. The IBM-PC in the path: c:\mda8086> _

7. Now, convert the P1B.obj (object) file into P1B.abs (absolute) file for onward transmission to the trainer. Type LOD186 at the cursor position of the DOS prompt. And then press Enter key. Answer as follows:

(a) Type T1B.obj

(b) Type c:\mda8086\P1B.abs (c) press Enter key

The conversion is completed with the message LOAD COMPLETED and the PC comes to the following DOS path:

c:\mda8086> _ The converted file is located at: c:\mda8086\P1B.abs.

8. Type EDIT at the cursor position of the DOS prompt. Open the file P1B.abs

9. The screen shows multiple lines, which are very similar to the following line. This particular format is known as Intel-hex Format. For details, see Page-12/Expt1A).

: 0A 1000 00 90 B8 80 E6 1F B0 B0 E6 19 F4 46 Starting address of storage

10. Exit the screen and come to the DOS prompt of: c:\mda8086> _

11. Type COMM at the DOS prompt and press the Enter key OR click on the WinComm. 12. Reset the MDA-8086 trainer to activate Serial Link with IBMPC.

13. Type L at the cursor position. Press Enter key. And then press F3 key.

14. Type c:\mda8086\P1B.abs and then press Enter key. The program codes have already

been transferred into the trainer with the message ‘OK Completed’.

15. Bring the jumper P1 (Switch) of the trainer into Local Monitor/KIT position.

16 Enter B0h (CA code for 3) at memory location 03010h (0000:3010) and FFh (CA code for Blank) at memory location 03011h (0000:3011) of the DSM.

17 Execute at 0000:1000 using the GO command of the trainer. 18 The device CA7SD must blink the character ‘3’

Task-1B.9 Find the location of the file ‘fnd.abs’ in your computer and bring it under the

directory of c:\mda8086. Down load the codes of the fnd.abs file in the trainer. Execute the program in the trainer at: 0000:1000. Observe that the device CA7SD shows: 0,1,2,3,4,5,6,7,8,9,0,1,2...

9/Expt-1B

Task-1B.10 (P110.asm) Write an 8086-based assembly language program to display the

characters: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,0,1,2,3... cyclically on the device CA7SD. Get your program codes down loaded from the PC to the trainer. The offset of the 1st code byte must be at:

(17)

Task-1B.12 Introduction to MDA-8086 Trainer

The MDA-8086 is a 16-bit microprocessor learning system using Intel’s 8086 architecture. The trainer has been designed, developed and built by the ‘MIDAS Engineering Co. of South Korea.

The Address:

Original Manufacturer: ACE TechnoV, 906 19-7-22,

Kuro-Gu, Seoul, South Korea.

Fax: (02) 2109-5968. Web: www.midaseng.com.

Task-1B.13 Hardware Features of MDA-8086

A. Central Processing Unit Subsystem [see Fig-1.1]

1. 8086 Microprocessor running in Minimum Mode 2. Data Buffers for the data lines of the CPU

3. Address Latches for the Multiplexed Address-Data Bus 4. PAL-Based Composite Memory and Port Decoder

B. Memory Subsystem [see Fig-11.4]

1. 64 Kbytes of EPROM 2. 64 Kbytes of RAM

C: Interrupt Structure Subsystem [see Fig-1.1]

8259-Based 8-Channel Interrupt Priority Controller. It receives interrupt requests from the following devices and funnels them to the 8086.

1. IR0: From the Timer/Counter-1 of the 8253 (U41) 2. IR1: From the Timer/Counter-2 of the 8253

3. IR2: Hardware activation using onboard key: IR2

4. IR3: From Serial Communication Chip, U14

5. IR4-IR7: Available to user via ‘EXT CONNECTOR, SLOT’.

D: Input/Output Subsystem [see Fig-1.1]

1. Keyboard: Discrete IC-Based Keypad containing 24 Keys

2. Display: LCD-Based Display containing 16x2 Characters

3. Parallel IO: a: Onboard 8255 (U29), which is interfaced with the following onboard IO devices:

i. FND (Common Anode Type 7-segment Display Device) ii. LED Assembly (LED11 – LED14)

iii. Stepper Motor Driving Circuitry

iv. Digital-to-Analog Converter (U33), which feds analog signal to either of: * Onboard Level Meter (U38, U39)

* Onboard Analog-to-Digital Converter (U31)

b: Onboard 8255 (U30), which is interfaced with the following onboard IO devices:

8x8 Bi-color Dot Matrix LED Assembly (DOT1)

4. Serial IO: 8251-Based (U14) Serial Communication Scheme, which communicates with the

IBM-PC using RS-232 (U15) Link at a fixed Bd (Baud Rate) of: 9600 bps.

5. ADC: ADC0804-Based Analog-to-Digital Converter. It takes analog signal either from:

a. Onboard Potentio Meter (VR2) b. Onboard Thermostat (TH1) c. Onboard DAC (U33, U36) d. Onboard Microphone

6. DAC: DAC0800 being driven by Port-C of the 8255 (U29). It feds analog signal either to:

* Onboard Level Meter (U38, U39)

(18)

Task-1B.14 Software Features of MDA-8086

A: Resident Monitor Program

1. Allows data entry, edit into RAM locations [Word operations are not available] 2. Allows Program Execution

3. Allows data entry, edit into Registers locations 4. Allows Debugging a Faulty Program (Single Stepping) 5. Does not contain any data conversion algorithms like:

BCD-to-Binary, Binary-to-BCD, Multiplication, Division, BCD-to-ASCII

B: Serial Monitor Program

Allows downloading program/data codes from the IMB-PC to the MDA-8086

C: Example Programs

A disk accompanying the trainer contains a good number of example programs.

Taks-1B.15 Memory Space and Port Space Organization of MDA-8086

00000 003FF Interrupt Vvector Table 00400 FFFFF 0FFFF 09000 08000 RA M 10000 0D000 07000 03000 02FFF 00F00 00EFF RO M 545 Data Structure 00FFF Scratch Pad 01000 04FFF05000 06000 Space for Code Segment Space for Data Segment Space for Extra Segment Space for Stack Segment Us er -1 FFFF:0000 Start Up Location F0000 0CFFF EFFFF

Useable after Decoding

Reserved 4x 4KByres User -2 Reserved 4x 2KByres Us er -3 (00)01 (00)00 545 LCDIR (00)02 LCDSR (00)04 LCDDR KBD DR/FR (00)05 (00)08 8251 : DR (00)09 8253: TC-08252: TC-1 (00)0A 8251: CR/SR (00)0B (00)0D (00)03 8253: TC-2 (00)0F(00)11 SPEAKER: DR8253: CR (00)10 8259: CR (00)12 8259: DR (00)18 ADC : DR/CR OR 8255 (U30):PAR ADC : DR/CR OR 8255 (U30):PBR ADC : DR/CR OR 8255 (U30):PCR ADC : DR/CR OR 8255 (U30):CR (00)1A (00)1C (00)1E (00)19 8255 (U29) PAR 8255 (U29): PBR (00)1B 8255 (U29): PCR (00)1D 8255 (U29): CR (00)1F (00)20 (00)22 (00)24 (00)26 IO CON10 IO CON10 IO CON10 IO CON10 FFFE FFFF

Figure-1B.6: Memory Space of MDA-8086 Figure-1B.7: Port Space Map of MDA-8086

(19)
(20)

13/Expt-1B

Figure-1B.8: Component Layout Diagram of the MDA-8086 System

Task-1.17 Schematics of the MDA-8086 Learning System

(21)
(22)
(23)
(24)
(25)
(26)

Experiment – 1B

Familiarization with Components Organization and the Operating

Procedures of the MDA-8086 Microprocessor Learning System

Read Every Step of a Task and then Work accordingly. Whenever, a Step is Done, put Tick Mark (

) on that Step using a Wood Pencil. Ask Teacher for Help when necessary.

Task-1B.1 Familiarization with the Components Layout

In this task you will be locating and getting familiar with the following functional units of the MDA-8086 trainer. These units are considered as the Building Blocks of a microprocessor based system. The MDA-8086 is an 8086 microprocessor learning system made in Korea.

i. 8086 Microprocessor

ii. RAM (Random Access Read and Write Memory)

iii. EPROM (Ultraviolet Erasable and Electrically Programmable Random Access Read Only Memory)

iv. Input Device (The Keyboard)

v. Keyboard Interface Controller (not visible) vi. Output Devices:

a. Liquid Crystal Display Unit (LCD)

b. Common Anode Type 7-Segment Display Device (CA7SDD) c. Light Emitting Diodes (LED11-LED14)

d. 8x8 Bicolor Dot Matrix LED [DOTLED]. Each dot contains Red and Green LEDs. vii. Output Device Interface Controllers (not visible)

viii. Primary Memory Decoder (not visible) ix. Primary Port Decoder (not visible)

Procedures:

1. Collect the MDA-8086 trainer from the lab attendant. 2. Open the top cover of the trainer.

3. Look at the PCB (Printed Circuit Board) of the trainer and the component layout of Fig-1B.8. 4. Now, on the PCB, locate the circuit designation U1. This is the 8086 microprocessor chip. 5. Look very carefully on the top of the U1-chip and you will find the inscription ‘8086’.

6. Locate the keyboard on the trainer. The keyboard interface circuitry is there but is not

obvious.

7. Locate the following output devices on the PCB of the trainer.

a. The LCD unit. The interface controller of the LCD device is built-in within the LCD panel. b. The 7-segment display device, which has the circuit designation – FND in Fig-1B.8. This is

a common-anode type display device. Let us agree to call it by the symbolic name CA7SD

(Common Anode 7-Segment Display Device). A CA-type display device is opposite to

CC-type display device. The interface controller for this device is the chip, U29 (8255).

c. The LED assembly, LED11-LED13. The interface controller for these LEDs is the chip, U29. 8. Locate the RAM chips U9, U10 on the PCB. Bit capacity of each RAM is: 32x1024x8.

9. Locate the EPROM chips U7 and U8 on the PCB. These chips contain the Monitor Program of

the MDA-8086 trainer. Bit capacity of each EPROM is: 32x1024x8.

(27)

Task-1.2 Familiarization with the Hardware Block Diagram of MDA-8086 : AD 0 1 2 3 4 5 6 7 8 9 A B C D E F - DA + REG G0STP NMI RES 546 CS/ D15-D8 D7-D0 DR:01h

KBIC : 74244 :U24 CPU : 8086 : U1

CS/ D7-D0 D7-D0 LCDIC 9600 Bd RS : 01h IR SR DR 16 Characters x 2 Lines LCD CR:1Eh PA:18h 0V PB:1Ah PC:1Ch D7-D0 D7-D0 PIO: 8255:U30 8x8 Common Cathode Type Bi-color LED Array CS/ +5V Vin MIC TH1 DIP2 DAC:U33 CR:18h DR:18h VR 2 ADC: 0804: U31 CS/ D7-D0 D7-D0 P6 Speaker D CS/ Out SPKIC: U25 DR: 11h D7-D0 D7-D0 CS/

SIO: 8251:U14 TTL <----> RS232 : U15 TTL TxRS TxTTL RxRS TTL RxTTL CON: DB9 SR: 0Ah CR: 0Ah DR: 08h 9600 Bd CS/ PUT: U41 :8253 D15-D7-D0 TC-1:0Bh TC-0:09h TC-2:0Dh CR:0Fh D8 CON10

Users Interface Controller 20h, 22h,CS/ 24h, 26h D7-D0 D15-D8 EVN: ROM:U7 F0000, ... FFFFE ODD: ROM:U8 F0001,... ,FFFFF CS/ CS/ D7-D0 D7-D0 Sx/ A,M-IO/,BHE/ D15-D7- D7-D0 CS/ CS/ D7-D0

CS/ ODD: RAM : U10

00001, ... 0FFFF EVN : RAM : U9 00000,... 0FFFE D8 D0 D7-D0 D7-D0 CR:10h DR:12h IR7 CK0 IR6 IR5 IR4 IR3 IR2 (41h)IR1 (40h)IR0 CK1 CK2 Sy/ PCLK: 2.4576MHz +5V GT0 OT0 TxC,RxC CLK for 9600 Bd GT1 GATE1 0V OT1 0V GATE2 GT2 OT2 +5V IR2 IPC U42 8259 27256 27256 62256 62256 INT IN INTA/ IN

There are many more interface controllers on the PCB of the MDA-8086, which we could not describe in Task-1B.1. The following Hardware Block Diagram of Fig-1B.1 contains the total IO scenario of the trainer. For complete circuit diagram, consult user manual for MDA-8086 trainer.

TR TA / NMI +5V NMI 0V D8 CR:1Fh PCR:1Dh PBR:1Bh PAR:19h CA7SD PB0-PB3 LED11-LED14

Step. Motor Int.PB4-PB7 DACU33 LM:U38 ADC:U31 P8 CS/ D D15-D8 PIO:8255 U29 RxRDY 0V 0V TxRDY

(28)

Task-1B.3 Getting Familiar with Keyboard Layout of MDA-8086 Trainer

433

Figure-1B.2: keyboard Layout of MDA-8086 Learning System

: AD 0 1 2 3 4 5 6 7 8 9 A B C D E F - DA + REG G0 STP MON RES 546

The 26 keys of the keypad may be classified into the following categories:

A: CPU Control Key

1. RES (system RESet) : When this key is pressed down and then released, the 8086 is reset and

starts from the cold state. The PC looks for a valid instruction at memory location: FFFF (CS):0000 (IP) = FFFF0h. Activation of the RES key displays the following message on the LCD monitor. Note that the jumper at P1 must be set to ‘Local Monitor (the left side)’ position.

MDE – 8086 kit ! ! Midas 335-0964/5

2. MON (Monitor) /NMI (Non Maskable Interrupt): When pressed, the CPU is immediately

interrupted

B: Command Keys

1. AD (set memory ADdress) : This command key allows the user to set the 20-bit address of a

memory location in the format of [Segment:Offset]. Press this key and we will see the following message on the LCD with the cursor blinking at the Segment Field.

Seg. Oset data

xxxx yyyy zz

a. ‘Seg.’ stands for ‘Memory Segment’, ‘Oset’ stands for ‘Memory Offset’ and ‘data’ refers to the 8-bit content of the memory location, xxxx:yyyy.

b. Now, we can set the ‘Segment’ part of our desired memory location. Let us assume that we wish to

examine the content of the memory location F000h (F000:0000) of the ROM area of Fig-11.1. We may use the data keys (0 to F) to change the segment into: F000h.

c. Now is the turn to change the ‘Offset’. Press [:] key.

2. : (set the Offset) : This key allows editing the Offset part of a memory location. When this is

pressed, the cursor moves to the Offset Field. And now, the user can use the data keys to set the offset to the desired value.

3. DA (update address and allow Data entry) : This key brings cursor to the Data Field. Now, the

user may use the data key (0 to F) to enter new data (assume that the present memory location is a RAM location).

4. + (increment by One) : This key allows moving to the next memory location. 5. - (decrement by One): This key allows moving in the previous memory location.

6. GO (GO to the beginning point of the program to be executed): This key allows executing a

program.

7. REG (examing and changing REGister contents): This key allows checking and editing the

content of the internal registers of the 8086.

8. STP (Single STep): This key allows executing one instruction at a time. C: Data Keys

(29)

Task-1B.4 Familiarization with the Operation of MDA-8086 Trainer by Blinking Character 3 on the CA7SDD.

Brief Theory: The CA7SDD is connected with the 8086 CPU as per diagram depicted in Fig-1B.3.

03010 03011 B0FF MLoc Content al ah +5V CA a b c d e f g p CA7SD 8255 : U29 Port-A 19h PA7-PA0 CR: 1Fh xxxxx TDELAY D7-D0 D15-D8 PC = CS:IP (1) (1) (2) (3) (3) (4)

RAM: U9, U10 8086 : U1

CS/

548

CA Code for Blank CA Code for 3 Comment 01000 DSM CSM Program Codes

Figure-1B.3: Connection Diagram between CA7SD and the CPU

To show character 3 on CA7SD (output device), we need to send code B0h (1011 0000) into Port-A register of U29. B0h is the 8-bit CA-code for character 3 (see Fig-1.4 for the internal structure of CA7SD). To blank (nothing) the output device, we need to send code FFh into Port-A. After sending B0h, we need to wait for sometimes (Time Delay) so that the character 3 remains visible for a while. Likewise, after sending code for blank, we also need to insert some time delay so that the display remains OFF for sometimes. To blink 3 on the CA7SD, we may follow the steps:

A. Use keyboard and store data B0h (CA-code for 3) at memory location 03010h (0000:3010) of the DSM of Fig-1B.3. Keep data FFh (CA-code for) Blank) at memory location 03011h.

B. Use keyboard and store Program Codes into the memory locations of the CSM of Fig-1B.3. The programs read the data for character 3 from DSM and send it to Port-A register. As a result, 3 appear on CA7SDD. The program inserts time delay. After that the data for blank is sent to Port-A to show nothing on the CA7SDD.

C. Now, let us carry out the following:

1. Power up the MDA-8086 trainer.

2. Carry out the steps of Table-A to enter data into memory locations of DSM.

3. Carry out the steps of Table-B to enter Program Codes into memory locations of CSM.

Table-A

Entry of Common Anode Code for Character 3 and Blank

Sn: Press Key LCD Display Remarks

1 RES MDE8086 Kit V9.5 Midas 935-0964/5

The trainer is ready to accept valid command 2 AD Seg. Oset Data

xxxx yyyy zz

The 20-bit address of an arbitrary memory location is opened in the format of: ‘Segment: Offset’. The present content of the

(30)

435

4 : Seg. Oset Data 0000 yyyy _ zz

The cursor has moved to the offset field and is blinking. Use the data keys (0 to F) to set the value of the offset.

5 3 0 1 0 Seg. Oset Data 0000 3010 _ zz

The 20-bit address, 03010 (0000:3010) is entered. Now, deposit the cacode data (B0h) for character ‘3’.

6 DA Seg. Oset Data 0000 3010 zz _

The cursor has moved at the data field. Now, use data keys (0 to 9) to deposit the cacode, B0h at the indicated memory Location. 7 B 0 Seg. Oset Data

0000 3010 B0 _

The data value B0h is deposited at location, 0000:3010. Now, deposit cacode (FFh) for the ‘blank’ character at the memory location, 0000:3010.

8 + Seg. Oset Data 0000 3011 zz _

The next memory location is opened. Enter data, FFh at the indicated memory location using the data keys (0 to 9). To move to the previous memory location, use the ‘ – ‘ command. 9 F F Seg. Oset Data

0000 3011 FF _

The CA-code for blank is entered at memory location: 03011 10 RESET MDE8086 Kit V9.5

Midas 935-0964/5

The trainer is ready to accept valid command

Table-B

Enter the Machine Codes of the following Program starting at location: 01000h (0000:1000)

Label: Mem. Loc Assembly Codes Machine Codes Meaning

START: L1: L2: L2A: HERE1: L3: HERE2: L4: 0000:1000 – 0000:1001 - 0000:100E – 0000:1015 - 0000:101D- 0000:101F - 0000:1027 - 0000:1029- nop mov ax, 0000h mov ds, ax mov ax, 0000h mov ss, ax mov sp, 8FFEh mov al, 80h out CRU29(1Fh), al mov bx, 3000h

mov al, BYTE PTR ds;[bx+10h] out PARU29(19h), al mov cx, 0FFFFh loop HERE1

mov al, BYTE PTR ds:[bx+11h] out PARU((19h), al mov cx, 0FFFFh loop HERE2 jmp L2A 90 B8 00 00 8E D8 B8 00 00 8E D0 BC FE 8F B0 80 E6 1F BB 00 30 8A 47 10 E6 19 B9 FF FF E2 FE 8A 47 11 E6 19 B9 FF FF E2 FE EA 15 10 00 00

; 00000h = Base Add.of Data Seg. ; 00000h = Base Add of Stack Seg. ; Stack Pointer Reg. set to: 08FFEh ; Control Byte to set PAR as output ; bx-register to work as pointer ; reading cacode for ‘3’ ; sending cacode of ‘3’ to PAR ; Insert Time Delay

; reading cacode for ‘blank’ ; sending cacode of ‘blank’ to PAR ; Insert Time Delay

; repeat the process

4. Carry out the steps of Table-C to execute the above program of Table-B. Table-C

Program Execution: Carry Out the following steps:

Sn: Press Key LCD Display Remarks

1 RESET MDE8086 Kit V9.5 Midas 935-0964/5

The trainer is ready 2 AD Seg. Ost Data

xxxx yyyy zz

The cursor blinks at the segment field. Use data keys to set the segment at: 0000h.

3 : Seg. Ost Data 0000 yyyy _ zz

The cursor blinks at the offset field. Use data key to set the address at : 1000h

4 GO Statring Address

0000:1000

(31)

Task-1B.5 Familiarization with Internal Structure of CA 7-Segment Display Device 1 2 3 4 5 6 7 8 9 10 538 e d ca c p b a ca f g ca a b c d g 7 p 6 5 4 2 538 e f 10 ca a(7) 538 b(6) c(4) d(2) e(1) f(9) g(10) p(5)

(a) Physical View (b) Internal LED Structure (c) Electrical Equivalent Figure-1B.4: Structure of Common Anode Type 7-Segment Display Device

Task-1B.6 Enter appropriate data at the appropriate memory locations of DSM to blink character A on the CA7SD. Make CA-code for A looking at the diagram of Fig-1B.3.

Task-1B.7 Learning How to Get Machine Codes of Character Blinking of Task-1B.4

In this task, we will get familiar with the procedures of getting the machine codes for the character-blinking program of Table-B of Task-1B.4. We shall use MASM (Macro Assembler) program and the IBM-PC to obtain the machine codes for the assembly instructions of Table-B of Task-1B.4. The procedures are:

(a) Create a directory named as MDA8086 in the hard drive C. And now accommodate the following program files under this directory. These programs may easily be collected from the CD that has been supplied with the MDA-8086 trainer. If the directory already exists and contains these files then go to step-b

Sno. File Name Purpose

1 COMM.EXE Serial Monitor of the MDA-8086 Trainer 2 LINK.EXE To create relocatable *.EXE file from *.OBJ file 3 LOD186.EXE To create ‘Absolute (*.ABS)’ file from *.obj file 4 MASM.EXE To create *.LST and *.OBJ files form *.ASM file

5 EDIT.EXE To create Assembly Program (Source Code) for 80x86 MPUs 6 EXER <DIR> A Working Directory

(b) Boot the IBMPC in Windows 98/XP and then go to DOS path using the Start Menu. The

monitor would show as: c:\windows>_

Bring the IBM-PC in the following DOS path: c:\mda8086>--

The procedures:

1. Type cd.. and then press enter key 2. Type mda8086 and then press enter key.

(32)

437

(e) Save the screen (what you have typed in the screen) with the file name of: P1B.asm. Save the file as: c:\mda8086\P1B.asm

The Procedures:

1. Press Alt key and then release. And then press Enter key.

2. Choose ‘Save As...’ from the menu using the arrow keys. 3. Now type the file name: P1B.asm and then press Enter key.

(f) Type the following lines (called Assembler Statements) at the top of your program.

MYCODE SEGMENT para public ‘code’ ; declaring logical segment ASSUME cs:MYCODE

ORG 1000h

(g) Type the following assembler statements at the end of your assembly program.

MYCODE ENDS

END START

(h) Update your file (P1B.asm) in the following ways:

The Procedures:

1. Press Alt key and then release. And then press Enter key.

2. Choose ‘Save’ from the menu using the arrow keys. 3. Now press Enter key.

(i) Now leave the screen and come back to the DOS prompt in the following ways:

The Procedures:

1. Press Alt key and then release. And then press Enter key.

2. Choose ‘Exit’ from the menu using the arrow keys. 3. Now press Enter key.

(j) Type cls and press Enter key for clearing up the screen.

(k) Now, convert the source codes of your program c:\mda8086\P1B.asm into machine codes in the following ways: This is known as assembling.

The Procedures:

1. Type MASM at the cursor position of the DOS prompt. Press Enter key. 2. Type P1B.asm (assembly) and press Enter key

3. Type P1B.obj (object) and then Press Enter key 4. Type P1B.lst (list) and press Enter key.

5. Press Enter key

(l) You are back to the DOS prompt. Your assembly program has already been converted into machine codes and the codes have been saved in the path: c:\mda8086\P1B.lst. Show the error messages to the teacher if any. Remember that there should not be any error in the program. If there are errors, take help from the teacher to correct these errors and then and go to Step-k. After error free assembling go to Step-m.

(m) Open the P1B.lst file in the following ways to see its contents:

The Procedures:

1. Type ‘EDIT’ at the DOS prompt. And then press Enter key.

2. Press Alt key and then press Enter key.

3. Choose ‘Open...’ from the menu using the arrow keys. Press Enter key.

4. Use ‘tab’ key and ‘arrow’ key to choose the file, P1B.lst from the menu. Press Enter. 5. Now the machine codes of your program are in the screen.

(n) Look at the machine codes of your program on the screen. Compare these codes with the machine codes of Table-B of Task-1B.4. Write down the codes where they differ.

(o) Look for the jumper ‘P1’ (Fig-1B.5) or switch ‘KIT/PC’ of the MDA-8086 trainer. Bring the jumper at the ‘Local Monitor’ or KIT position.

(33)

+5V GND

Jumper Position at: Local Monitor

P1

538

Jumper Position at: Serial Monitor

Figure-1B.5: Jumper P1 is at Local Monitor Environment

(p) Power OFF and then ON of the MDA-8086 trainer and then press the RESET key. (q) The LCD display of the trainer shows the following prompt message:

MDE8086 Kit V9.5

Midas 335-0964/5

(r) Use keyboard of the trainer and enter the machine codes of Step-n in the CSM starting at memory location. 0000:1000. Take help of the lab teacher to know the ways of entering the differing codes in the CSM. For multi-byte data, the lower bytes should be entered first.

(s) Enter the data B0h (for character 3) at RAM location 0000:3010 and FFh (for Blank) at RAM location 0000:3011 of the data segment memory.

(t) Execute the program at location: 0000:1000 using the GO command.

(u) Observe that the device 3 is blinking on the CA7SD device.

(v) The Task-1B.7 is well done.

Task-1B.8 In this Task, we will learn how to transfer the machine codes of the Step-n of

Task-1B.7 from the IBMPC to the CSM of the MDA-8086 trainer. This method is known as Down

Loading. To do it, we will be using the COM1 port of the IBMPC. This method saves a lot of time

while developing a large program. We do not need to enter the data and codes manually in the memory locations. The procedures are:

1. Power down the MDA-8086 trainer. Bring P1 jumper (Switch) at the ‘Serial Monitor’/KIT position. Connect the serial cable of the trainer with the COM1 port of the IBMPC.

2. Bring the IBM-PC in the following DOS prompt:

c:\mda8086> _

3. From the start icon of the IBMPC execute the WinComm and then goto Step-4 below.

OR

Type COMM at the cursor position and then press Enter key. A communication screen will appear. Press F5 function key and modify the screen as follows:

Serial Port (1/2) : [X] = = > 1 press Enter key Serial baud rate Set

1200 = 1 2400 = 2 4800 = 3 9600 = 4 19.2K = 5 38.4 = 6

Baud Rate Select (1 – 6) : [X] = = > 4 (always) press Enter key Parity bit NP =0, Po = 1, Pe = 2 : [X] = = > 0 press Enter key Word Size 7-bit=2, 8-bit=3 : [X] = = > 3 press Enter key

(34)

4. Power down and Power up the MDA-8086 trainer. Press the RESET key of the trainer to get the prompt message on the screen of the IBMPC.

* * 8086 Monitor 9.5 * * * * Midas 335-0964/5 * * 8086> _

5. To bring the IBMPC into DOS mode, press Alt and hold and then press X key. And then press the Enter key.

6. The IBM-PC in the path: c:\mda8086> _

7. Now, convert the P1B.obj (object) file into P1B.abs (absolute) file for onward transmission to the trainer. Type LOD186 at the cursor position of the DOS prompt. And then press Enter key. Answer as follows:

(a) Type T1B.obj

(b) Type c:\mda8086\P1B.abs (c) press Enter key

The conversion is completed with the message LOAD COMPLETED and the PC comes to the following DOS path:

c:\mda8086> _ The converted file is located at: c:\mda8086\P1B.abs.

8. Type EDIT at the cursor position of the DOS prompt. Open the file P1B.abs

9. The screen shows multiple lines, which are very similar to the following line. This particular format is known as Intel-hex Format. For details, see Page-12/Expt1A).

: 0A 1000 00 90 B8 80 E6 1F B0 B0 E6 19 F4 46 Starting address of storage

10. Exit the screen and come to the DOS prompt of: c:\mda8086> _

11. Type COMM at the DOS prompt and press the Enter key OR click on the WinComm. 12. Reset the MDA-8086 trainer to activate Serial Link with IBMPC.

13. Type L at the cursor position. Press Enter key. And then press F3 key.

14. Type c:\mda8086\P1B.abs and then press Enter key. The program codes have already

been transferred into the trainer with the message ‘OK Completed’.

15. Bring the jumper P1 (Switch) of the trainer into Local Monitor/KIT position.

16 Enter B0h (CA code for 3) at memory location 03010h (0000:3010) and FFh (CA code for Blank) at memory location 03011h (0000:3011) of the DSM.

17 Execute at 0000:1000 using the GO command of the trainer. 18 The device CA7SD must blink the character ‘3’

Task-1B.9 Find the location of the file ‘fnd.abs’ in your computer and bring it under the

directory of c:\mda8086. Down load the codes of the fnd.abs file in the trainer. Execute the program in the trainer at: 0000:1000. Observe that the device CA7SD shows: 0,1,2,3,4,5,6,7,8,9,0,1,2...

439

Task-1B.10 (P110.asm) Write an 8086-based assembly language program to display the

characters: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,0,1,2,3... cyclically on the device CA7SD. Get your program codes down loaded from the PC to the trainer. The offset of the 1st code byte must be at:

(35)

Task-1B.12 Introduction to MDA-8086 Trainer

The MDA-8086 is a 16-bit microprocessor learning system using Intel’s 8086 architecture. The trainer has been designed, developed and built by the ‘MIDAS Engineering Co. of South Korea.

The Address:

Original Manufacturer: ACE TechnoV, 906 19-7-22,

Kuro-Gu, Seoul, South Korea.

Fax: (02) 2109-5968. Web: www.midaseng.com.

Task-1B.13 Hardware Features of MDA-8086

A. Central Processing Unit Subsystem [see Fig-1.1]

1. 8086 Microprocessor running in Minimum Mode 2. Data Buffers for the data lines of the CPU

3. Address Latches for the Multiplexed Address-Data Bus 4. PAL-Based Composite Memory and Port Decoder

B. Memory Subsystem [see Fig-11.4]

1. 64 Kbytes of EPROM 2. 64 Kbytes of RAM

C: Interrupt Structure Subsystem [see Fig-1.1]

8259-Based 8-Channel Interrupt Priority Controller. It receives interrupt requests from the following devices and funnels them to the 8086.

1. IR0: From the Timer/Counter-1 of the 8253 (U41) 2. IR1: From the Timer/Counter-2 of the 8253

3. IR2: Hardware activation using onboard key: IR2

4. IR3: From Serial Communication Chip, U14

5. IR4-IR7: Available to user via ‘EXT CONNECTOR, SLOT’.

D: Input/Output Subsystem [see Fig-1.1]

1. Keyboard: Discrete IC-Based Keypad containing 24 Keys

2. Display: LCD-Based Display containing 16x2 Characters

3. Parallel IO: a: Onboard 8255 (U29), which is interfaced with the following onboard IO devices:

i. FND (Common Anode Type 7-segment Display Device) ii. LED Assembly (LED11 – LED14)

iii. Stepper Motor Driving Circuitry

iv. Digital-to-Analog Converter (U33), which feds analog signal to either of: * Onboard Level Meter (U38, U39)

* Onboard Analog-to-Digital Converter (U31)

b: Onboard 8255 (U30), which is interfaced with the following onboard IO devices:

8x8 Bi-color Dot Matrix LED Assembly (DOT1)

4. Serial IO: 8251-Based (U14) Serial Communication Scheme, which communicates with the

IBM-PC using RS-232 (U15) Link at a fixed Bd (Baud Rate) of: 9600 bps.

5. ADC: ADC0804-Based Analog-to-Digital Converter. It takes analog signal either from:

a. Onboard Potentio Meter (VR2) b. Onboard Thermostat (TH1) c. Onboard DAC (U33, U36) d. Onboard Microphone

6. DAC: DAC0800 being driven by Port-C of the 8255 (U29). It feds analog signal either to:

(36)

Task-1B.14 Software Features of MDA-8086

A: Resident Monitor Program

1. Allows data entry, edit into RAM locations [Word operations are not available] 2. Allows Program Execution

3. Allows data entry, edit into Registers locations 4. Allows Debugging a Faulty Program (Single Stepping) 5. Does not contain any data conversion algorithms like:

BCD-to-Binary, Binary-to-BCD, Multiplication, Division, BCD-to-ASCII

B: Serial Monitor Program

Allows downloading program/data codes from the IMB-PC to the MDA-8086

C: Example Programs

A disk accompanying the trainer contains a good number of example programs.

Taks-1B.15 Memory Space and Port Space Organization of MDA-8086

00000 003FF Interrupt Vvector Table 00400 FFFFF 0FFFF 09000 08000 RA M 10000 0D000 07000 03000 02FFF 00F00 00EFF RO M 545 Data Structure 00FFF Scratch Pad 01000 04FFF05000 06000 Space for Code Segment Space for Data Segment Space for Extra Segment Space for Stack Segment Us er -1 FFFF:0000 Start Up Location F0000 0CFFF EFFFF

Useable after Decoding

Reserved 4x 4KByres User -2 Reserved 4x 2KByres Us er -3 (00)01 (00)00 545 LCDIR (00)02 LCDSR (00)04 LCDDR KBD DR/FR (00)05 (00)08 8251 : DR (00)09 8253: TC-08252: TC-1 (00)0A 8251: CR/SR (00)0B (00)0D (00)03 8253: TC-2 (00)0F(00)11 SPEAKER: DR8253: CR (00)10 8259: CR (00)12 8259: DR (00)18 ADC : DR/CR OR 8255 (U30):PAR ADC : DR/CR OR 8255 (U30):PBR ADC : DR/CR OR 8255 (U30):PCR ADC : DR/CR OR 8255 (U30):CR (00)1A (00)1C (00)1E (00)19 8255 (U29) PAR 8255 (U29): PBR (00)1B 8255 (U29): PCR (00)1D 8255 (U29): CR (00)1F (00)20 (00)22 (00)24 (00)26 IO CON10 IO CON10 IO CON10 IO CON10 FFFE FFFF

Figure-1B.6: Memory Space of MDA-8086 Figure-1B.7: Port Space Map of MDA-8086

(37)
(38)

443

Figure-1B.8: Component Layout Diagram of the MDA-8086 System

Task-1.17 Schematics of the MDA-8086 Learning System

(39)
(40)
(41)
(42)
(43)

References

Related documents

Since then, the Bank has continued to deliver on these commitments by: (i) improving the integration of gender into the Bank‘s agriculture and rural development work; (ii)

A little more time passed and the Lord spoke to us and said, “I will come to My people, the Jews, and will reveal My- self to them where they are — in the kibutzim, in the fields,

4 (c) shows optical micrographs of friction stir weld AA6061 at heat affected zone from the micrograph it can be observed that grains are slightly elongated. 4

Using cross-sectional data from Newsweek’s 2015 Green Rankings List and a variety of online financial sources, this study examines the relationship between corporate sustainability

I like The Lord of the Rings because it’s really exciting?. It’s longer than most films, but the actors

All compounds scoring better than 1 standard deviation from the mean were tested in extra precision (XP), and the top 10% of XP ligands were put through flexible XP docking,

The production of organic compost, organic ferments and pesticides is one of the demonstrated alternatives that will allow or permit small-scale farmers to regenerate the fertility

The module performs the analysis of the raw sensor data in order to obtain information about the operator’s physiological condition.. The separately running Data Analysis