Académique Documents
Professionnel Documents
Culture Documents
: 4
School of Electronics Engineering
VIT, Vellore
Reg.No 17bec0088
L53+L54,
Course Code ECE3003 Slot & Semester
FALL ~2019-20
Date of
Date of Exp. 18/10/2019
Submission
Faculty A.Karthikeyan
Submission:
Mail Id :akece3003e1tt724@gmail.com , akece3003e2tt724@gmail.com
Mail Subject : REG.Number_L__+L__FALL_19_20
File Name and format : Reg.number.docx (doc) - only
MAIL YOUR, DIGITAL ASSIGNMENT , LAB PROGRAMS TO THE ABOVE SAID MAIL ID
And also LOAD YOUR DOCUMENTS BEFORE THE DEAD LINE ON THE INTRANET
Reg no: Fall 2019-20 ECE3003 - 𝜇C and its applications
Question
1. Write an 8051 assembly program to transfer data serially at baud rate 9600 with 8 bit
data, one stop bit and observe the transmitted data in the serial window of the
simulator.
2. Write a 8051 Assembly Language program to get data from the PC and display it on P1.
Assume 8051 is connected to PC and observe the incoming characters. As you press a
key on the PC's keyboard, the character is sent to the 8051 serially at 4800 baud rate
and is displayed on LEDs. The characters displayed on LEDs are in ASCII (binary).
Assume that the 8051 serial port is connected to the COM port of IBM PC, P1 and P2 of
the 8051 are connected to LEDs and switches, respectively.
3. Write an 8051 assembly program to (a) send to PC the message “We Are Ready”, (b)
receive any data send by PC and put it on LEDs connected to P1, and (c) get data on
switches connected to P2 and send it to PC serially.
4. Write an 8051 program to get data from port P0 and send it to port P1 continuously
while an interrupt will do the following: Timer 0 will toggle the P2.1 bit every 100
microseconds.
5. Write an 8051 program to get data from a single bit of P1.2 and send it to P1.7
continuously while an interrupt will do the following: A serial interrupt service routine
will receive data from a PC and display it on P2 ports.
6. Write a program using interrupts to do the following: (a) Receive data serially and sent
it to P0,(b) Have P1 port read and transmitted serially, and a copy given to P2, (c) Make
timer 0 generate a square wave of 5kHz frequency on P3.2.Assume that XTAL-11.0592.
Set the baud rate at 4800.
Write an 8051 assembly program to transfer data serially at baud rate 9600 with 8 bit data, one
stop bit and observe the transmitted data in the serial window of the simulator
Aim: To write an 8051 ALP TO transfer data serially into the serial window of the simulator,
with a baud rate of 9600 and to observe the transmitted data in the serial window of the
simulator. We use timer 1 mode 2
Tools Required: keil Uvision software
Algorithm:
1. Configure the TMOD register
2. load baud rate into the TH1 register
3. set SCON register
4. get data from ROM
5. set SBUF register
SENSE, VIT Page 2 of
20
Reg no: Fall 2019-20 ECE3003 - 𝜇C and its applications
Program:
Memory Label Mnemonics Operands addressing Machine Memory Type of Comments Flags
mode used cycle Byte Instruction getting
Address
Required Required affected by
the
Instruction.
ation is not
zero
Manual Calculation :
Delay time = 16*1.085*10^-6 = 1.736*10^-5 s
Inferences:
1. The data transferred serially with baud rate 9600 and transmitted data in the serial window of
Result: the 8051 ALP to transfer data serially at baud rate 9600 and the transmitted data in
the serial window of the simulator is examined using KEIL software and results are verified
manually.
Write an 8051 program to get data from a single bit of P1.2 and send it to P1.7 continuously while
an interrupt will do the following: A serial interrupt service routine will receive data from a PC
and display it on P2 ports.
Aim: To receive data from single bit p1.2and display it on P1.7 while a serial interrupt receives
data from PC and display it on p2 port.
Tools Required: keil uVision software
Algorithm:
STEP1: organize memory at serial interrupt vector table.
STEP2: organise memory at 30h after the vector table address.
STEP3: make p1.2 as input port to read input.
STEP4: load TMOD value with #20H(timer 1 in mode 2).
STEP5: set baud rate of 9600.
STEP6: load SCON WITH 50H (one stop bit and start bit).
STEP7: load IE register with #10010000B (serial interrupt enabled).
STEP8: start timer 1.
STEP9: copy P1.2 input to carry flag.
STEP10: copy that value from flag to P1.7.
STEP11: end
Program:
Memory Label Mnemonic Operands addressing mode Memory Byte Time taken
s used Required
Address
ORG 0000H
ORG 0023H
ORG 0030H
SETB TR1 2 2
CLR RI 2 1
RETI 1 2
TRANS CLR TI 2 1
RETI 1 2
END
Manual Calculation :
Delay time = 26*1.085*10^-6 = 2.821*10^-5
SENSE, VIT Page 7 of
20
Reg no: Fall 2019-20 ECE3003 - 𝜇C and its applications
Inferences:
1. We observe that data is serially transferring from PC to P2 and p1.7 changes its according to the
change in p1.2
Result: we are serially receiving information from pc and display it on P2 and copying data from
P1.2 to P1.7 is executed using keil software.
4.Write an 8051 program to get data from port P0 and send it to port P1 continuously while an
interrupt will do the following: Timer 0 will toggle the P2.1 bit every 100 microseconds.
Aim: To write an assembly program that generates a square wave with 100usec duration
and to receive data from p0 and send it to p1 using interrupts
Tools Required: keil uVision software
Algorithm:
STEP1: write the interrupt code to toggle P2.1 in the interrupt vector table.
STEP2: organise memory at 30h after the vector table address.
STEP3: load TMOD value with #02H(timer 0 in mode 2).
Program:
Memory Label Mnemonics Operands addressing mode Machine cycle Time taken
used Required
Address
ORG 0000H
ORG 000BH
CPL P2.1 2 1
RETI 1 2
ORG 0030H
SETB TR0 2 2
MOV P1,A 2 1
Manual Calculation :
Delay time = 12*1.085*10^-6 = 1.302*10^-5 s
Inferences:
1.We can observe in the logic analyser that a square wave is generated by toggling p2.1 and the data
Result: we toggled the P2.1 as an interrupt program while data is transferred from p0 to p1 is
observed in the keil software.
Write a program using interrupts to do the following: (a) Receive data serially and sent it to P0,(b)
Have P1 port read and transmitted serially, and a copy given to P2, (c) Make timer 0 generate a
square wave of 5kHz frequency on P3.2.Assume that XTAL-11.0592. Set the baud rate at 4800.
Aim: To receive data serially and send it to P0 and generate a square wave of frequency of 5kz
and also make P1 read port and copy to P2.
Tools Required: keiluVision software
Algorithm:
STEP1: write code for timer0 interrupt vector table.
STEP2: organise memory at serial interrupt vector table.
STEP3: organise memory at 30h after the vector table address.
STEP4: make P1 as input ports.
SENSE, VIT Page 12 of
20
Reg no: Fall 2019-20 ECE3003 - 𝜇C and its applications
STEP5: load TMOD value with #20H(timer 1 in mode 2). STEP6: set baud rate of 4800.
STEP7: load SCON WITH 50H (one stop bit and start bit).
STEP8: load IE register with #10010010B (serial interrupt enabled).
STEP9: load TH0 with #66H
STEP10: start timer 1 and start timer 0.
STEP11: read P1 and transform serially.
STEP12: return interrupt
STEP13:end
Program:
1 ORG 0000H
3 ORG 0023H
5 ORG 0030H
11 SETB TR1 2 2
12 SETB TR0 2 1
17 SERIAL JB TI,TRANS 3 2
18 MOV A,SBUF 2 1
20 CLR RI 2 1
21 RETI 1 2
22 TRANS CLR TI 2 1
23 RETI 1 2
24 END
Manual Calculation :
Delay time = 35*1.085*10^-6 = 3.7975*10^-5 s
Inferences:
1. We can observe the 5khz square wave generated by continuously toggling of P3.2 using interrupt
programing and data is transmitted serially from PC to P0 and P2 changes it values according to p1
Result: The 8051 ALP to perform all the above tasks in one program is executed using keil
software and the results are verified manually.
Write an 8051 assembly program to (a) send to PC the message “We Are Ready”, (b) receive any
data send by PC and put it on LEDs connected to P1, and (c) get data on switches connected to P2
and send it to PC serially
Aim: to send the PC data and send by pc to led connected to p1 and switches to p2 and pc serially
Tools Required
Algorithm:
1. Configure the TMOD register
2. Load baud rate into the TH1 register
3. Set SCON register
4. Start the timer
5. Get data from ROM
6. Set SBUF register
7. Jump when Transmit interrupt flag turns ‘1’
8. Reset the baud rate into the TH1 register
9. Set SCON register
10. Start the timer
11. Jump when receive interrupt is ‘1’
12. Move data from SBUF to P1
13. Clear receive interrupt
14. Reset the baud rate into the TH1 register
15. Set SCON register
16. Start the timer
17. Turn P1.2 into an input port and receive the data
18. Move the data to SBUF register
19. Jump when transfer interrupt is ‘1’
Program:
Manual Calculation :
Delay time = 0.000066081 sec
Inferences:
The message was sent to the PC and observed in the UART. The 8051 received data from the PC and
Result: The 8051 alp to send message to the PC and to receive data from PC and to put it on P1 is
executed by keil software and results are verified manually.
2…Write a 8051 Assembly Language program to get data from the PC and display it on P1.
Assume 8051 is connected to PC and observe the incoming characters. As you press a key
on the PC's keyboard, the character is sent to the 8051 serially at 4800 baud rate and is
displayed on LEDs. The characters displayed on LEDs are in ASCII (binary).
Assume that the 8051 serial port is connected to the COM port of IBM PC, P1 and P2 of the
8051 are connected to LEDs and switches, respectively.
Aim: to perform that the 8051 serial port is connected to the COM port of IBM PC, P1 and
P2 of the 8051 are connected to LEDs and switches, respectively.