Lab 7F BCD and Ascii Conversion in C: Lab Manual For "The 8051 Microcontroller "
Lab 7F BCD and Ascii Conversion in C: Lab Manual For "The 8051 Microcontroller "
ACTIVITY 1
Write a program to get a byte of packed BCD from DIP switches
connected to P1 and display the result on LEDs of P2 with 4-second delay in
between each ASCII showing. Run the program to verify it works.
ACTIVITY 2
Modify the program in Activity 1 to sound the buzzer if the input value
on DIP switches are not packed BCD ($00-$99). That means, it will convert
only the BCD data and displays ASCII numbers on LEDs and if the input data
is not packed BCD (e.g. 10011111 binary) it will sound the buzzer and LEDs
will have all zeros.
ACTIVITY 3
Write a program to convert two ASCII numbers to a packed BCD and
display the BCD result on LEDs of PORTB. Run the program to verify it works.
unsigned char ascii_1= 0x39;
unsigned char ascii_2=0x37;
LAB 7F
WORKSHEET
Name:
Date:
Class:
in hex
in hex
in hex
in hex