Write a program in ALP to establish Communication between two processors using 8251.
Aim:
Write a program in ALP to establish Communication between two processors using 8251.
Apparatus:
1. ADS-SDA-86-STA kit 2. 8251 Study card 3. Adapter, Keyboard, Cables, Etc . . .
Procedure:
Transmission
1. Connect 8086 kit PC using RS232 cable. 2. Connect Power supply to 8086 kit and 8251 interfacing kit(only blue( 5v) and black(0v) lines Power cable to power supply) 3. Connect 8251 to 8086 using 50pin and 26pin bus. 4. Short 5 & 6 pins of JP9 in 8251 kit 5. Keep the DIP switch in 1 & 7 on (8086kit), open TALK, and go to options select target device as 8086 and Connect. 6. Change dip switch into 1 & 5on, once reset 8086 kit. 7. Go to file →Download hex file 8. G-4000(on system keyboard), we can observe the output on 8251 kit. 9. Remove RS232 cable from 8086kit and connect it to 8251, transmitted data displayed on PC Monitor
Recieving
1. Connect 8086 kit PC using RS232 cable. 2. Connect Power supply to 8086 kit and 8251 interfacing kit (only blue( 5v) and black(0v) lines Power cable to power supply) 3. Connect 8251 to 8086 using 50pin and 26pin bus. 4. Short 1 & 2 pins of JP9 in 8251 kit 5. Keep the DIP switch in 1 & 7 on (8086kit), open TALK, and go to options select target device as 8086 and Connect. 6. Change dip switch into 1 & 5on, once reset 8086 kit. 7. Go to file →Download hex file 8. Change the DIP switch into 1 & 7 on, once reset. 9. Remove RS232 cable from 8086 kit and connect it to 8251. 10. G-4000 (on 8086 kit keyboard) .enter 11. Give some input from system keyboard (Example press A, B, C, D enter),once reset 8086 kit That data will be received at 8086 kit at location FF00 (press E, enter address FF00 and press Comma you will get the ASCII values of A, B, C,D).
Program:
.OUTPUT 2500AD ;PROGRAM TO TEST 8251 TRANSMISSION CLOCK_FREQ EQU 1536000 ;8253 clock frequency CTL_8251 EQU 3402H ;8251 control port address DATA_8251 EQU 3400H ;8251 data port address TMR1_8253 EQU 3002H ;8253 timer1 address CTL_8253 EQU 3006H ;8253 control port address EXT_RAM_LC EQU 0000:FF00H ;RAM location DBDT EQU F800:4F1FH ;routine for display on data field CNT_BAUD_9600_MODE16 EQU 000AH CNT_BAUD_4000_MODE01 EQU 0140H CNT_BAUD_2400_MODE16 EQU 0028H CNT_BAUD_1200_MODE64 EQU 0014H CNT_BAUD_0300_MODE64 EQU 0050H MODE_WORD16 EQU CEH MODE_WORD1 EQU CDH MODE_WORD64 EQU CFH ;With the count calculated for various baud rates program is ;written to test transmission part of 8251 using RS_232 standard ;Data characters can be sent to 8251 on an interrupt basis.So ;to send characters on interrupt basis the TxRDY pin of the ;8251 is connected to an interrupt input through PIC 8259. ;*************************************** ;PROGRAM TO TEST 8251 TRANSMITTING PART. ;*************************************** DSEG SEGMENT ORG 0 : 3000H MSG DB 'TESTING 8251 IN ASYNCHRONOUS MODE',0DH,0AH,1BH DSEG ENDS CSEG SEGMENT ORG 0000 : 4000H ASSUME CS : CSEG, DS : DSEG START: MOV AX, 00H ;initialisation of stack pointer MOV SS, AX MOV SP, 2000H MOV AX, 00H MOV DS, AX CLI CLD MOV BX, 0202H ;initalisation of interrupt vector PUSH CS POP AX MOV [BX], AX MOV BX, 0200H LEA AX, CS : SRVC1 MOV [BX], AX MOV DX, FFD8H ;ICW1 MOV AL, 13H OUT DX, AL MOV DX, FFDAH ;ICW2(interrupt vector address) MOV AL, 80H OUT DX, AL MOV AL, 0FH OUT DX, AL ;ICW4 MOV AL, 0FEH OUT DX, AL ;OCW1(IR0 mask reset) MOV BX, OFFSET MSG ;BX points to message MOV SI, EXT_RAM_LC ;SI points to RAM locations ;where the characters written to 8251 are stored MOV DX, CTL_8253 ;initialise timer1 in mode2 MOV AL, 76H OUT DX, AL MOV DX, TMR1_8253 MOV AL, < CNT_BAUD_9600_MODE16 ;load the LSB count in OUT DX, AL ;timer1 count reg MOV AL, > CNT_BAUD_9600_MODE16 ;load the MSB count in OUT DX, AL ;timer1 count reg STI ;enable interrupt MOV DX, CTL_8251 ;8251 control port address.Send MOV AL, 00H ;0's to guarantee,device is in OUT DX, AL ;the command instruction format. ;Repeat the same four times NOP NOP NOP NOP OUT DX, AL NOP NOP NOP NOP OUT DX, AL MOV DX, CTL_8251 ;send internal reset command MOV AL, 40H ;to return device to idle state OUT DX, AL NOP NOP NOP NOP MOV DX, CTL_8251 ;load the mode control word MOV AL, MODE_WORD16 OUT DX, AL NOP NOP MOV DX, CTL_8251 ;load the command word MOV AL, 33H ;when CTS* input of 8251 is OUT DX, AL ;asserted low and the 8251 buffer NOP ;is ready for a character,the TxRDY NOP ;pin will go high.Since TxRDY pin ;is connected to the interrupt pin,as soon as TxRDY is set INTR ;is enabled and the process jumps to service routine. BACK: NOP JMP BACK SRVC1: MOV AX, 0000H MOV DS, AX MOV AL, [BX] ;message address stored in reg BX ADD BX, 01H ;read the message byte by byte CMP AL, 1BH ;check if the byte is a last byte JNZ AHEAD MOV BX, OFFSET MSG ;if yes reinitialise the pointer MOV SI, EXT_RAM_LC ;to message and RAM location JMP SRVC1 AHEAD: MOV DX, DATA_8251 ;if not send the char to data port OUT DX, AL ;of 8251 & also save in ram location MOV CL, AL MOV AX, 00H MOV DS, AX MOV AL, CL MOV [SI], AL ADD SI, 01H STI IRET ;When the data character is written to 8251 data port the 8251 ;resets its TxRDY o/p until the buffer is again ready to receive ;a character.The process returns from interrupt routine after ;writing data to 8251 and waits until 8251 buffer is ready in ;in the main loop. CSEG ENDS
Result:
The Transmission Of 8251 Is Studied And The Output Is Verified
Viva-voce questions:
1. In how many modes does 8086 microprocessor works? 2. Which port of 8255 is used for handshaking? 3. What are the major steps in key detection? 4. What is the use of look up table? 5. Which register is used to store the address of a port?
-
UpdatedOct 23, 2014
-
Views5,661
Write and execute an alp to 8086 Microprocessor to add, subtract and multiply two 16 bit unsigned numbers. Store the result in extra segment
Write and execute an alp to 8086 Microprocessor to a sort the give array of 32 bit number in ascending and descending order.
Program to generate following waveforms
- Ramp waveform
- Square waveform
- Step waveform
- Triangle waveform
Write and execute an alp to 8086 Microprocessor to find the length of a given string which terminates with a special character
Write and execute an alp to 8086 Microprocessor to divide a 32 bit unsigned numbers by a 16 bit unsigned number. Store the result in stack segment
Interface a stepper motor to 8086 and operate it in clock wise and anticlockwise by choosing variable stepsize.