View the step-by-step solution to:

# LEDs DAC lcd_cmd lcd_st lcd_wr lcd_rd ORG equ equ equ equ equ equ p1 0600h 0800h 0801h 0802h 0803h ;LEDs on port 1 ;DAC mapped at address 0600h...

8051 Laboratory Series

COURSEWORK – Digital Volt Meter (DVM) Display

1. Lab 7 – Task 5 was to create the assembly code to make a Digital Volt Meter that displays the message and the correct voltage on the LCD. Once you managed to display the hex value for the conversion you were required to convert this to an actual voltage reading in decimal.

255 = 5volts
therefore
1 bit = 5/255 = 19.6 mV.

The display should be accurate to +/- 2 mV
(7 Marks)

2. The LEDs should also display the rounded percentage of the full scale output. Since there are 8 LEDs each one represents 12.5%. However, since we want the rounded percentage the LED on the LSB should be illuminated if the voltage is above 6.25% (312mV) and the next LED should illuminated if the voltage is above 18.75% (937mV) etc….
(3 Marks)

3. Alter the brightness of the most significant illuminated LED to represent voltages between the ranges so that if the value is half way between the range then the LED should be 50% brightness. This can be achieved by using Pulse Width Modulation (PWM) ie. Turn the LED ON for 50% of the time and OFF for 50% of the time will.
(3 Marks)

4. The code should set the RS232 serial port to 19200 baud rate and output the voltage value so that it is displayed on hyperterminal. The display should be refreshed every 100ms
(3 Marks)

5. Create FLOWCHARTS for the above.
(4 Marks)

inc dptr ;point to next byte in string jz str_end ;if 0 then end of string mov R1, #(lcd_wr AND 255) ;Load R1 with wr_data address movx @R1, a ;Write char to LCD sjmp nxt_char ;get next char in string str_end: ret lcd_busy: mov R1, #(lcd_st AND 255) ;Load R1 with status address movx a, @R1 ;read LCD status jb acc.7, lcd_busy ;keep checking until busy bit clear ret mesg1: db "DVM Prog ",0 mesg2: db "Voltage = ",0 ;sending mesg1 and 2 to LCD print_hex4: PUSH ACC SWAP A ACALL put_nibble4 POP ACC put_nibble4: ANL A, #0Fh ADD A, #-10 ;processor cannot directly compare to a ; constant so we'll use subtraction instead JNC phex_n ADD A, #7 phex_n: ADD A, #'0'+10 ;+10 is added since storing a value before ;comparison and restoring it would be less effective char_from_Acc: AJMP char_from_Acc end

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

### -

Educational Resources
• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents