$regfile = "m8def.dat"
$crystal = 8000000
Enable Interrupts
Config Debounce = 50 , Delay = 50
Const Wait_time = 1
Config Pinc.0 = Input
Config Pind.5 = Input
Config Pind.6 = Input
Config Portb.4 = Output
Config Portb.5 = Output
'Timer
Config Adc = Single , Prescaler = Auto , Reference = Internal
Config Timer0 = Timer , Prescale = 1024
Dim X_time As Word
Enable Interrupts
Enable Timer0
Start Timer0
Main:
'Dastor Key
Debounce Pind.5 , 0 , Lable , Sub ' -
Debounce Pind.6 , 0 , Lable1 , Sub
'************************
Debounce Pind.7 , 1 , Lable2 , Sub ' +
Debounce Pinb.0 , 1 , Lable3 , Sub
jmp Main
End
'************************
Lable:
Portb.4 = 1
X_time = Getadc(0)
Waitms X_time ' -
'Wait Wait_time
Portb.4 = 0
Return
'************************
Lable1:
Portb.5 = 1
X_time = Getadc(0)
Waitms X_time ' -
'Wait Wait_time
Portb.5 = 0
Return
'************************
Lable2:
Portb.4 = 1
X_time = Getadc(0)
Waitms X_time ' +
'Wait Wait_time
Portb.4 = 0
Return
'************************
Lable3:
Portb.5 = 1
X_time = Getadc(0)
Waitms X_time ' +
'Wait Wait_time
Portb.5 = 0
Return
'***********حالا میخوام با کم وزیاد کردن مقدار پتانسیومتر زمان وصل بودن رله ها تغییر کنه
باتشکر
$crystal = 8000000
Enable Interrupts
Config Debounce = 50 , Delay = 50
Const Wait_time = 1
Config Pinc.0 = Input
Config Pind.5 = Input
Config Pind.6 = Input
Config Portb.4 = Output
Config Portb.5 = Output
'Timer
Config Adc = Single , Prescaler = Auto , Reference = Internal
Config Timer0 = Timer , Prescale = 1024
Dim X_time As Word
Enable Interrupts
Enable Timer0
Start Timer0
Main:
'Dastor Key
Debounce Pind.5 , 0 , Lable , Sub ' -
Debounce Pind.6 , 0 , Lable1 , Sub
'************************
Debounce Pind.7 , 1 , Lable2 , Sub ' +
Debounce Pinb.0 , 1 , Lable3 , Sub
jmp Main
End
'************************
Lable:
Portb.4 = 1
X_time = Getadc(0)
Waitms X_time ' -
'Wait Wait_time
Portb.4 = 0
Return
'************************
Lable1:
Portb.5 = 1
X_time = Getadc(0)
Waitms X_time ' -
'Wait Wait_time
Portb.5 = 0
Return
'************************
Lable2:
Portb.4 = 1
X_time = Getadc(0)
Waitms X_time ' +
'Wait Wait_time
Portb.4 = 0
Return
'************************
Lable3:
Portb.5 = 1
X_time = Getadc(0)
Waitms X_time ' +
'Wait Wait_time
Portb.5 = 0
Return
'***********حالا میخوام با کم وزیاد کردن مقدار پتانسیومتر زمان وصل بودن رله ها تغییر کنه
باتشکر
دیدگاه