0% found this document useful (0 votes)
247 views32 pages

Interfacing 8086 With 8255

Uploaded by

pinkgirl2519
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
247 views32 pages

Interfacing 8086 With 8255

Uploaded by

pinkgirl2519
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

INTERFACING 8086 WITH 8255

Ex.No Date:

AIM:
To write an assembly language program to interface 8255 with 8086.

COMPONENTS REQUIRED:
8086 Microprocessor kit, LED interface, flat cable

ALGORITHM:
Step 1 : Start
Step 2 : Send the control word to the control register
Step 3 : Send the data for which the LED will glow
Step 4 : Stop

CONTROL WORD

D7 D6 D5 D4 D3 D2 D1 D0

Group B
1 – 1/0 mode Port C lower
0 - BSR 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
Programe Name: Programming in 8085 (16 – bit addition)

Address Label Mnemonic Opcodes Comments


1000 MOV AL, 80H C6 Move the control
1001 C0 Word to AL
1002 80
1003 OUT C6, AL E6 Send the control
1004 C6 Register
1005 MOV AL, 54H C6 Move the data
1006 C0 54 To AL
1007 OUT C2, AL
1008 E6 Send toport C2
1009 C2
100A HLT F4 Terminate the program

FLOW CHART

Start

Send the control word


to control register

Send the data for which the


LED will glow

Stop

OUTPUT
DATA = 54H

S1 S2 S3 S4 S5 S6 S7 S8
0 1 0 1 0 1 0 0
OFF ON OFF ON OFF ON OFF OFF

RESULT:
Thus the assembly language program to interface 8086 with 8255 was written and
verified.
INTERFACING 8255 INPUT PORTS IN MODE 0

PA1 B
U
F
+5V
F
PA0 E
R
LEDS
8
2
A15 CS 5 PC1
5
A1 A1 PC4
A0 A0 PC3
MEMR RD PC0
MEMW WR PB7
RESET OUT CS
RESET PB0
(8086)
BLOCK DIAGRAM OF 8255

Group Group
+5V A A
Gnd Port Port
A A

Group A

Port C

Upper
Data
bus
D 7 – D0 buffer

8 bit Group A
internal
Port C
data bus
Lower

Group
Read B Group
Control B
Write
Port
Control B

Logic
INTERFACING OF 8254 WITH 8086
Ex.No. Date:

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 : Start
Step 2 : Send the control word to control register
Step 3 : Send the lower byte of the count through port A
Step 4 : Send the upper byte of the count through port A
Step 5 : Stop

CONTROL WORD:

SC1 SC0 RW1 RW0 M2 M1 M0 BC0

SC – SELECT COUNTER M - MODE

SC1 SC0 M2 M1 M0
0 0 Select counter 0 0 0 0 Mode 0
0 1 Select counter 1 0 0 1 Mode 1
1 0 Select counter 2 0 1 0 Mode 2
1 1 Read back command X 1 1 Mode 3
1 0 0 Mode 4
1 0 1 Mode 5

RW – READ WRITE BCD

RW1 RW0 0 Binary counter 16 – bits


0 0 Count latch command 1 Binary coded decimal counter
1 0 Read / write MSB only
0 1 Read / write LSB only
1 1 Read / write LSB first then MSB

TO SELECT COUNT ‘0’


0 0 1 1 0 1 1 0 – 36H

OUTPUT
Amplitude  2.2V
Time Period :
V TON  0.6  0.1 ms
t
TOFF  0.6  0.1 ms
1 1
Frequency    8.33kHZ
T 1.2  0.1 ms
Programe Name: Interfacing of 8253 with 8086

Address Label Mnemonic Opcodes Comments


1000 MOV AL, 80H C6 Move the control
1001 C0 Word to AL
1002 36
1003 OUT C6, AL E6 Send the control
1004 CE Register
1005 MOV AL, 54H C6 Move the lower byte
1006 C0 Of the count to AL
1007 OUT C2, AL FF
1008 E6 Send the control
1009 C8 Register through C8
100A HLT C6 Move the upper
100B C0 Byte of the count to
100C 00 AL
100D E6 Send the count
100E C8 Through port C8
100F FA

RESULT:
Thus the assembly language program to interface 8254 with 8086 was written and
verified.
INTERFACING 8086 WITH 8259
Ex.No. Date:

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 A6 A5 1 LTM AD1 SWG IC4

A7A6A5 - Interrupt Vector address


LT1M - 1 - Level triggered mode
0 - Edge triggered mode
AD1 - Call address interval
1 - Interval of 4
0 - Interval of 8
SNG L - 1 - Single
0 - Caocode Mode
IC4 - 1 - IC4 needed
0 - Not needed

ICW2
A0 A15/T7 A14/T6 A13/T5 A12/T4 A11/T3 A10 A9 A8

A8 – A15 - interrupt vector address (80 / 85 mode)


T7 – T3 - interrupt vector address (8056 / 8088 mode)

ICW4 0 0 0 SFNM BUF M.S AE01 PM

PM - 1 - 8086 / 8088mode


AE01 - 1 - auto EOI, 0 – normal EOI
SFNM - 1 - Special fully nested mode
0 - not special fully nested mode

OCW1 M7 M6 M5 M4 M3 M2 M1 M0
M7 – M0 - eight mask bit

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

ICW1 0 0 0 1 0 1 1 1 17H

ICW2 0 0 0 0 1 0 0 0 08H

ICW4 0 0 0 0 0 0 0 1 01H

OCW1 1 1 1 1 1 1 1 0 FEH

Program Name: INTERFACING 8086 WITH 8259

Address Label Mnemonic Opcodes Comments


1000 MOV AL, 17H C6 Move 17H to AL
1001 C0
1002 17
1003 OUT C0, AL E6 Send through port C0
1004 C0
1005 MOV, AL, 08 C6 Move 08H to AL
1006 C0
1007 08
1008 OUT C2, AL E2 Send through port C2
1009 C2
100A MOB AL, OC C6 Move OCH to AL
100B C0
100C 08
100D OUT C2, AL E6 Send through port C2
100E C2
100F MOV AL, OFE C6 Move OFE to AL
1010 C0
1011 FE
1012 OUT C2, AL E6 Send though port C2
1013 C2
1014 ST1 FB Set interrupt

RESULT:
Thus the assembly language program to interface 8259 with 8086 was written and
verified.
INTERFACING 8086 WITH 8279
Ex.No Date:

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 : Get the control words for keyboard / display mode, clear
display mode and to rotate display RAM.
Step 2 : Send the control words to control register
Step 3 : Get the control words to display letters
Step 4 : Send it to the interface through the port A
Step 5 : Stop

8279 COMMANDS

i) Keyboard / display mode set


0 0 0 D D K K K

DD – Display mode : KKK keyboard mode

D D
0 0 8 8 bit Character display Left entry
0 1 16 8 bit Character display Left entry
1 0 8 8 bit Character display Right entry
1 1 16 8 bit Character display Right entry

K K K
0 0 0 Encoded scan keyboard 2 key lock kit
0 0 1 Decoded scan keyboard 2 Key lock out
0 1 0 Encoded scan keyboard N key lock kit
0 1 1 Decoded scan keyboard N Key lock out
1 0 0 Encoded scan Sensor Matrix
1 0 1 Decoded scan Sensor Matrix
1 1 0 Stored input encoded Display scan
1 1 1 Stored input decoded 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

1 1 0 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 0 0 1 0 1 1 1 00H

Clear Mode

0 0 0 0 1 0 0 0 CCH

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 OC 9F 4A 0B
1204 99 29 28 0F
1208 08 09 88 38
120C 0C 1A 68 E8

Segment Control Word a


f g b
d c b a dg g f e
e c
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
Look up table for rolling display

1200 FF
1201 FF
1202 FF
1203 FF
1204 FF
1205 98 H
1206 68 E
1207 7C L
1208 C8 P
1209 FF
120A 1C U
120B 29 S
120C FF
120D FF

Programe Name: Interfacing with 8279 (a) Key board Scan

Address Label Mnemonic Opcodes Comments


1000 MOV, SI, 1200H C7 Move the data to SI
1001 C6
1002 00
1003 12
1004 MOV CX, 0008H C7 Move the count to
1005 C1 CX
1006 08
1007 00
1008 MOV AL, 00H C6 Move the control
1009 C0 word to keyboard
100A 02 Mode to AL
100B OUT C2, AL E6 Send it to
100C 02 control register
100D MOV AL, OCCH C6 Move the content
100E C0 word to clear display
100F CC to AL
1010 OUT C2, AL E6 Send it to control
1011 C2 register
1012 MOV AL, 90H C6 Move the control
1013 C0 word to write
1014 90 display to AL
1015 OUT C2, AL E6 Send it to
1016 C2 control register
1017 MOV AL, OFFH C6 Move OFFH to AL
1018 C0
1019 FF
101A L1 Out CO, AL E6 Send it through C0
101B C2 to point the address
101C Loop L1 E2 Loop till the count
101D FC is zero
101E L2 IN AL, C2 E4 Read the FIFO status
101F C2 from C2 port
1020 TEST AL, 07 F6 Test the content
1021 C0 of AL and 07H
1022 07
1023 JZ, L2 74 Jump on zero to L2
1024 F9
1025 Mov AL, 40H C6 Move the control
1026 C0 word to read FIFO
1027 40 to AL
1028 OUT C2, Al E6 Send it to
1029 C2 control register
102A IN AL, C0 E4 Get the data
102B C0 from FIFO
102C AND Al, OFH 80 AND the content
102D F0 Of AL and OFH
101E 0F
102F Mov BL, AL 88 Move the content
1030 C3 of AL to BL
1031 MOV BH, 12H C6 Assign 12H & BH
1032 C7
1033 12
1034 MOv AL, [BX] 8A Move the data
1035 07 in Bx to AL
1036 OUT C0, AL E6 Send it to
1037 0C through port C0
1038 JMP L2 E9 Jump to L2
1039 FC
103A FF
103B HLT F4 Terminate the program

Programe Name: Interfacing with 8279 (b) Blinking display

Address Label Mnemonic Opcodes Comments


1000 Start MOV, SI, 1200H C7 Initialize the
1001 C6 SI with 1200H
1002 00
1003 12
1004 MOV AL 000H C6 Move the control word
1005 C0 To AL
1006 00
1007 E6 Send it to control
1008 MOV AL, 00H C2 word to AL
1009 C6 Move to control
100A C0 word to AL
100B OUT C2, AL CC
100C E6 Send it to control
100D MOV AL, OCCH C2 register
100E C6 Move the control
100F C0 word to AL
1010 OUT C2, AL 90
1011 E6 Send it to control
1012 MOV AL, 90H C2 register
1013 C7 Initialize the
1014 C1 count in CX
1015 OUT C2, AL 06
1016 00
1017 L1 MOV AL, OFFH 8A Move the data
1018 04 From SI to Al
1019 Out CO, AL E6 Send the data
101A C0 through port C0
101B INC SI 46 Increment SI
101C LOOP L1 E2 Loop till the count
101D F9 is zero
101E L2 Call Delay E8 Call the delay
101F DF Program
1020 04
1021 MOV AL, 00H C6 Move the control
1022 C0 word to AL
1023 00
1024 OUT C2, AL E6 Send it to control
1025 C2 register
1026 MOV AL, OCCH C6 Move the control
1027 C0 word to Al
1028 CC
1029 OUT C2 AL E6 Send it to control
102A C2 register
102B MOV AL, 90H C6 Move the control
102C C0 word to Al
102D 90
101E OUT C2 AL E6 Send it to control
102F C2 register
1030 MOV CX, 0006 C7 Move the control
1031 C1 to CX
1032 06
1033 00
1034 L2 MOV AL, FF C6 Move the data to
1035 C0 AL
1036 Ff
1037 OUT C0, AL E6 Send it through
1038 C0 port C0
1039 Loop L2 E2 Loop till to
103A F9 count is zero
103B Call Delay E8 Call the delay
C2 program
04
Jmp start E9, BF Jump to start
FF
DELAY:
1500 Delay Mov Dx, OFFF4 C7 Move the data
1501 C7 to DX
1502 FF
1503 FF
1504 DEC DX 4A
1505 JNZ L3 75 Jump on NO zero to
1506 FD L3
1507 RET C3 RETURN TO MAIN PROGRAM

Programe Name: Interfacing with 8279 (c) Rolling display

Address Label Mnemonic Opcodes Comments


1000 Start Mov SI, 1200 C7 Initialize the SI
1001 C6 with 1200H
1002 00
1003 12
1004 Mov CX, 000FH C7 Move the count
1005 C1 To CX
1006 0F
1007 00
1008 Mov, AL, 10H C6 Move the control
1009 C0 word to AL
100A 10
100B OUT C2, AL E6 Send it to control
100C C2 register
100D Mov, Al, OCC C6 Move the control
100E 60 word to AL
100F CC
1010 Out C2, AL E6 Send the control
1011 C2 register
1012 MOV, AL, 90H C6 Move the control
1013 C0 word to AL
1014 90
1015 OUT C2, AL E6 Send the control
1016 C2 register
1017 L1 MOV. AL, [SI] 8A Move the data in SI
1018 04 to AL
1019 OUT C0, Al E6 Send the data in
101A C0 AL through CO
101B Call delay E8 Call delay
101C E2 Program
101D 04
101E INC SI 46 Increment SI
101F Loop L1 E2 Loop will the count
1020 F6 is zero
1021 JMP start E9 Jump to start
1022 OC
1023 FF
DELAY:
1500 Mov Dx, OFFFFH C7 Move the count
1501 C2 OFFFFH to DX
1502 FF
1503 FF
1504 L2 DEC DX 4A Decrement DX
1505 JNZ L2 75 Jump on NO zero to
1506 FD L2
1507 RET C3 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. Date:

AIM:
To write an assembly language program to establish serial communication
between two 8086 microprocessor kit.

ALGORITHM:
Step 1 : Initialize SI with 1500
Step 2 : Send the mode word through port 16
Step 3 : Send the command word through port 10
Step 4 : Assign the count
Step 5 : Read the status whether transmitter is empty or not
Step 6 : If transmitter is empty, send the data through port 08 and
increment SI
Step 7 : Compare the data with 3FH, if flag is not zero execute from step 4.
Step 8 : Otherwise decrement the count and on No zero execute from step 5
Step 9 : Stop

RECEIVER:
Step 1 : Initialize the SI with 1500
Step 2 : Assign the respective control word and count
Step 3 : Read the status whether receiver is ready or not. It it is ready
accept the data from port 08.
Step 4 : Increment SI and decrement the count
Step 5 : 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 Character
01 – 1 stop bit 00 – 5 bit
Parity control 01 – 6 bit
10 – 1 ½ stop bit X0 – No parity 10 – 7 bit
01 – ODD parity 11 – 8 bit
11 – EVEN parity
COMMAND WORD FORMAT

EH 1R RTS SBRK RXE DTR TXE

STATUS WORD FORMAT

SYN TX RX TX
DSR FE OE PE
DET EMPY RDY RDY

MODE WORD

0 0 1 1 0 1 1 0
=36 OUTPUT:

CONTROL WORD RECEIVER


1500 : 15H
1501 : 20H
0 1 0 0 0 0 0 0 1502 : 25H
=40 1503 : 30H
1504 : 35H

STATUS WORD

0 0 0 0 0 1 0 0
=04

0 0 0 0 0 0 1 0
=02
Programe Name: Serial Communication (between two 8086 Microprocessor kit)

TRANSMITTER

Address Label Mnemonic Opcodes Comments


1010 MOV SI, 1500H C7 Initialize SI with
1011 C6 1500
1012 00
1013 15
1014 MOV, AL, 36H C6 Move the mode word
1015 C0 36 to AL
1016 36
1017 OUT 16, AL E6
1018 16
1019 MOV AL, 40H C6 Move the command
101A C0 Word 40 to AL
101B 40
101C OUT 10H, AL E6
101D 10
101E MOV AL, 01H C6 Move the command
101F C0 word 01 to AL
1020 01
1021 OUT 10, AL E6
1022 10
1023 MOV CL, 05H C7 Move the count 05
1024 C1 in CL
1025 05
1026 IN AL, 0AH E4 Read the status
1027 0A from port 0A
1028 AND AL, 04H 80 Perform AND operation
1029 E0 Between the data in AL
102A 04 and 04H
102B JNZ check 74 Jump on zero to
102C Check
102D MOV, AL [SI] 8A Move the data from
102E 04 SI to AL
102F OUT 08, AL E6 Send the data through
1030 08 08 port
1031 INC SI 46 Increment SI
1032 CMP, AL, 3FH 38 Compare the data on
1033 3F AL and 3FH
1034 JNZ reload 75 Jump on No zero
1035 to reload
1036 DEC CL FE Decrement the
1037 C9 count in CL
1038 JNZ check 75 Jump on No zero
1039 To check
103A HLT F4 Terminate the program
RECEIVER

Address Label Mnemonic Opcodes Comments


1010 MOV SI, 1500 C7 Initialize SI with
1011 C6 1500
1012 00
1013 15
1014 MOV, AL, 36 C6 Move the controlword
1015 C0 36 to AL
1016 36
1017 OUT 16, AL E6
1018 16
1019 MOV AL, 40 C6 Move 40H to AL
101A C0
101B 40
101C OUT 10, AL E6
101D 10
101E MOV AL, 01 C6 Move 01H to AL
101F C0
1020 01
1021 OUT 10, AL E6
1022 10
1023 Reload MOV CL, 05 C7 Move the count 05
1024 C1 to CL
1025 05
1026 Check IN AL, 0A E4 Read the status
1027 0A from port 0A
1028 AND AL, 02 80 AND the data in AL
1029 E0 and 02
102A 02
102B JNZ check 74 Jump on zero to
102C Check
102D MOV, AL [SI] E4 Get the data from 08H
102E 08 and store it AL
102F OUT 08, AL 8A Move the data in
1030 04 Al to SI
1031 INC SI 46 Increment SI
1032 CMP, AL, 3FH 38 Compare the data
1033 3F in AL and 3FH
1034 JNZ reload 75 Jump on No zero
1035 to reload
1036 DEC CL FE Decrement CL
1037 C9
1038 JNZ check 75 Jump on No zero
1039 To check
103A HLT F4 Terminate the program
RESULT: Thus the assembly language program to establish serial communication
between two 8086 microprocessor was written and verified
PARALLEL COMMUNICATION INTERFACE
Exp.No. Date:

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 : Get command word format for transmitter


Step 2 : Get command word for register
Step 3 : Get data to be transmitted
Step 4 : Send data through an output port from transmitter
Step 5 : Get data from input port of receiver
Step 6 : Store it in an address
Step 7 : Stop

Programe Name: Parallel communication between two microprocessor

TRANSMITTER

Address Label Mnemonic Opcodes Comments


1000 MOV AL, 80H C6 Move the control
1001 C0 word to the
1002 80 Accumulator
1003 OUT 26, AL E6 Send it through
1004 26 port 26
1005 MOV AL, 4BH C6 Move the data in AL
1006 C0
1007 4B
1008 OUT 20, AL E6 Send the contents of
1009 20 A through port 20
100A HLT F4 Terminate the programe

RECEIVER
1000 MOV AL, 9BH C6 Move the control
1001 C0 word to the al
1002 9B
1003 OUT 26, AL E6 Send it to control
1004 26 register
1005 MOV AL, 4BH E4 Get the data through
1006 20 Port 20
1007 88 Move the content
1008 OUT 20, AL 06 of AL in the
1009 00 Memory location
100A 12
100B HLT F4 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. Date:

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 : Initialize the control words in control register


Step 2 : Set the SOC pin high
Step 3 : Find whether the conversion is over by checking EOC pin
Step 4 : Read the digital data from successive approximation register
and move it to some memory location.
Step 5 : Stop

Programe Name: Interfacing ADC with 8086

Address Label Mnemonic Opcodes Comments


1000 MOV AL, 10H C6 Initialize the
1001 C0 control word in AL
1002 10
1003 OUT E0, AL E6
1004 E0
1005 MOV AL, 18H C6 Move the control
1006 C0 word 18 to AL
1007 18
1008 OUT E0, AL E6
1009 E0
100A MOV AL, 01 C6 Move 01 to AL
100B C0
100C 01
100D OUT DO, AL E6
100E D0
100F MOV AL, 00 C6 Move 00 to AL
1010 C0
1011 00
1012 OUT DO, AL E6
1013 D0
1014 L1 IN AL, D8 E4 Read the EOC pin
1015 08 status
1016 AND AL, 01 80 Perform AND operation
1017 E0 between the data in
1018 01 AL and 01H
1019 CMP AL, 07 80 Compare the
101A E8 Immediate data 01
101B 01 With data in AL
101C JNZ, L1 75 Jump on No zero
101D F6 to L7
101E IN AL, C8 E4 Get the digital
101F C8 output from port C8
1020 MOV [1500], AL 88 Move the data
1021 06 in AL to the
1022 00 Specified address
1023 15
1024 HLT F4 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. Date:

AIM:
To generate different types of wave forms by interfacing a DAC card with 8086
microprocessor.

ALGORITHM:

SQUARE WAVE:
Step 1 : send low value to DAC and call delay
Step 2 : send high value to DAC and call delay
Step 3 : repeat from step 1
Step 4 : 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 Label Mnemonic Opcodes Comments


1000 Start MOV AL, 00 C6 Move the low value
1001 C0 00H to AL
1002 00
1003 OUT C0, AL E6
1004 C0
1005 Call delay E8 Call the delay program
1006 F8
1007 04
1008 MOV Al, OFF C6 Move the high
1009 C0 Value FFH to AL
100A FF
100B OUT C0, AL E6
100C C0
100D Call delay E8 Call the delay program
100E F0
100F 04
1010 JMO Start E9, ED, FF Jump to start
DELAY
1500 Delay MOV CX, 00C0 C7 Move the count
1501 C1 In CX
1502 C0
1503 00
1504 DEC CX 49 Decrement CX
1505 JNZ L1 75 Jump on No zero
1506 FD to L1
1507 RET CB Return to main program
1508
SAWTOOTH WAVE
1100 Start MOV Al, 00 C6 Move 00H to AL
1101 C0
1102 00
1103 L1 OUT C0, AL E6 Send it to C0 port
1104 C0
1105 FE Increment AL
1106 C0
1107 JNZ, L1 75 Jump on No zero
1108 FA to L1
1109 JMP, start E9 Jump to start
110A ED
110B FF
TRAINGULAR WAVE
Start MOV BL, 00 Move 00H to BL
L1 MOV AL, BL Move the data from BL to AL
INC BL Increment BL
JNZ BL Jump on No zero to L1
MOV BL, OFF Move OFFH to BL
L2 MOV AL, BL Move the data from BL to AL
OUT C0, AL Send it to C0
DEC BL Decrement BL
JNZ L2 Jump on No zero to L2
JMP start 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. Date:

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 : get the data which indicates the direction of rotation of motor in
destination index
Step 2 : store the count in CL register
Step 3 : get the speed of the motor in AX register
Step 4 : get the data in AL register from DI
Step 5 : send the data through output port
Step 6 : keep decrementing the value in DX register till it becomes zero
Step 7 : increment DI and repeat from step 4
Step 8 : loop till the count becomes zero
Step 9 : 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 Label Mnemonic Opcodes Comments


1010 START MOV DI, 1218H C7 Initialize the
1011 C7 DI with the memory
1012 18 Location
1013 12
1014 MOV CL, 04H C6 Move the count in
1015 C1 CL
1016 04
1017 L2 MOV AL, [DI] 8A Move the data in DI
1018 05 to AL
1019 OUT C0, AL E6 Send the content of
101A C0 AL though the port
101B MOV X, 1010 C7 Move the data
101C C6 in DX
101D 10
101E 10
101F L1 DEC DX 4A Decrement Dx
1020 JNZ L1 75 Jump on No zero
1021 FD to L1
1022 INC DI 47 Increment DI
1023 LOOP L2 E2 Loop to L2 till the
1024 F2 Count becomes zero
1025 JMP START F9 Jump to start.
1026 E8
1027 FF

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. Date:

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


Speed 
4  time delay

Programe Name: DC MOTOR

Address Label Mnemonic Opcodes Comments


1000 MOV AL, OFF C6 Move OFFH to AL
1001 C0
1002 FF
1003 OUT C0, AL E6
1004 C0
1005 MOV AL, 00H C6 Move 00H to AL
1006 C0
1007 00
1008 OUT 00, AL E6
1009 00
100A Call delay E8 Call delay
100B F3
100C 01
100D MOV AL, 30H C6 Move 30H to AL
100E C0
100F 30
1010 OUT, 00, AL E6
1011 00
1012 MOV AL , OFF C6 Move OFF to Al
1013 C0
1014 FF
1015 OUT 00, AL E6
1016 00
1017 MOV AL, 00H C6 Move 00 to AL
1018 C0, 00
1019 OUT D0, AL 06
101A D0
101B CALL DELAY E8 Call delay
101C 0F
101D 01
101E MOV AL, 00 C6 Move 00 to AL
101F C0
1020 00
1021 OUT D8, AL E6
1022 D8
1023 IN AL, C8 E4
1024 C8
1025 MOV SI, 1600 C7 Move 1600H to SI
1026 C6
1027 00
1028 16
1029 MOV [SI] AL 88 Move the data from
102A 04 AL to SI
102B
102C MOV AL, 00 C6, C0 Move 00H to AL
102D 00
102E INC SI 46 Increment SI
102F MOV [SI],. AL 88
1030 04
1031 HLT F4 Terminate the program
1032
DELAY
1033
1034 Delay MOV CL1, 04 C6 Move 04H to CL
1035 C1
1036 04
1037 L2 MOV DX1, FFFF C7 Move OFFFFH to DX
1038 C2
1039 FF
103A FF
103B L1 DEC DX 4A Decrement DX
103C JNZ L1 75 Jump on No zero to L1
103D 70
103E DEC CL FE Decrement CL
103F C9
1040 JNZ L2 75 Jump on No zero to L2
1041 F5
1042 RET C3 Return to main program

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

You might also like