Interfacing 8086 With 8255
Interfacing 8086 With 8255
COMPONENTS REQUIRED: 8086 Microprocessor kit, LED interface, flat cable ALGORITHM: Step 1 : Step 2 : Step 3 : Step 4 : CONTROL WORD D7 D6 D5 D4 D3 D2 D1 D0 Group B Port C lower 1 input 0 output Port B 1 input 0 output Mode: 0 mode 0 1 mode 1 Group A Port C Upper 1 input 0 output Port A 1 input 0 output Mode: 00 mode 0 01 mode 1 10 mode 2 CONTROL WORD 1 0 0 0 0 0 0 0 = 80H Date:
Start Send the control word to the control register Send the data for which the LED will glow Stop
Label
Mnemonic
MOV AL, 80H
Opcodes
C6 C0 80 E6 C6 C6 C0 54 E6 C2 F4
Comments
Move the control Word to AL Send the control Register Move the data To AL Send toport C2 Terminate the program
HLT
Send the control word to control register Send the data for which the LED will glow
RESULT: Thus the assembly language program to interface 8086 with 8255 was written and verified.
PA1
PA0 8 2 5 5
B U F F E R LEDS
+5V
A15 A1 A0
MEMR
MEMW
RESET OUT
CS A1 A0
RD
WR CS RESET
(8086)
+5V Gnd
Group A Port A
Group A Port A
D 7 D0
Group B Control
Group B Port B
INTERFACING OF 8254 WITH 8086 Ex.No. AIM: To interface 8254 with 8086 and to generate a square waveform. COMPONENT REQUIRED: 8086 microprocessor kit, flat cable, 8254 interface, CRO, Probe. ALGORITHM: Step 1 : Step 2 : Step 3 : Step 4 : Step 5 : CONTROL WORD: SC1 SC0 RW1 RW0 M2 M1 M0 BC0 M - MODE M2 0 0 0 X 1 1 M1 0 0 1 1 0 0 M0 0 1 0 1 0 1 Date:
Start Send the control word to control register Send the lower byte of the count through port A Send the upper byte of the count through port A Stop
Count latch command Read / write MSB only Read / write LSB only Read / write LSB first then MSB
36H
V t
Amplitude 2.2V Time Period : TON 0.6 0.1 ms TOFF 0.6 0.1 ms Frequency 1 1 8.33kHZ T 1.2 0.1 ms
Label
Mnemonic
MOV AL, 80H
Opcodes
C6 C0 36 E6 CE C6 C0 FF E6 C8 C6 C0 00 E6 C8 FA
Comments
Move the control Word to AL Send the control Register Move the lower byte Of the count to AL Send the control Register through C8 Move the upper Byte of the count to AL Send the count Through port C8
HLT
RESULT: Thus the assembly language program to interface 8254 with 8086 was written and verified.
INTERFACING 8086 WITH 8259 Ex.No. AIM: To write an assembly language program to interface 8259 programmable interrupt controller with 8086. ALGORITHM : Step 1 : Start Step 2 : Move the different control word to their respective control register Step 3 : Move the control word in interrupt the Led in operational command word. Step 4 : Set interrupt. INITIALIZATION COMMAND WORD FORMAT: ICW1 A7 A7A6A5 LT1M AD1 A6 A5 1 LTM AD1 SWG IC4 Date:
SNG L IC4
Interrupt Vector address 1 Level triggered mode 0 Edge triggered mode Call address interval 1 Interval of 4 0 Interval of 8 1 Single 0 Caocode Mode 1 IC4 needed 0 Not needed
A15/T7 0 0
A14/T6
A13/T5
A12/T4
A11/T3
A10
A9
A8
interrupt vector address (80 / 85 mode) interrupt vector address (8056 / 8088 mode) 0 SFNM BUF M.S AE01 PM
1 1 1 0 M6 M5
M4
8086 / 8088mode auto EOI, 0 normal EOI Special fully nested mode not special fully nested mode M3 M2 M1 M0
OCW1
M7
M7 M0
0 0 0 1
0 0 0 1
0 0 0 1
1 0 0 1
0 1 0 1
1 0 0 1
1 0 0 1
1 0 1 0
Label
Mnemonic
MOV AL, 17H
Opcodes
C6 C0 17 E6 C0 C6 C0 08 E2 C2 C6 C0 08 E6 C2 C6 C0 FE E6 C2 FB
Comments
Move 17H to AL
RESULT: Thus the assembly language program to interface 8259 with 8086 was written and verified.
INTERFACING 8086 WITH 8279 Ex.No AIM: To write an assembly language program to interface 8279 with 8086 microprocessor kit. COMPONENTS REQUIRED: 8086 Microprocessor kit, Flate cable, 8279 interface ALGORITHM: Step 1 Step 2 Step 3 Step 4 Step 5 Date:
: : : : :
Get the control words for keyboard / display mode, clear display mode and to rotate display RAM. Send the control words to control register Get the control words to display letters Send it to the interface through the port A Stop
D 0 0 1 1
D 0 1 0 1
8 16 8 16
K 0 0 0 0 1 1 1 1
K 0 0 1 1 0 0 1 1
K 0 1 0 1 0 1 0 1
Encoded scan keyboard Decoded scan keyboard Encoded scan keyboard Decoded scan keyboard Encoded scan Sensor Decoded scan Sensor Stored input encoded Stored input decoded
2 key lock kit 2 Key lock out N key lock kit N Key lock out Matrix Matrix Display scan Display scan
ii) Read FIFO / Sensor RAM 0 1 0 A1 X A A A RAM address bits Auto increment flag iii) Read display RAM 0 1 1 A1 A A A A Address bits of display RAM
CD
CD
CD
CF
CA
0X All zeros 1 0 AB = Hex 20 (0010 0000)
1 1 All ones
vi) FIFO Status Word DU S/E O U F N N N No. of characters in FIFO FIFO FULL
Display unavailable
Error Under run Error Over run Sensor Closure / Error flag for multiple closure
Look up table for Key board scan: 1200 1204 1208 120C OC 99 08 0C 9F 29 09 1A 4A 28 88 68 0B 0F 38 E8 a e f e d Look up table for blinking display 1200 98 H 1201 68 E 1202 7C L 1203 C8 P 1204 1C U 1205 29 S g b c
Look up table for rolling display 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 120A 120B 120C 120D FF FF FF FF FF 98 68 7C C8 FF 1C 29 FF FF
H E L P U S
Programe Name: Interfacing with 8279 (a) Key board Scan Address
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E 100F 1010 1011 1012 1013 1014 1015 1016 1017 1018
Label
Mnemonic
MOV, SI, 1200H
Opcodes
C7 C6 00 12 C7 C1 08 00 C6 C0 02 E6 02 C6 C0 CC E6 C2 C6 C0 90 E6 C2 C6 C0
Comments
Move the data to SI
Move the control word to keyboard Mode to AL Send it to control register Move the content word to clear display to AL Send it to control register Move the control word to write display to AL Send it to control register Move OFFH to AL
1019 101A 101B 101C 101D 101E 101F 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 102A 102B 102C 102D 101E 102F 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 103A 103B
L1
L2
HLT
FF E6 C2 E2 FC E4 C2 F6 C0 07 74 F9 C6 C0 40 E6 C2 E4 C0 80 F0 0F 88 C3 C6 C7 12 8A 07 E6 0C E9 FC FF F4
Send it through C0 to point the address Loop till the count is zero Read the FIFO status from C2 port Test the content of AL and 07H Jump on zero to L2 Move the control word to read FIFO to AL Send it to control register Get the data from FIFO AND the content Of AL and OFH Move the content of AL to BL Assign 12H & BH
Label
Start
Mnemonic
MOV, SI, 1200H
Opcodes
C7 C6 00 12 C6 C0 00 E6
Comments
Initialize the SI with 1200H
MOV AL 000H
1008 1009 100A 100B 100C 100D 100E 100F 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 101A 101B 101C 101D 101E 101F 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 102A 102B 102C 102D 101E 102F 1030 1031 1032 1033 1034 1035 1036 1037 1038
OUT C2, AL L1 MOV AL, OFFH Out CO, AL INC SI LOOP L1 L2 Call Delay
L2
MOV AL, FF
OUT C0, AL
C2 C6 C0 CC E6 C2 C6 C0 90 E6 C2 C7 C1 06 00 8A 04 E6 C0 46 E2 F9 E8 DF 04 C6 C0 00 E6 C2 C6 C0 CC E6 C2 C6 C0 90 E6 C2 C7 C1 06 00 C6 C0 Ff E6 C0
word to AL Move to control word to AL Send it to control register Move the control word to AL Send it to control register Initialize the count in CX
Move the data From SI to Al Send the data through port C0 Increment SI Loop till the count is zero Call the delay Program Move the control word to AL Send it to control register Move the control word to Al Send it to control register Move the control word to Al Send it to control register Move the control to CX
Jmp start DELAY: 1500 1501 1502 1503 1504 1505 1506 1507
E2 F9 E8 C2 04 E9, BF FF C7 C7 FF FF 4A 75 FD C3
Loop till to count is zero Call the delay program Jump to start
Delay
Label
Start
Mnemonic
Mov SI, 1200
Opcodes
C7 C6 00 12 C7 C1 0F 00 C6 C0 10 E6 C2 C6 60 CC E6 C2 C6 C0 90 E6 C2 8A 04 E6
Comments
Initialize the SI with 1200H
Move the control word to AL Send it to control register Move the control word to AL Send the control register Move the control word to AL Send the control register Move the data in SI to AL Send the data in
101A 101B 101C 101D 101E 101F 1020 1021 1022 1023 DELAY: 1500 1501 1502 1503 1504 1505 1506 1507
Call delay
C0 E8 E2 04 46 E2 F6 E9 OC FF C7 C2 FF FF 4A 75 FD C3
AL through CO Call delay Program Increment SI Loop will the count is zero Jump to start
L2
RESULT: Thus the assembly language program to interface 8299 with 8086 was written ad verified.
SERIAL COMMUNICATION OF 8086 Ex.No. AIM: To write an assembly language program to establish serial communication between two 8086 microprocessor kit. ALGORITHM: Step 1 : Step 2 : Step 3 : Step 4 : Step 5 : Step 6 : Step 7 : Step 8 : Step 9 : RECEIVER: Step 1 : Step 2 : Step 3 : Step 4 : Step 5 : Date:
Initialize SI with 1500 Send the mode word through port 16 Send the command word through port 10 Assign the count Read the status whether transmitter is empty or not If transmitter is empty, send the data through port 08 and increment SI Compare the data with 3FH, if flag is not zero execute from step 4. Otherwise decrement the count and on No zero execute from step 5 Stop
Initialize the SI with 1500 Assign the respective control word and count Read the status whether receiver is ready or not. It it is ready accept the data from port 08. Increment SI and decrement the count On No zero repeat from step 3 else stop.
COMPONENTS REQUIRED: 8086 Microprocessor kit, RS 232 Cable MODE WORD FORMAT:
D7
D6
D5
D4
D3
D2
D1
D0
EH
1R
RTS
SBRK
RXE
DTR
TXE
DSR
SYN DET
FE
OE
PE
TX EMPY
RX RDY
TX RDY
MODE WORD
CONTROL WORD
0 =40
0 =02
Programe Name: Serial Communication (between two 8086 Microprocessor kit) TRANSMITTER Address
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 101A 101B 101C 101D 101E 101F 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 102A 102B 102C 102D 102E 102F 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 103A
Label
Mnemonic
MOV SI, 1500H
Opcodes
C7 C6 00 15 C6 C0 36 E6 16 C6 C0 40 E6 10 C6 C0 01 E6 10 C7 C1 05 E4 0A 80 E0 04 74 8A 04 E6 08 46 38 3F 75 FE C9 75 F4
Comments
Initialize SI with 1500
Move the count 05 in CL Read the status from port 0A Perform AND operation Between the data in AL and 04H Jump on zero to Check Move the data from SI to AL Send the data through 08 port Increment SI Compare the data on AL and 3FH Jump on No zero to reload Decrement the count in CL Jump on No zero To check Terminate the program
JNZ check MOV, AL [SI] OUT 08, AL INC SI CMP, AL, 3FH JNZ reload DEC CL JNZ check HLT
RECEIVER Address
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 101A 101B 101C 101D 101E 101F 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 102A 102B 102C 102D 102E 102F 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 103A
Label
Mnemonic
MOV SI, 1500
Opcodes
C7 C6 00 15 C6 C0 36 E6 16 C6 C0 40 E6 10 C6 C0 01 E6 10 C7 C1 05 E4 0A 80 E0 02 74 E4 08 8A 04 46 38 3F 75 FE C9 75 F4
Comments
Initialize SI with 1500
MOV, AL, 36
Move 40H to AL
Move 01H to AL
Move the count 05 to CL Read the status from port 0A AND the data in AL and 02 Jump on zero to Check Get the data from 08H and store it AL Move the data in Al to SI Increment SI Compare the data in AL and 3FH Jump on No zero to reload Decrement CL Jump on No zero To check Terminate the program
Check
JNZ check MOV, AL [SI] OUT 08, AL INC SI CMP, AL, 3FH JNZ reload DEC CL JNZ check HLT
RESULT: Thus the assembly language program to establish serial communication between two 8086 microprocessor was written and verified
PARALLEL COMMUNICATION INTERFACE Exp.No. AIM: To write an assembly language program to transmit a byte from one 8086 microprocessor to another 8086 processor. COMPONENTS REQUIRED: 8086 Microprocessor kits, 26 pin flat cable ALGORITHMS: Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7 : : : : : : : Get command word format for transmitter Get command word for register Get data to be transmitted Send data through an output port from transmitter Get data from input port of receiver Store it in an address Stop Date:
Label
Mnemonic
MOV AL, 80H
Opcodes
C6 C0 80 E6 26 C6 C0 4B E6 20 F4
Comments
Move the control word to the Accumulator Send it through port 26 Move the data in AL
C6 C0 9B E6 26 E4 20 88
Move the control word to the al Send it to control register Get the data through Port 20 Move the content
OUT 20, AL
HLT
06 00 12 F4
RESULT: Thus the assembly language program to perform parallel communication between two 8086 microprocessor kit was written and verified.
INTERFACING ADC WITH 8086 Ex. No. AIM: To write an assembly language program to convert an analog quantity into a equivalent digital value using ADC interfaced with 8086. ALGORITHM: Step 1 Step 2 Step 3 Step 4 : : : : Initialize the control words in control register Set the SOC pin high Find whether the conversion is over by checking EOC pin Read the digital data from successive approximation register and move it to some memory location. Stop Date:
Step 5 :
Label
Mnemonic
MOV AL, 10H
Opcodes
C6 C0 10 E6 E0 C6 C0 18 E6 E0 C6 C0 01 E6 D0 C6 C0 00 E6 D0 E4 08 80 E0 01 80 E8 01
Comments
Initialize the control word in AL
Move 01 to AL
Move 00 to AL
CMP AL, 07
Read the EOC pin status Perform AND operation between the data in AL and 01H Compare the Immediate data 01 With data in AL
HLT
75 F6 E4 C8 88 06 00 15 F4
Jump on No zero to L7 Get the digital output from port C8 Move the data in AL to the Specified address Terminate the program
RESULT: Thus the assembly language program to convert an analog input into digital equivalent was written and verified.
INTERFACING DAC WITH 8086 Ex. No. AIM: To generate different types of wave forms by interfacing a DAC card with 8086 microprocessor. ALGORITHM: SQUARE WAVE: Step 1 : Step 2 : Step 3 : Step 4 : Date:
send low value to DAC and call delay send high value to DAC and call delay repeat from step 1 stop
TRIANGULAR WAVE: Step 1 : send low value from BL to DAC Step 2 : increment the value in BL Step 3 : if BL is not zero, repeat from step 1 else move high value to BL Register Step 4 : send high value in BL Step 5 : decrement the value in BL Step 6 : if BL is not zero, repeat from step 4 else repeat from step 1 SAWTOOTH WAVE: Step 1 : send the low value from AL to DAC Step 2 : increment AL and send it to DAC, repeat from step 2 till it is not Zero Step 3 : go to step 1
Label
Start
Mnemonic
MOV AL, 00
Opcodes
C6 C0 00 E6 C0 E8 F8 04 C6 C0 FF E6 C0
Comments
Move the low value 00H to AL
OUT C0, AL
100D 100E 100F 1010 DELAY 1500 Delay 1501 1502 1503 1504 1505 1506 1507 1508 SAWTOOTH WAVE 1100 Start 1101 1102 1103 L1 1104 1105 1106 1107 1108 1109 110A 110B TRAINGULAR WAVE Start L1
Call delay
E8 F0 04 E9, ED, FF C7 C1 C0 00 49 75 FD CB
MOV Al, 00
OUT C0, AL
C6 C0 00 E6 C0 FE C0 75 FA E9 ED FF
Move 00H to AL
L2
MOV BL, 00 MOV AL, BL INC BL JNZ BL MOV BL, OFF MOV AL, BL OUT C0, AL DEC BL JNZ L2 JMP start
Move 00H to BL Move the data from BL to AL Increment BL Jump on No zero to L1 Move OFFH to BL Move the data from BL to AL Send it to C0 Decrement BL Jump on No zero to L2 Jump to start
RESULT: Thus the assembly language program to generate different types of waveforms by DAC was written and verified.
INTERFACING STEPPER MOTOR Ex. No. AIM: To interface a stepper more with 8086 microprocessor and to run it at different speed. COMPONENTS REQUIRED: 8086 Microprocessor, flat cable, stepper motor interface ALGORITHM Step 1 : Step 2 Step 3 Step 4 Step 5 Step 6 Step 7 Step 8 Step 9 : : : : : : : : Date:
get the data which indicates the direction of rotation of motor in destination index store the count in CL register get the speed of the motor in AX register get the data in AL register from DI send the data through output port keep decrementing the value in DX register till it becomes zero increment DI and repeat from step 4 loop till the count becomes zero jump to step 1
STEPPER MOTOR A stepper motor is a device used to obtain an accurate position control of rotating shafts. It employs rotation of its shaft in terms of steps, rather than continuous rotation as in case of AC or DC motors. To rotate the shaft of the stepper motor, A sequence of pulses is needed to b applied to the windings of the stepper motor in a proper sequence With a pulse applied to the winding input the rotor rotates by one teeth position or an angle x. The angle x may be calculated as X = 360 / no. of rotor teeth
Label
START
Mnemonic
MOV DI, 1218H
Opcodes
C7 C7 18 12 C6 C1 04 8A 05
Comments
Initialize the DI with the memory Location Move the count in CL Move the data in DI to AL
L2
1019 101A 101B 101C 101D 101E 101F 1020 1021 1022 1023 1024 1025 1026 1027
L1
E6 C0 C7 C6 10 10 4A 75 FD 47 E2 F2 F9 E8 FF
Decrement Dx Jump on No zero to L1 Increment DI Loop to L2 till the Count becomes zero Jump to start.
RESULT Thus the assembly language perform to interface the stepper motor with 8086 was written and verified.
DC MOTOR CONTROL AND SPEED MEASUREMENT Ex. No. AIM: To write an assembly language program to control DC motor and measure the speed. COMPONENTS REQUIRED: 8086 Microprocessor Kit,, DC motor interface ALGORITHM: Step 1 : Start Step 2 : Set the high value for DAC to make active Step 3 : Make the gate signal low for 8253 to be low and call the delay Step 4 : Initialize the control word format of 8253 and initialize the count to the counter of 8253. Step 5 : Make the gate signal high and call delay and once again make the gate signal to low Step 6 : Store the lower byte and upper byte of the count to different Addresses Step 7 : In delay move the high value to register and it is decrement until each on set the zero flag according to the loop Step 8 : Stop SPEED CALACULATION
Time output in Decimal 60 4 time delay
Date:
Speed
Label
Mnemonic
MOV AL, OFF
Opcodes
C6 C0 FF E6 C0 C6 C0 00 E6 00 E8
Comments
Move OFFH to AL
Move 00H to AL
Call delay
100B 100C 100D 100E 100F 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 101A 101B 101C 101D 101E 101F 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 102A 102B 102C 102D 102E 102F 1030 1031 1032 DELAY 1033 1034 1035 1036 1037 1038 1039 103A
MOV AL, 00
MOV [SI] AL
F3 01 C6 C0 30 E6 00 C6 C0 FF E6 00 C6 C0, 00 06 D0 E8 0F 01 C6 C0 00 E6 D8 E4 C8 C7 C6 00 16 88 04 C6, C0 00 46 88 04 F4
Move 30H to AL
Move OFF to Al
Move 00 to AL
Call delay
Move 00 to AL
Move 1600H to SI
Delay
MOV CL1, 04
L2
C6 C1 04 C7 C2 FF FF
Move 04H to CL
Move OFFFFH to DX
L1
4A 75 70 FE C9 75 F5 C3
RESULT: Thus the assembly language program to control a DC motor was written and verified.