برنامه زیر را برای راه اندازی دو تا سنسور smt160 نوشتم ولی جواب نمیده
میشه اساتید بگید مشکل کجاست؟؟؟؟؟ :sad:
Smt160:
Do
Gosub Read_data_sm160
Locate 1 , 1
Lcd "T1= " ; Temp1 ; "c ";
Locate 2 , 1
Lcd "T2= " ; Temp2 ; "c ";
Wait 1
Loop
'-------------------------------------------------------------------------------
Read_data_sm160:
Bitwait Pinb.1 , Set
Bitwait Pinb.1 , Reset
Bitwait Pinb.1 , Set
Bitwait Pinb.1 , Reset
Bitwait Pinb.1 , Set
Bitwait Pinb.1 , Reset
Stop Timer1
Start Timer1
Bitwait Pinb.2 , Set
Bitwait Pinb.2 , Reset
Bitwait Pinb.2 , Set
Bitwait Pinb.2 , Reset
Bitwait Pinb.2 , Set
Bitwait Pinb.2 , Reset
Stop Timer1
Bitwait Pinb.1 , Set
Start Timer1
Bitwait Pinb.1 , Reset
'Xl = Timer1
V_set1 = Timer1
Bitwait Pinb.2 , Set
Start Timer1
Bitwait Pinb.2 , Reset
'Xl = Timer1
V_set2 = Timer1
Timer1 = 0
Start Timer1
Bitwait Pinb.1 , Set
'Xf = Timer1
V_reset1 = Timer1
Timer1 = 0
Start Timer1
Bitwait Pinb.2 , Set
'Xf = Timer1
V_reset2 = Timer1
X1 = V_set1 + V_reset1
Duty1 = V_set1 / X1
Duty1 = Duty1 - 0.320
Temp1 = Duty1 / 0.00470
Waitms 1
X2 = V_set2 + V_reset2
Duty2 = V_set2 / X2
Duty2 = Duty2 - 0.320
Temp2 = Duty2 / 0.00470
Waitms 1
Locate 1 , 1
Temp1 = Round(temp1)
Locate 2 , 1
Temp2 = Round(temp2)
Stop Timer1
Return
میشه اساتید بگید مشکل کجاست؟؟؟؟؟ :sad:
Smt160:
Do
Gosub Read_data_sm160
Locate 1 , 1
Lcd "T1= " ; Temp1 ; "c ";
Locate 2 , 1
Lcd "T2= " ; Temp2 ; "c ";
Wait 1
Loop
'-------------------------------------------------------------------------------
Read_data_sm160:
Bitwait Pinb.1 , Set
Bitwait Pinb.1 , Reset
Bitwait Pinb.1 , Set
Bitwait Pinb.1 , Reset
Bitwait Pinb.1 , Set
Bitwait Pinb.1 , Reset
Stop Timer1
Start Timer1
Bitwait Pinb.2 , Set
Bitwait Pinb.2 , Reset
Bitwait Pinb.2 , Set
Bitwait Pinb.2 , Reset
Bitwait Pinb.2 , Set
Bitwait Pinb.2 , Reset
Stop Timer1
Bitwait Pinb.1 , Set
Start Timer1
Bitwait Pinb.1 , Reset
'Xl = Timer1
V_set1 = Timer1
Bitwait Pinb.2 , Set
Start Timer1
Bitwait Pinb.2 , Reset
'Xl = Timer1
V_set2 = Timer1
Timer1 = 0
Start Timer1
Bitwait Pinb.1 , Set
'Xf = Timer1
V_reset1 = Timer1
Timer1 = 0
Start Timer1
Bitwait Pinb.2 , Set
'Xf = Timer1
V_reset2 = Timer1
X1 = V_set1 + V_reset1
Duty1 = V_set1 / X1
Duty1 = Duty1 - 0.320
Temp1 = Duty1 / 0.00470
Waitms 1
X2 = V_set2 + V_reset2
Duty2 = V_set2 / X2
Duty2 = Duty2 - 0.320
Temp2 = Duty2 / 0.00470
Waitms 1
Locate 1 , 1
Temp1 = Round(temp1)
Locate 2 , 1
Temp2 = Round(temp2)
Stop Timer1
Return
دیدگاه