این برنامه منه ولی روی LCD خیلی رپیل داریم و رقم یکان یا دهگان ثابت نمیشه.از همه روش های نویز گیری سخت افزاری استفاده کردم ولی بازم ریپل داره:
$regfile = "M8def.dat"
$crystal = 1000000
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portb.2 , Db5 = Portb.3 , Db6 = Portb.4 , Db7 = Portb.5 , E = Portb.1 , Rs = Portb.0
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Dim B As Word , Volt As Single
Cursor Off
Cls
Do
'-----------------------------------------------
Start Adc
B = Getadc(0)
Stop Adc
Waitms 100
B = B + 1
Volt = B * 0.55
Home
Lcd "Volt = " ; Fusing(volt , "##.#"
; " [v] "
Lowerline
Lcd B ; " "
'-----------------------------------------------
Loop
End
$crystal = 1000000
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portb.2 , Db5 = Portb.3 , Db6 = Portb.4 , Db7 = Portb.5 , E = Portb.1 , Rs = Portb.0
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Dim B As Word , Volt As Single
Cursor Off
Cls
Do
'-----------------------------------------------
Start Adc
B = Getadc(0)
Stop Adc
Waitms 100
B = B + 1
Volt = B * 0.55
Home
Lcd "Volt = " ; Fusing(volt , "##.#"

Lowerline
Lcd B ; " "
'-----------------------------------------------
Loop
End
دیدگاه