سلام ببخشید من میخواستم نحوه اتصال سنسور دما smt160 با avr مثل atmega32 میخواستم ...
ممنون
ممنون
$regfile = “m8def.dat” $crystal = 1000000 ‘——————————-lcd——————————————— Config Lcd = 16 * 2 Config Lcdpin = Pin , Rs = Pinc.5 , E = Pinc.4 , Db4 = Pinc.3 , Db5 = Pinc.2 , Db6 = Pinc.1 , Db7 = Pinc.0 ‘——————————–dim——————————————- Dim avr_reset As Word Dim Avr_set As Word Dim Temp As Single Dim Duty As Single Dim X As Integer ‘——————————————————————————- Config Timer1 = Timer , Prescale = 1 Enable Timer1 ‘——————————–main—————————————— Config Pinb.2 = Input ‘—————————————————————————— Cursor Off Cls Locate 1 , 5 Lcd “Hello” Locate 2 , 1 Wait 2 Cls Smt160: Do Gosub Read_data_sm160 Locate 1 , 1 Lcd “T= “ ; Temp ; “c “; Wait 1 Loop ‘——————————————————————————- Read_data_sm160: 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.2 , Set Timer1 = 0 Start Timer1 Bitwait Pinb.2 , Reset ‘Xl = Timer1 avr_set = Timer1 Timer1 = 0 Start Timer1 Bitwait Pinb.2 , Set ‘Xf = Timer1 Avr_reset = Timer1 X = Avr_set + Avr_reset Duty = Avr_set / X Duty = Duty - 0.32 Waitms 1 Temp = Duty / 0.0047 Waitms 1 Locate 1 , 1 Temp = Round(temp) Stop Timer1 Return
دیدگاه