Q.12) a) Write short note on serial communication of 8051. [4M]
Solution:- Computer transfer data into two ways:-
Parallel & serial, In serial communication, the data is sent one bit at a time, a contrast to parallel communication, in which the data is sent a byte or more at a time but for long distance, always serial communication is used.
The 8051 has serial communication capability built into it. For serial data communication to work, the byte of data must be converted to serial bits using a parallel-in serial-out shift register: then it can be transmitted over a single data line. This also means that at the receiving end there must be a serial-in parallel-out shift register to receive the serial data and pack them in to a byte.
If the data is to be transferred on the telephone line, it must be converted from 0’s and 1’s to audio tones, which are sinusoidal signals. This conversion is performed by a peripheral device called a modem, which stands for ‘modular/demodulator”.
Serial communication uses two methods, asynchronous and synchronous. The synchronous method transfer a block of data at a time while the asynchronous transfers a single byte at a time.
b) Write 8051 ALP to transmit message “YEAR 2018” serially at baud rate of 9600 Assume oscillator frequency 11.0592 MHz. [6M]
Solution:-
c) Explain interfacing of 4×4 keyboard matrix with 8051. [4M]
Solution:- Assume that display codes of keys are present from 5000 H in external RAM
MOV P2, # 0FF H
ERROR: MOV P1, # 00H
L1: MOV A,P2
ANL A, # OF H
CJNE A,# OF H,L1
L3: MOV A, P2
ANL A, # OF H
CJNE A, # OF H,L2
SJMP L3
L2: ACALL DELAY ; Debounce delay
MOV A, P2
ANL A, 0 F H
CJNE A, # O F H,L4
SJMP L3
L4: MOV DPTR, #5000H
MOV RO, # 04 # ; Column counter
MOV B, # 1111111 0B : data to ground coloumns.
NEXT_COL: MOV A, B
MOV P1, A
RL A
MOV B,A
MOV R1, #04 ; Row counter
MOV A,P2
NEXT_ROW: RRC A
JNB PSW.7, No_KEY
Matrix A, @ DPTR
MOV P0, A ; Display the key
SJMP TERMIT
NO-KEY : INC DPTR
DJNZ R1, NEXT_ROW
DJNZ R0, NEXT_COL
SJMP ERROR
TERMIT : END