Kod: Zaznacz cały
$regfile = "m8535.dat"
$crystal = 16000000
Config Lcdpin = Pin , Db4 = Pinc.2 , Db5 = Pinc.3 , Db6 = Pinc.4 , Db7 = Pinc.5 , E = Pinc.1 , Rs = Pinc.0
Config Lcd = 16 * 2
Config Porta = Input
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Config Pind.7 = Output
Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down
Enable Interrupts
Start Adc
Dim _in As Word
Dim _out As Word
Dim _out_trans As Single
Dim A As Single
Dim B As Single
A = 0.004853515625
Cls
Pwm1a = 850
Do
_in = Getadc(0)
B = _in * 0.004853515625
_out = Pwm1a
_out_trans = _out * A
Cls
Lcd B ; "V in "
Lowerline
Lcd _out_trans ; "V out"
Toggle Portd.7
Waitms 50
Loop