Digital Voltmeter

-->

Devise a polling-based solution to measure potantiometer voltage and show the result in decimal form over two 7-segment displays via 8051, ADC and potantiometer.

Simulasyon:

http://www.youtube.com/watch?v=QuGonT2EImY

ASM Code:

;p2.6=WR (start conversion needs to L-to-H pulse)
;p2.7 When low, end-of-conversion)
;p2.5=RD (a H-to-L will read the data from ADC chip)
;p1.0 – P1.7= D0 - D7 of the ADC804
;
MOV P1,#0FFH ; make P1 = input
BACK: CLR P2.6 ;WR = 0
SETB P2.6 ;WR = 1 L-to-H to start conversion
HERE: JB P2.7,HERE ;wait for end of conversion
CLR P2.5 ;conversion finished, enable RD
MOV A,P1 ;read the data
ACALL CONVERSION ;hex-to-ASCII conversion


SETB p2.5 ;make RD=1 for next round
SJMP BACK

CONVERSION:
MOV B, #5
DIV AB
MOV B,#10 ; Assign decimal 10 to b register
DIV AB ; In order to find tenths divide A to 10 which is B
CALL LOOK_UP ; Go to LOOKUP
MOV P0,A ; Send A to P0 first output for 7-segment 1.
MOV A,B
CALL LOOK_UP
MOV P3,A ; Send A to P3 first output for 7-segment 2.
JMP HERE
LOOK_UP:
INC A ; In order to skip RET increment A.
MOVC A, @A+PC ; Go to A’s address in lookup table.
RET
TABLE: DB 129
DB 183
DB 194
DB 146
DB 180
DB 152
DB 136
DB 179
DB 128
DB 144
END

3 responses to “Digital Voltmeter”

  1. tekin bicer says:

    TRT kivaminda olmus; gorunce yuzum guldu.. Devre semasi ve elemanlarini yazi ve resimlerle anlatirsan daha iyi olacagini dusunuyorum. kolay gelsin :)

  2. çağdaş says:

    :) vay be… biz neler yapmışız :D

  3. emrah says:

    Gün Karagöz kardeşim rastgelmiş, sağolasın göndermiş, ünlü olmuşuz :D http://voltmeter.shopogre.com/?p=102