80% found this document useful (5 votes)
6K views

Interfacing 8086 With 8255

The document describes interfacing the 8086 microprocessor with various peripheral devices. It provides steps to interface 8086 with the 8255 Programmable Peripheral Interface, 8254 Programmable Interval Timer, 8259 Programmable Interrupt Controller, 8279 Keyboard/Display Interface, and writing assembly language programs to demonstrate the interfacing. It includes control word formats, pin configurations, flow charts and sample assembly code to initialize and control the peripherals from the 8086.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
80% found this document useful (5 votes)
6K views

Interfacing 8086 With 8255

The document describes interfacing the 8086 microprocessor with various peripheral devices. It provides steps to interface 8086 with the 8255 Programmable Peripheral Interface, 8254 Programmable Interval Timer, 8259 Programmable Interrupt Controller, 8279 Keyboard/Display Interface, and writing assembly language programs to demonstrate the interfacing. It includes control word formats, pin configurations, flow charts and sample assembly code to initialize and control the peripherals from the 8086.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 32

INTERFACING 8086 WITH 8255 Ex.No AIM: To write an assembly language program to interface 8255 with 8086.

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

1 1/0 mode 0 - BSR

Programe Name: Programming in 8085 (16 bit addition) Address


1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A

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

OUT C6, AL MOV AL, 54H OUT C2, AL

HLT

FLOW CHART Start

Send the control word to control register Send the data for which the LED will glow

Stop OUTPUT DATA = 54H S1 0 OFF S2 1 ON S3 0 OFF S4 1 ON S5 0 OFF S6 1 ON S7 0 OFF S8 0 OFF

RESULT: Thus the assembly language program to interface 8086 with 8255 was written and verified.

INTERFACING 8255 INPUT PORTS IN MODE 0

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

PC1 PC4 PC3 PC0 PB7 PB0

(8086)

BLOCK DIAGRAM OF 8255

+5V Gnd

Group A Port A

Group A Port A

Group A Port C Upper Data bus buffer

D 7 D0

8 bit internal data bus

Group A Port C Lower

Read Write Control Logic

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

SC SELECT COUNTER SC1 0 0 1 1 SC0 0 1 0 1

Select counter 0 Select counter 1 Select counter 2 Read back command

Mode 0 Mode 1 Mode 2 Mode 3 Mode 4 Mode 5

RW READ WRITE RW1 0 1 0 1 RW0 0 0 1 1 0 1

BCD Binary counter 16 bits Binary coded decimal counter

Count latch command Read / write MSB only Read / write LSB only Read / write LSB first then MSB

TO SELECT COUNT 0 0 0 1 OUTPUT

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

Programe Name: Interfacing of 8253 with 8086 Address


1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E 100F

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

OUT C6, AL MOV AL, 54H OUT C2, AL

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

ICW2 A0 A8 A15 T7 T3 ICW4 PM AE01 SFNM

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

eight mask bit

M = 0 channel is enable M = 1 channel is masked

ICW1 ICW2 ICW4 OCW1

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

17H 08H 01H FEH

Program Name: INTERFACING 8086 WITH 8259 Address


1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C 100D 100E 100F 1010 1011 1012 1013 1014

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

OUT C0, AL MOV, AL, 08

Send through port C0 Move 08H to AL

OUT C2, AL MOB AL, OC

Send through port C2 Move OCH to AL

OUT C2, AL MOV AL, OFE

Send through port C2 Move OFE to AL

OUT C2, AL ST1

Send though port C2 Set interrupt

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

8279 COMMANDS i) Keyboard / display mode set 0 0 0

DD Display mode : KKK keyboard mode

D 0 0 1 1

D 0 1 0 1

8 16 8 16

8 bit 8 bit 8 bit 8 bit

Character display Character display Character display Character display

Left entry Left entry Right entry Right entry

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

iv) Write Display RAM 1 0 0 A1 A A A A

v) Clear 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

Display / Keyboard mode 0 Clear Mode 0 0 0 0 1 0 0 0 CCH 0 0 1 0 1 1 1 00H

Write display RAM 0 0 0 0 1 0 0 0 90H

FIFO Status 0 0 0 0 0 0 0 1 07H

Read FIFO 1 1 1 1 1 1 1 0 40H

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

Segment Control Word d c b a dg g f

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

MOV CX, 0008H

Move the count to CX

MOV AL, 00H

OUT C2, AL MOV AL, OCCH

OUT C2, AL MOV AL, 90H

OUT C2, AL MOV AL, OFFH

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

Out CO, AL Loop L1

L2

IN AL, C2 TEST AL, 07

JZ, L2 Mov AL, 40H

OUT C2, Al IN AL, C0 AND Al, OFH

Mov BL, AL MOV BH, 12H

MOv AL, [BX] OUT C0, AL JMP 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

Move the data in Bx to AL Send it to through port C0 Jump to L2

Terminate the program

Programe Name: Interfacing with 8279 (b) Blinking display Address


1000 1001 1002 1003 1004 1005 1006 1007

Label
Start

Mnemonic
MOV, SI, 1200H

Opcodes
C7 C6 00 12 C6 C0 00 E6

Comments
Initialize the SI with 1200H

MOV AL 000H

Move the control word To AL Send it to control

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

MOV AL, 00H

OUT C2, AL MOV AL, OCCH

OUT C2, AL MOV AL, 90H

OUT C2, AL L1 MOV AL, OFFH Out CO, AL INC SI LOOP L1 L2 Call Delay

MOV AL, 00H

OUT C2, AL MOV AL, OCCH

OUT C2 AL MOV AL, 90H

OUT C2 AL MOV CX, 0006

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

Move the data to AL Send it through port C0

1039 103A 103B

Loop L2 Call Delay

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

Mov Dx, OFFF4

Move the data to DX

DEC DX JNZ L3 RET

Jump on NO zero to L3 RETURN TO MAIN PROGRAM

Programe Name: Interfacing with 8279 (c) Rolling display 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 1019

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

Mov CX, 000FH

Move the count To CX

Mov, AL, 10H

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

OUT C2, AL Mov, Al, OCC

Out C2, AL MOV, AL, 90H

OUT C2, AL L1 MOV. AL, [SI] OUT C0, Al

101A 101B 101C 101D 101E 101F 1020 1021 1022 1023 DELAY: 1500 1501 1502 1503 1504 1505 1506 1507

Call delay

INC SI Loop L1 JMP start

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

Mov Dx, OFFFFH

Move the count OFFFFH to DX

L2

DEC DX JNZ L2 RET

Decrement DX Jump on NO zero to L2 Return to main program

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

Band rate 00 SYN mode 01 AGYN x 1 10 ASYN x 16 11 ASYN x 64

Framing control 00 NOT Valid 01 1 stop bit 10 1 stop bit

Parity control X0 No parity 01 ODD parity 11 EVEN parity

Character 00 5 bit 01 6 bit 10 7 bit 11 8 bit

COMMAND WORD FORMAT

EH

1R

RTS

SBRK

RXE

DTR

TXE

STATUS WORD FORMAT

DSR

SYN DET

FE

OE

PE

TX EMPY

RX RDY

TX RDY

MODE WORD

0 =36 OUTPUT: RECEIVER 1500 : 1501 : 1502 : 1503 : 1504 :

CONTROL WORD

0 =40

15H 20H 25H 30H 35H

STATUS WORD 0 0 0 0 0 1 0 0 =04

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

MOV, AL, 36H

Move the mode word 36 to AL

OUT 16, AL MOV AL, 40H

Move the command Word 40 to AL

OUT 10H, AL MOV AL, 01H

Move the command word 01 to AL

OUT 10, AL MOV CL, 05H

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

IN AL, 0AH AND AL, 04H

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 the controlword 36 to AL

OUT 16, AL MOV AL, 40

Move 40H to AL

OUT 10, AL MOV AL, 01

Move 01H to AL

OUT 10, AL Reload MOV CL, 05

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

IN AL, 0A AND AL, 02

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:

Programe Name: Parallel communication between two microprocessor TRANSMITTER Address


1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A RECEIVER 1000 1001 1002 1003 1004 1005 1006 1007

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

OUT 26, AL MOV AL, 4BH

OUT 20, AL HLT

Send the contents of A through port 20 Terminate the programe

MOV AL, 9BH

OUT 26, AL MOV AL, 4BH

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

1008 1009 100A 100B

OUT 20, AL

HLT

06 00 12 F4

of AL in the Memory location Terminate the programe

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 :

Programe Name: Interfacing ADC with 8086 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 1019 101A 101B

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

OUT E0, AL MOV AL, 18H

Move the control word 18 to AL

OUT E0, AL MOV AL, 01

Move 01 to AL

OUT DO, AL MOV AL, 00

Move 00 to AL

OUT DO, AL L1 IN AL, D8 AND AL, 01

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

101C 101D 101E 101F 1020 1021 1022 1023 1024

JNZ, L1 IN AL, C8 MOV [1500], 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

Programe Name: Interfacing DAC with 8086 Address


1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A 100B 100C

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 Call delay

Call the delay program

MOV Al, OFF

Move the high Value FFH 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

JMO Start MOV CX, 00C0

E8 F0 04 E9, ED, FF C7 C1 C0 00 49 75 FD CB

Call the delay program

Jump to start Move the count In CX

DEC CX JNZ L1 RET

Decrement CX Jump on No zero to L1 Return to main program

MOV Al, 00

OUT C0, AL

JNZ, L1 JMP, start

C6 C0 00 E6 C0 FE C0 75 FA E9 ED FF

Move 00H to AL

Send it to C0 port Increment AL Jump on No zero to L1 Jump to start

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

Programe Name: Interfacing DAC with 8086 Address


1010 1011 1012 1013 1014 1015 1016 1017 1018

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

MOV CL, 04H

L2

MOV AL, [DI]

1019 101A 101B 101C 101D 101E 101F 1020 1021 1022 1023 1024 1025 1026 1027

OUT C0, AL MOV X, 1010

L1

DEC DX JNZ L1 INC DI LOOP L2 JMP START

E6 C0 C7 C6 10 10 4A 75 FD 47 E2 F2 F9 E8 FF

Send the content of AL though the port Move the data in DX

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

Programe Name: DC MOTOR Address


1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 100A

Label

Mnemonic
MOV AL, OFF

Opcodes
C6 C0 FF E6 C0 C6 C0 00 E6 00 E8

Comments
Move OFFH to AL

OUT C0, AL MOV AL, 00H

Move 00H to AL

OUT 00, AL Call delay

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, 30H

OUT, 00, AL MOV AL , OFF

OUT 00, AL MOV AL, 00H OUT D0, AL CALL DELAY

MOV AL, 00

OUT D8, AL IN AL, C8 MOV SI, 1600

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

Move the data from AL to SI Move 00H to AL Increment SI

MOV AL, 00 INC SI MOV [SI],. AL HLT

Terminate the program

Delay

MOV CL1, 04

L2

MOV DX1, FFFF

C6 C1 04 C7 C2 FF FF

Move 04H to CL

Move OFFFFH to DX

103B 103C 103D 103E 103F 1040 1041 1042

L1

DEC DX JNZ L1 DEC CL JNZ L2 RET

4A 75 70 FE C9 75 F5 C3

Decrement DX Jump on No zero to L1 Decrement CL Jump on No zero to L2 Return to main program

RESULT: Thus the assembly language program to control a DC motor was written and verified.

You might also like