Monday 29 February 2016

HARDWARE INTERFACING

8251 Interfacing with 8086 :

 

                 The 8251 is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication. As a peripheral device of a microcomputer system,
   the 8251 receives parallel data from the CPU and transmits serial data after conversion. This device also receives serial data from the outside and transmits parallel data to the CPU after conversion.


fig.8251 Block Diagram

PIN Diagram of 8251 :

 As shown in below pin diagram of 8251,


fig.IC 8251

 

Control Words :

There are two types of control word.
1. Mode instruction (setting of function)
2. Command (setting of operation)

1) Mode Instruction :


Mode instruction is used for setting the function of the 8251. Mode instruction will be in "wait for write" at either internal reset or external reset. That is, the writing of a control word after resetting will be recognized as a "mode instruction." 
Items set by mode instruction are as follows:
• Synchronous/asynchronous mode
• Stop bit length (asynchronous mode)
• Character length
• Parity bit
• Baud rate factor (asynchronous mode)
• Internal/external synchronization (synchronous mode)
• Number of synchronous characters (Synchronous mode)




2) Command :


Command is used for setting the operation of the 8251. It is possible to write a command whenever necessary after writing a mode instruction and sync characters.
Items to be set by command are as follows:
• Transmit Enable/Disable
• Receive Enable/Disable
• DTR, RTS Output of data.
• Resetting of error flag.
• Sending to break characters
• Internal resetting
• Hunt mode (synchronous mode)

PROGRAM :

I) Byte Transfer : 

 

 

Dyna-86>A 3000
0000:3000  MOV AL,4D
0000:3002  OUT 31,AL
0000:3004  OUT 39,AL
0000:3006  MOV AL,27
0000:3008  OUT 31,AL
0000:300A  OUT 39,AL
0000:300C  MOV AL,59
0000:300E  OUT 30,AL
0000:3010  IN AL,39
0000:3012  TEST AL,02
0000:3014  JZ 3010
0000:3016  IN AL,38
0000:3018  MOV BL,AL
0000:301A  INT 3

 

 

 

II) Block Transfer :

Dyna-86>A 5000
0000:5000  MOV AL,4D
0000:5002  OUT 31,AL
0000:5004  OUT 29,AL
0000:5006  MOV AL,27
0000:5008  OUT 31,AL
0000:500A  OUT 29,AL
0000:500C  MOV SI,6000
0000:500F  MOV DI,8000
0000:5012  MOV CL,[SI]
0000:5014  INC SI
0000:5015  MOV AL,[SI]
0000:5017  OUT 30,AL
0000:5019  IN AL,29
0000:501B  TEST AL,02
0000:501D  JZ 5019
0000:501F  IN AL,28
0000:5021  MOV [DI],AL
0000:5023  INC SI
0000:5024  INC DI
0000:5025  DEC CL
0000:5027  JNZ 5015
0000:5029  INT 3

 

 


No comments:

Post a Comment