MICRO CONTROLLER PROGRAMMING & APPLICATIONS
1. Write a program using 8051 assembly language to change the data 55h stored in the lower byte of the data pointer register to AAH using rotate instruction?
MOV A,DPL RL A
LABEL : SJMP Label
2. Explain the contents of the accumulator after the execution of the following program segments?
MOV R4,#66H ANL A,R4
A 3C R4 66
3. Write a program to load accumulator a,DPH and DPL with 30H?
MOV DPH,A MOV DPL,A
4. Write a program to perform multiplication of 2 nos using 8051?
MOV A,#data 1 MOV B,#data 2
MOV @DPTR,A(lower value) INC DPTR
5. Write a program to mask the 0th &7th bit using 8051?
MOVX @DPTR,A LOOP SJMP LOOP
6. Write about CALL statement in 8051?
There are two subroutine C A L L instructions. They are
ü LCALL(Long CALL)
ü ACALL(Absolute CALL)
Each increments the pc to the 1st byte of the instruction & pushes them in to the stack.
7. Write about the jump statement?
There are three forms of jump. They are
ü LJMP(Long-jump)-address 16
ü AJMP(Absolute jump)-address 11
ü Sjmp(short jump)-relative address
8. Write a program to load accumulator DPH & DPL using 8051?
MOV DPH,A MOV DPL,A
9. Write a program to find 2’s complement using 8051?
CPL A INC A
10. Write a program to add two 8-bit numbers using 8051?
MOV A,#30H ADD A,#50H
11. Write a program to swap two numbers using 8051?
12. Write a program to subtract two 8-bit numbers & exchange the digits using 8051?
MOV A,#9F MOV R0,#40 SUBB A,R0
13. Write a program to subtract the contents of R1 of bank 0from the contents of R0 of bank 2 using 8051?
14. Explain the operating mode0 of 8051 serial ports?
In this mode serial enters & exits through RXD,TXD output the shift clock 8 bits are transmitted or received 8 data bits(LSB first).the baud rate is fixed at 1/12 the oscillator frequency.
15. Explain the operating mode2 of 8051 serial ports?
In this mode 11 bits are transmitted (through TXD)or received(through RXD)A start
bit(0),8 data bits(LSB first),a programmable 9th data bit & a stop bit(1) ON transmit the 9th data bit(TB*in SCON) can be assigned the value of 0 or 1.or for eg: the parity bit(p,in the PSW) could be
moved into TB8. On receive the 9th data bit go in to the RB8 in special function register SCON, while the stop bit is ignored. The baud rate is programmable to either 1/32 or 1/64 the oscillator frequency.
16. Explain the mode3 of 8051 serial ports?
In this mode 11 bits are transmitted(through TXD)or received(through RXD): a start
bit(0).8 data bits(LSB first), a programmable 9th data bit,& a stop bit(1).in fact, mode3 is the same as mode2 in all respects except the baud rate. the baud rate in mode3 is variable.in all the four modes, transmission is initiated by any instruction that uses SBUF as a destination register. Reception is initiated by any instruction that uses SBUF as a destination register. Reception is initiated in mode0 by the condition R1=0 & REN=1.reception is initiated in other modes by the incoming start bit if REN-1.
17. What are the tasks involved in keyboard interfacing?
The task involved in keyboard interfacing are sensing a keyboard interfacing are sensing a key actuation, de bouncing the key and generating key codes(decoding the key).these task are performed software if the keyboard is interfaced through ports and they are performed by hardware if the keyboard is interfaced through 8279.
18. How a keyboard matrix is formed in keyboard interface?
The return lines RL0 to RL7 of 8279 are used to form the columns of keyboard matrix.in decoded scan the scan lines SLO to SL3 of 8279 are used to form the rows of keyboard matrix. In encoded scan mode, the output lines of external decoder are used as rows of keyboard matrix.
19. What is scanning in keyboard and what is scan time?
The process of sending a zero to each row of a keyboard matrix and reading the columns for key actuation is called scanning. The scan time is the time taken by the processor to scan all the rows one by one starting from first row and coming back to the first row.
20. What is scanning in display and what is the scan time?
In display devices the process of sending display codes to 7-segment LED’S to display the led’s one by one is called scanning. The scan time is the time taken to display all the 7- segment LED’S one by one, starting from first LED and coming back to the first LED again.
21. Give some ex of input devices to microprocessor-based systems
The input devices used in the microprocessor- based system are keyboards, DIP switches ADC, floppy disc, etc.