Interfacing 8086
-
Upload
sunitha-josephine -
Category
Documents
-
view
454 -
download
14
Transcript of Interfacing 8086
INTERFACING 8086 WITH 8255Ex.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 : StartStep 2 : Send the control word to the control registerStep 3 : Send the data for which the LED will glowStep 4 : Stop
CONTROL WORD
D7
D6
D5D4D3D2D1D0
CONTROL WORD
Group BPort C lower 1 – input0 – outputPort B1 – input0 – outputMode:0 – mode 01 – mode 1
Group APort C Upper 1 – input0 – outputPort A1 – input0 – outputMode:00 – mode 001 – mode 110 – mode 2
= 80H
1 – 1/0 mode0 - BSR
1 0 0 0 0 0 0 0
Programe Name: Programming in 8085 (16 – bit addition)
Address Label Mnemonic Opcodes Comments1000 MOV AL, 80H C6 Move the control 1001 C0 Word to AL1002 801003 OUT C6, AL E6 Send the control 1004 C6 Register1005 MOV AL, 54H C6 Move the data1006 C0 54 To AL1007 OUT C2, AL1008 E6 Send toport C21009 C2100A HLT F4 Terminate the program
FLOW CHART
OUTPUTDATA = 54H
S1 S2 S3 S4 S5 S6 S7 S8
0 1 0 1 0 1 0 0OFF ON OFF ON OFF ON OFF OFF
RESULT:Thus the assembly language program to interface 8086 with 8255 was written and
verified.
Start
Send the control word to control register
Send the data for which the LED will glow
Stop
INTERFACING 8255 INPUT PORTS IN MODE 0
PA1
RDCS
RESET
A0
A1
CS
PA0
8255
PB0
PB7
PC0
PC3
PC4
PC1
BUFFER
+5V
LEDS
A15
A1
A0
MEMRMEMW
RESET OUT(8086)
BLOCK DIAGRAM OF 8255
GroupA
PortA
Group A
Port C
Upper
Group A
Port C
Lower
GroupB
PortB
GroupA
PortA
Data bus buffer
GroupB
Control
8 bit internal data bus
Read
Write
Control
Logic
D7 – D0
+5V
Gnd
INTERFACING OF 8254 WITH 8086Ex.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 : StartStep 2 : Send the control word to control registerStep 3 : Send the lower byte of the count through port AStep 4 : Send the upper byte of the count through port AStep 5 : Stop
CONTROL WORD:
SC – SELECT COUNTER M - MODE
SC1 SC0
0 0 Select counter 00 1 Select counter 11 0 Select counter 21 1 Read back command
RW – READ WRITE BCD
RW1 RW0
0 0 Count latch command1 0 Read / write MSB only0 1 Read / write LSB only1 1 Read / write LSB first then MSB
TO SELECT COUNT ‘0’
OUTPUT
SC1 SC0 RW1 RW0 M2 M1 M0 BC0
0 0 1 1 0 1 1 0
M2 M1 M0
0 0 0 Mode 00 0 1 Mode 10 1 0 Mode 2X 1 1 Mode 31 0 0 Mode 41 0 1 Mode 5
0 Binary counter 16 – bits1 Binary coded decimal counter
– 36H
V t
Programe Name: Interfacing of 8253 with 8086
Address Label Mnemonic Opcodes Comments1000 MOV AL, 80H C6 Move the control 1001 C0 Word to AL1002 361003 OUT C6, AL E6 Send the control 1004 CE Register1005 MOV AL, 54H C6 Move the lower byte1006 C0 Of the count to AL1007 OUT C2, AL FF1008 E6 Send the control 1009 C8 Register through C8100A HLT C6 Move the upper 100B C0 Byte of the count to 100C 00 AL100D E6 Send the count100E C8 Through port C8100F FA
RESULT:Thus the assembly language program to interface 8254 with 8086 was written and
verified.
INTERFACING 8086 WITH 8259Ex.No. Date:
AIM:To write an assembly language program to interface 8259 programmable interrupt
controller with 8086.
ALGORITHM :Step 1 : StartStep 2 : Move the different control word to their respective control registerStep 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 addressLT1M - 1 - Level triggered mode
0 - Edge triggered modeAD1 - Call address interval
1 - Interval of 40 - Interval of 8
SNG L - 1 - Single0 - Caocode Mode
IC4 - 1 - IC4 needed0 - Not needed
ICW2A0 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
PM - 1 - 8086 / 8088modeAE01 - 1 - auto EOI, 0 – normal EOISFNM - 1 - Special fully nested mode
0 - not special fully nested mode
OCW1
0 0 0 SFNM BUF M.S AE01 PM
M7 M6 M5 M4 M3 M2 M1 M0
M7 – M0 - eight mask bit
M = 0 channel is enable M = 1 channel is masked
ICW1
ICW2
ICW4
OCW1
Program Name: INTERFACING 8086 WITH 8259
Address Label Mnemonic Opcodes Comments1000 MOV AL, 17H C6 Move 17H to AL1001 C01002 171003 OUT C0, AL E6 Send through port C01004 C01005 MOV, AL, 08 C6 Move 08H to AL1006 C01007 081008 OUT C2, AL E2 Send through port C21009 C2100A MOB AL, OC C6 Move OCH to AL100B C0100C 08100D OUT C2, AL E6 Send through port C2100E C2100F MOV AL, OFE C6 Move OFE to AL1010 C01011 FE1012 OUT C2, AL E6 Send though port C2 1013 C21014 ST1 FB Set interrupt
RESULT:Thus the assembly language program to interface 8259 with 8086 was written and
verified.
0 0 0 1 0 1 1 1
0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1
1 1 1 1 1 1 1 0
17H
08H
01H
FEH
INTERFACING 8086 WITH 8279Ex.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 registerStep 3 : Get the control words to display lettersStep 4 : Send it to the interface through the port AStep 5 : Stop
8279 COMMANDS
i) Keyboard / display mode set0 0 0 D D K K K
DD – Display mode : KKK keyboard mode
D D0 0 8 8 bit Character display Left entry0 1 16 8 bit Character display Left entry1 0 8 8 bit Character display Right entry1 1 16 8 bit Character display Right entry
K K K0 0 0 Encoded scan keyboard 2 key lock kit0 0 1 Decoded scan keyboard 2 Key lock out0 1 0 Encoded scan keyboard N key lock kit0 1 1 Decoded scan keyboard N Key lock out1 0 0 Encoded scan Sensor Matrix1 0 1 Decoded scan Sensor Matrix1 1 0 Stored input encoded Display scan1 1 1 Stored input decoded Display scan
ii) Read FIFO / Sensor RAM
0 1 0 A1 X A A A
iii) Read display RAM
0 1 1 A1 A A A A
iv) Write Display RAM
1 0 0 A1 A A A A
v) Clear Display RAM
1 1 0 CD CD CD CF CA
vi) FIFO Status Word
DU S/E O U F N N N
Auto increment flag
RAM address bits
Address bits of display RAM
0X – All zeros1 0 – AB = Hex 20 (0010 0000)1 1 – All ones
Display unavailable
Sensor Closure / Error flag for multiple closure
Error Over run
Error Under run
FIFO FULL
No. of characters in FIFO
Display / Keyboard mode
Clear Mode
Write display RAM
FIFO Status
Read FIFO
Look – up table for Key board scan:
1200 OC 9F 4A 0B1204 99 29 28 0F1208 08 09 88 38120C 0C 1A 68 E8
Segment Control Word
d c b a dg g f e
Look up table for blinking display1200 98 H1201 68 E1202 7C L1203 C8 P1204 1C U1205 29 S
Look up table for rolling display
0 0 0 1 0 1 1 1
0 0 0 0 1 0 0 0
0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1
1 1 1 1 1 1 1 0
00H
CCH
90H
40H
07H
d
e c
bgf
a
1200 FF1201 FF1202 FF1203 FF1204 FF1205 98 H1206 68 E1207 7C L1208 C8 P1209 FF120A 1C U120B 29 S120C FF120D FF
Programe Name: Interfacing with 8279 (a) Key board Scan
Address Label Mnemonic Opcodes Comments1000 MOV, SI, 1200H C7 Move the data to SI1001 C61002 001003 121004 MOV CX, 0008H C7 Move the count to1005 C1 CX1006 081007 001008 MOV AL, 00H C6 Move the control1009 C0 word to keyboard100A 02 Mode to AL100B OUT C2, AL E6 Send it to100C 02 control register100D MOV AL, OCCH C6 Move the content100E C0 word to clear display100F CC to AL1010 OUT C2, AL E6 Send it to control1011 C2 register1012 MOV AL, 90H C6 Move the control 1013 C0 word to write1014 90 display to AL1015 OUT C2, AL E6 Send it to1016 C2 control register1017 MOV AL, OFFH C6 Move OFFH to AL1018 C01019 FF
101A L1 Out CO, AL E6 Send it through C0101B C2 to point the address101C Loop L1 E2 Loop till the count101D FC is zero101E L2 IN AL, C2 E4 Read the FIFO status101F C2 from C2 port1020 TEST AL, 07 F6 Test the content1021 C0 of AL and 07H
1022 071023 JZ, L2 74 Jump on zero to L2
1024 F91025 Mov AL, 40H C6 Move the control1026 C0 word to read FIFO1027 40 to AL1028 OUT C2, Al E6 Send it to 1029 C2 control register 102A IN AL, C0 E4 Get the data102B C0 from FIFO102C AND Al, OFH 80 AND the content102D F0 Of AL and OFH
101E 0F102F Mov BL, AL 88 Move the content1030 C3 of AL to BL1031 MOV BH, 12H C6 Assign 12H & BH
1032 C71033 121034 MOv AL, [BX] 8A Move the data1035 07 in Bx to AL1036 OUT C0, AL E6 Send it to1037 0C through port C01038 JMP L2 E9 Jump to L2
1039 FC103A FF103B HLT F4 Terminate the program
Programe Name: Interfacing with 8279 (b) Blinking display
Address Label Mnemonic Opcodes Comments1000 Start MOV, SI, 1200H C7 Initialize the 1001 C6 SI with 1200H
1002 001003 121004 MOV AL 000H C6 Move the control word 1005 C0 To AL1006 001007 E6 Send it to control1008 MOV AL, 00H C2 word to AL
1009 C6 Move to control 100A C0 word to AL100B OUT C2, AL CC100C E6 Send it to control100D MOV AL, OCCH C2 register 100E C6 Move the control100F C0 word to AL1010 OUT C2, AL 901011 E6 Send it to control1012 MOV AL, 90H C2 register1013 C7 Initialize the 1014 C1 count in CX1015 OUT C2, AL 061016 001017 L1 MOV AL, OFFH 8A Move the data1018 04 From SI to Al1019 Out CO, AL E6 Send the data101A C0 through port C0101B INC SI 46 Increment SI101C LOOP L1 E2 Loop till the count101D F9 is zero101E L2 Call Delay E8 Call the delay101F DF Program1020 041021 MOV AL, 00H C6 Move the control1022 C0 word to AL1023 001024 OUT C2, AL E6 Send it to control1025 C2 register 1026 MOV AL, OCCH C6 Move the control1027 C0 word to Al1028 CC1029 OUT C2 AL E6 Send it to control102A C2 register 102B MOV AL, 90H C6 Move the control102C C0 word to Al102D 90101E OUT C2 AL E6 Send it to control102F C2 register 1030 MOV CX, 0006 C7 Move the control1031 C1 to CX1032 061033 001034 L2 MOV AL, FF C6 Move the data to 1035 C0 AL1036 Ff1037 OUT C0, AL E6 Send it through1038 C0 port C01039 Loop L2 E2 Loop till to
103A F9 count is zero103B Call Delay E8 Call the delay
C2 program 04
Jmp start E9, BF Jump to startFF
DELAY:1500 Delay Mov Dx, OFFF4 C7 Move the data1501 C7 to DX1502 FF1503 FF1504 DEC DX 4A1505 JNZ L3 75 Jump on NO zero to1506 FD L31507 RET C3 RETURN TO MAIN PROGRAM
Programe Name: Interfacing with 8279 (c) Rolling display
Address Label Mnemonic Opcodes Comments1000 Start Mov SI, 1200 C7 Initialize the SI1001 C6 with 1200H
1002 001003 121004 Mov CX, 000FH C7 Move the count1005 C1 To CX1006 0F1007 001008 Mov, AL, 10H C6 Move the control1009 C0 word to AL100A 10100B OUT C2, AL E6 Send it to control100C C2 register 100D Mov, Al, OCC C6 Move the control 100E 60 word to AL100F CC1010 Out C2, AL E6 Send the control1011 C2 register 1012 MOV, AL, 90H C6 Move the control1013 C0 word to AL1014 901015 OUT C2, AL E6 Send the control1016 C2 register 1017 L1 MOV. AL, [SI] 8A Move the data in SI1018 04 to AL1019 OUT C0, Al E6 Send the data in101A C0 AL through CO
101B Call delay E8 Call delay101C E2 Program101D 04101E INC SI 46 Increment SI101F Loop L1 E2 Loop will the count1020 F6 is zero1021 JMP start E9 Jump to start1022 OC1023 FFDELAY:1500 Mov Dx, OFFFFH C7 Move the count1501 C2 OFFFFH to DX1502 FF1503 FF1504 L2 DEC DX 4A Decrement DX1505 JNZ L2 75 Jump on NO zero to1506 FD L21507 RET C3 Return to main program
RESULT:Thus the assembly language program to interface 8299 with 8086 was written ad
verified.
SERIAL COMMUNICATION OF 8086Ex.No. Date:
AIM:To write an assembly language program to establish serial communication
between two 8086 microprocessor kit.
ALGORITHM:Step 1 : Initialize SI with 1500Step 2 : Send the mode word through port 16Step 3 : Send the command word through port 10Step 4 : Assign the countStep 5 : Read the status whether transmitter is empty or not Step 6 : If transmitter is empty, send the data through port 08 and
increment SIStep 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 5Step 9 : Stop
RECEIVER: Step 1 : Initialize the SI with 1500Step 2 : Assign the respective control word and countStep 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 countStep 5 : On No zero repeat from step 3 else stop.
COMPONENTS REQUIRED:8086 Microprocessor kit, RS 232 Cable
MODE WORD FORMAT:
D7D6 D5 D4 D3 D2 D1 D0 Band rate
00 – SYN mode01 – AGYN x 110 – ASYN x 1611 – ASYN x 64
Character00 – 5 bit01 – 6 bit10 – 7 bit11 – 8 bit
Parity controlX0 – No parity 01 – ODD parity11 – EVEN parity
Framing control
00 – NOT Valid01 – 1 stop bit10 – 1 ½ stop bit
COMMAND WORD FORMAT
EH 1R RTS SBRK RXE DTR TXE
STATUS WORD FORMAT
DSRSYN DET
FE OE PETX
EMPYRX
RDYTX
RDY
MODE WORD
0 0 1 1 0 1 1 0
CONTROL WORD
0 1 0 0 0 0 0 0
STATUS WORD
0 0 0 0 0 1 0 0
0 0 0 0 0 0 1 0
Programe Name: Serial Communication (between two 8086 Microprocessor kit)
=36
=40
=04
=02
OUTPUT:
RECEIVER1500 : 15H
1501 : 20H
1502 : 25H
1503 : 30H
1504 : 35H
TRANSMITTER
Address Label Mnemonic Opcodes Comments1010 MOV SI, 1500H C7 Initialize SI with 1011 C6 15001012 001013 151014 MOV, AL, 36H C6 Move the mode word1015 C0 36 to AL1016 361017 OUT 16, AL E61018 161019 MOV AL, 40H C6 Move the command101A C0 Word 40 to AL101B 40101C OUT 10H, AL E6101D 10101E MOV AL, 01H C6 Move the command101F C0 word 01 to AL1020 011021 OUT 10, AL E61022 101023 MOV CL, 05H C7 Move the count 051024 C1 in CL1025 051026 IN AL, 0AH E4 Read the status1027 0A from port 0A1028 AND AL, 04H 80 Perform AND operation 1029 E0 Between the data in AL102A 04 and 04H102B JNZ check 74 Jump on zero to102C Check102D MOV, AL [SI] 8A Move the data from102E 04 SI to AL102F OUT 08, AL E6 Send the data through1030 08 08 port1031 INC SI 46 Increment SI1032 CMP, AL, 3FH 38 Compare the data on 1033 3F AL and 3FH1034 JNZ reload 75 Jump on No zero1035 to reload1036 DEC CL FE Decrement the 1037 C9 count in CL1038 JNZ check 75 Jump on No zero1039 To check103A HLT F4 Terminate the programRECEIVER
Address Label Mnemonic Opcodes Comments1010 MOV SI, 1500 C7 Initialize SI with 1011 C6 15001012 001013 151014 MOV, AL, 36 C6 Move the controlword1015 C0 36 to AL1016 361017 OUT 16, AL E61018 161019 MOV AL, 40 C6 Move 40H to AL101A C0101B 40101C OUT 10, AL E6101D 10101E MOV AL, 01 C6 Move 01H to AL101F C01020 011021 OUT 10, AL E61022 101023 Reload MOV CL, 05 C7 Move the count 051024 C1 to CL1025 051026 Check IN AL, 0A E4 Read the status1027 0A from port 0A1028 AND AL, 02 80 AND the data in AL1029 E0 and 02102A 02102B JNZ check 74 Jump on zero to102C Check102D MOV, AL [SI] E4 Get the data from 08H102E 08 and store it AL102F OUT 08, AL 8A Move the data in 1030 04 Al to SI1031 INC SI 46 Increment SI1032 CMP, AL, 3FH 38 Compare the data 1033 3F in AL and 3FH1034 JNZ reload 75 Jump on No zero1035 to reload1036 DEC CL FE Decrement CL1037 C91038 JNZ check 75 Jump on No zero1039 To check103A HLT F4 Terminate the programRESULT: 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 transmitterStep 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 receiverStep 6 : Store it in an addressStep 7 : Stop
Programe Name: Parallel communication between two microprocessor
TRANSMITTER
Address Label Mnemonic Opcodes Comments1000 MOV AL, 80H C6 Move the control1001 C0 word to the 1002 80 Accumulator 1003 OUT 26, AL E6 Send it through1004 26 port 261005 MOV AL, 4BH C6 Move the data in AL1006 C01007 4B1008 OUT 20, AL E6 Send the contents of 1009 20 A through port 20100A HLT F4 Terminate the programe
RECEIVER1000 MOV AL, 9BH C6 Move the control1001 C0 word to the al1002 9B1003 OUT 26, AL E6 Send it to control1004 26 register 1005 MOV AL, 4BH E4 Get the data through1006 20 Port 201007 88 Move the content 1008 OUT 20, AL 06 of AL in the
1009 00 Memory location 100A 12100B 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 registerStep 2 : Set the SOC pin highStep 3 : Find whether the conversion is over by checking EOC pinStep 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 Comments1000 MOV AL, 10H C6 Initialize the1001 C0 control word in AL1002 101003 OUT E0, AL E61004 E01005 MOV AL, 18H C6 Move the control1006 C0 word 18 to AL1007 181008 OUT E0, AL E61009 E0100A MOV AL, 01 C6 Move 01 to AL100B C0100C 01100D OUT DO, AL E6100E D0100F MOV AL, 00 C6 Move 00 to AL1010 C01011 001012 OUT DO, AL E61013 D01014 L1 IN AL, D8 E4 Read the EOC pin1015 08 status 1016 AND AL, 01 80 Perform AND operation1017 E0 between the data in 1018 01 AL and 01H1019 CMP AL, 07 80 Compare the101A E8 Immediate data 01101B 01 With data in AL101C JNZ, L1 75 Jump on No zero
101D F6 to L7101E IN AL, C8 E4 Get the digital101F C8 output from port C81020 MOV [1500], AL 88 Move the data1021 06 in AL to the 1022 00 Specified address1023 151024 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 delayStep 2 : send high value to DAC and call delayStep 3 : repeat from step 1Step 4 : stop
TRIANGULAR WAVE:Step 1 : send low value from BL to DACStep 2 : increment the value in BLStep 3 : if BL is not zero, repeat from step 1 else move high value to BL
RegisterStep 4 : send high value in BLStep 5 : decrement the value in BLStep 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 DACStep 2 : increment AL and send it to DAC, repeat from step 2 till it is not
ZeroStep 3 : go to step 1
Programe Name: Interfacing DAC with 8086
Address Label Mnemonic Opcodes Comments1000 Start MOV AL, 00 C6 Move the low value1001 C0 00H to AL1002 001003 OUT C0, AL E61004 C01005 Call delay E8 Call the delay program1006 F81007 041008 MOV Al, OFF C6 Move the high 1009 C0 Value FFH to AL100A FF100B OUT C0, AL E6100C C0100D Call delay E8 Call the delay program
100E F0100F 041010 JMO Start E9, ED, FF Jump to startDELAY1500 Delay MOV CX, 00C0 C7 Move the count1501 C1 In CX1502 C01503 001504 DEC CX 49 Decrement CX
1505 JNZ L1 75 Jump on No zero1506 FD to L11507 RET CB Return to main program1508SAWTOOTH WAVE1100 Start MOV Al, 00 C6 Move 00H to AL1101 C01102 001103 L1 OUT C0, AL E6 Send it to C0 port1104 C01105 FE Increment AL1106 C01107 JNZ, L1 75 Jump on No zero1108 FA to L11109 JMP, start E9 Jump to start110A ED110B FFTRAINGULAR WAVE
Start MOV BL, 00 Move 00H to BLL1 MOV AL, BL Move the data from BL to AL
INC BL Increment BLJNZ BL Jump on No zero to L1MOV BL, OFF Move OFFH to BL
L2 MOV AL, BL Move the data from BL to ALOUT C0, AL Send it to C0DEC BL Decrement BLJNZ L2 Jump on No zero to L2JMP 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
ALGORITHMStep 1 : get the data which indicates the direction of rotation of motor in
destination indexStep 2 : store the count in CL registerStep 3 : get the speed of the motor in AX registerStep 4 : get the data in AL register from DIStep 5 : send the data through output portStep 6 : keep decrementing the value in DX register till it becomes zeroStep 7 : increment DI and repeat from step 4Step 8 : loop till the count becomes zeroStep 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 Comments1010 START MOV DI, 1218H C7 Initialize the1011 C7 DI with the memory1012 18 Location1013 121014 MOV CL, 04H C6 Move the count in1015 C1 CL1016 041017 L2 MOV AL, [DI] 8A Move the data in DI1018 05 to AL1019 OUT C0, AL E6 Send the content of
101A C0 AL though the port101B MOV X, 1010 C7 Move the data101C C6 in DX
101D 10101E 10101F L1 DEC DX 4A Decrement Dx1020 JNZ L1 75 Jump on No zero1021 FD to L11022 INC DI 47 Increment DI1023 LOOP L2 E2 Loop to L2 till the1024 F2 Count becomes zero1025 JMP START F9 Jump to start.1026 E81027 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 : StartStep 2 : Set the high value for DAC to make activeStep 3 : Make the gate signal low for 8253 to be low and call the delayStep 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 lowStep 6 : Store the lower byte and upper byte of the count to different
AddressesStep 7 : In delay move the high value to register and it is decrement until
each on set the zero flag according to the loopStep 8 : Stop
SPEED CALACULATION
Programe Name: DC MOTOR
Address Label Mnemonic Opcodes Comments1000 MOV AL, OFF C6 Move OFFH to AL1001 C01002 FF1003 OUT C0, AL E61004 C01005 MOV AL, 00H C6 Move 00H to AL1006 C01007 001008 OUT 00, AL E61009 00100A Call delay E8 Call delay100B F3100C 01
100D MOV AL, 30H C6 Move 30H to AL100E C0100F 301010 OUT, 00, AL E61011 001012 MOV AL , OFF C6 Move OFF to Al1013 C01014 FF1015 OUT 00, AL E61016 001017 MOV AL, 00H C6 Move 00 to AL1018 C0, 001019 OUT D0, AL 06101A D0101B CALL DELAY E8 Call delay101C 0F101D 01101E MOV AL, 00 C6 Move 00 to AL101F C01020 001021 OUT D8, AL E61022 D81023 IN AL, C8 E41024 C81025 MOV SI, 1600 C7 Move 1600H to SI1026 C61027 001028 161029 MOV [SI] AL 88 Move the data from102A 04 AL to SI102B102C MOV AL, 00 C6, C0 Move 00H to AL102D 00102E INC SI 46 Increment SI102F MOV [SI],. AL 881030 041031 HLT F4 Terminate the program1032DELAY10331034 Delay MOV CL1, 04 C6 Move 04H to CL1035 C11036 041037 L2 MOV DX1, FFFF C7 Move OFFFFH to DX1038 C21039 FF103A FF103B L1 DEC DX 4A Decrement DX
103C JNZ L1 75 Jump on No zero to L1
103D 70103E DEC CL FE Decrement CL103F C91040 JNZ L2 75 Jump on No zero to L21041 F51042 RET C3 Return to main program
RESULT:Thus the assembly language program to control a DC motor was written and
verified.