$crystal = 16000000
$hwstack = 32
$regfile = "m32def.dat"
$swstack = 10
$framesize = 40
'$baud = 9600
'$sim
Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down , Prescale = 1024
Config Lcdpin = Pin , Db7 = Portc.2 , Db6 = Portc.3 , Db5 = Portc.4 , Db4 = Portc.5 , E = Portc.6 , Rs = Portc.7
Config Lcd = 20 * 4
Cursor Off Noblink
'Config Adc = Single , Prescaler = Auto
'Stop Adc
'Config Sda = Portc.1
'Config Scl = Portc.0
'Config Clock = User
'Config Date = Dmy , Separator = /
'Dim _date As Byte
'Dim Ds1307w As Byte
'Dim Ds1307r As Byte
'Dim Weekday As Byte
'Ds1307w = &B11010000
'Ds1307r = &B11010001
'Declare Sub Max189
'Declare Sub L298
Ss Alias Portb.1
Ss1 Alias Portb.3
Dout Alias Pinb.2
Dout1 Alias Pind.2
Clock Alias Portb.0
'Clock1 Alias Porta.0
Config Ss = Output
Config Portd.6 = Output
Config Portd.4 = Output
Config Portd.5 = Output
Config Portd.3 = Output
'Config Pind.2 = Input
Config Pinb.4 = Input
Config Pinb.5 = Input
Config Pinb.6 = Input
Config Pinb.7 = Input
Dim V As Word , V1 As Word
'Gosub Getdatetime
'Set Ss1
Reset Ss
Waitms 5
Do
Loop Until Dout = 1
Shiftin Dout , Clock , V , 0 , 16
Shift V , Right , 4
'Lcd "V= " ; V
Set Ss
Waitms 200
Do
If Pinb.4 = 0 Then
Set Ss1
Waitms 50
Reset Ss
Waitms 5
Do
Loop Until Dout = 1
Shiftin Dout , Clock , V , 0 , 16
Shift V , Right , 4
Cls
Lcd "ADC1=" ; V
Set Ss
Waitms 50
End If
If Pinb.5 = 0 Then
Set Ss
Waitms 50
Reset Ss1
Waitms 5
Do
Loop Until Dout1 = 1
Shiftin Dout1 , Clock , V1 , 0 , 16
Shift V1 , Right , 4
Set Ss1
Cls
Lcd "ADC2=" ; V1
Waitms 100
End If
Loop |