پاسخ : مشگل در نگه داشتن دما ثابت در محدوده منفی
:job:
:smile:ممنون
فقط یه سوال دیگه
چطوری میتوانم درایوش کنم
از کدوم ای سی استفاده کنم؟
:job:

فقط یه سوال دیگه
چطوری میتوانم درایوش کنم
از کدوم ای سی استفاده کنم؟
$regfile = "m16def.dat" $crystal = 2000000 Config Lcdpin = Pin , Rs = Porta.7 , E = Porta.6 , Db4 = Porta.5 , Db5 = Porta.4 , _ Db6 = Porta.3 , Db7 = Porta.2 Config Lcd = 16 * 2 Cursor Off Config Single = Scientific , Digits = 1 Config 1wire = Portd.7 Dim Ss As String * 30 Dim Temp As String * 6 Dim Temp1 As String * 6 Dim Temp2 As String * 6 Dim I1 As Integer Dim I2 As Integer Dim I11 As Single Dim I22 As Single Dim Dsid1(8) As Byte Dim Dsid2(8) As Byte '##############################################################################' Dim L As Single Dim H As Single Dim Ll As String * 4 Dim Hh As String * 4 Dim T As Single Dim T1 As Single Dim T2 As Single Dim Dt As Single Dim F As Byte , V As Byte , Kilid As Byte Dim String_s As String * 3 , String_a As String * 2 , Sr(5) As String * 1 , P(5) As Integer Dim Val_s As Single , D1 As Word , D2 As Word Dim Cont(5) As Byte , I As Integer , N As Byte , Ul As String * 6 Dim Pg As Single Declare Sub Segment '##############################################################################' Dsid1(1) = 1wsearchfirst() Dsid2(1) = 1wsearchnext() '**************' Config Portb = Output Config Portc = Output Config Portd.2 = Output Config Portd.0 = Output Config Porta.1 = Output Config Porta.0 = Output Config Portd.1 = Input Config Portd.5 = Input Config Portd.6 = Input Config Portd.7 = Input Config Portd.4 = Input Config Portd.3 = Input '**************' Set Porta.1 Cls Locate 1 , 4 Lcd "AZAR NOGA" Wait 5 'For N = 0 To 167 'Segment 'Portb = &B01000000 'Next Submain: Set Porta.1 F = 1 Cls Cursor Off Readeeprom L , 1 Waitms 5 Readeeprom H , 8 Waitms 5 Readeeprom Kilid , 12 Waitms 5 Ll = Fusing(l , "#.#") Do If Pind.5 = 0 And F = 0 Then Goto Settempon 1wreset 1wwrite &HCC 1wwrite &H44 '================================= For N = 0 To 20 Segment Next If Err = 1 Then Cls Locate 1 , 4 Lcd "No DS18B20" Wait 1 Portb = &H00 Else '---------------------------------' 1wreset 1wwrite &H55 1wverify Dsid1(1) 1wwrite &HBE I1 = 1wread(2) '---------------------------------' Segment 1wreset 1wwrite &H55 1wverify Dsid2(1) 1wwrite &HBE I2 = 1wread(2) Segment '---------------------------------' Ss = "" I11 = I1 \ 16 Ss = Fusing(i11 , "#.##") Temp1 = Ss Segment Dt = Val(temp1) T1 = Dt Ss = "" I22 = I2 \ 16 Segment Ss = Fusing(i22 , "#.##") Temp2 = Ss Dt = Val(temp2) T2 = Dt Segment If Kilid = 0 Then T = T1 If Kilid = 1 Then T = T2 If Pind.6 = 0 And V = 0 Then Incr Kilid If Kilid > 1 Then Kilid = 0 V = 1 Writeeeprom Kilid , 12 Waitms 5 Cls Waitms 300 Cls End If Segment If Pind.6 = 1 Then V = 0 Locate 1 , 1 If Kilid = 0 Then Lcd "Temp=" ; Temp1 ; Chr(223) ; "C " Temp = Temp1 End If Segment If Kilid = 1 Then Lcd "Temp=" ; Temp2 ; ":" ; ; Chr(223) ; "C " Temp = Temp2 End If Segment '====================7segment formol== If T < 0 Then Pg = Abs(t) Else Pg = -1 End If If T >= 100 Then String_s = Left(temp , 3) If T >= 10 And T < 100 Then String_s = Left(temp , 2) If T < 10 Then String_s = Left(temp , 1) String_a = Right(temp , 2) Segment If T < 10 And T >= 0 Then Cont(1) = 1 : Cont(2) = 4 : Cont(3) = 5 : Cont(4) = 20 : Cont(5) = 20 Elseif T >= 10 And T < 100 Then Cont(1) = 1 : Cont(2) = 2 : Cont(3) = 4 : Cont(4) = 5 : Cont(5) = 20 Elseif T >= 100 Then Cont(1) = 1 : Cont(2) = 2 : Cont(3) = 3 : Cont(4) = 4 : Cont(5) = 5 End If Segment If Pg >= 10 And Pg < 100 Then String_s = Mid(temp , 2 , 2) If Pg < 10 And Pg >= 0 Then String_s = Mid(temp , 2 , 1) String_a = Right(temp , 2) Segment If Pg < 10 And Pg >= 0 Then Cont(1) = 30 : Cont(2) = 1 : Cont(3) = 4 : Cont(4) = 5 : Cont(5) = 20 Elseif Pg >= 10 And Pg < 100 Then Cont(1) = 30 : Cont(2) = 2 : Cont(3) = 3 : Cont(4) = 4 : Cont(5) = 5 End If Segment Sr(1) = Left(string_s , 1) If T => 0 Then Sr(2) = Mid(string_s , 2 , 1) If T < 0 Then Sr(2) = Left(string_s , 1 ) Segment Sr(3) = Right(string_s , 1) Sr(4) = Left(string_a , 1) Sr(5) = Right(string_a , 1) Segment P(1) = Val(sr(cont(1))) P(2) = Val(sr(cont(2))) P(3) = Val(sr(cont(3))) P(4) = Val(sr(cont(4))) P(5) = Val(sr(cont(5))) '============================ Segment Locate 2 , 1 Lcd "Temp Off:" ; L ; Chr(223) ; "C " Segment End If Deflcdchar 1 , 31 , 28 , 29 , 29 , 13 , 19 , 27 , 27 Segment If T > L And T < H Then End If Segment '=================Gharm Shodan ' If T > L Then Locate 1 , 16 Lcd "*" Segment Set Portd.2 Set Porta.0 Reset Portd.0 For N = 0 To 34 Segment Next Else Locate 1 , 14 Lcd " " Segment Reset Portd.2 Reset Porta.0 For N = 0 To 10 Segment Next End If If Pind.5 = 1 Then F = 0 Segment '============= Loop '###############################temp control#################################### Settempon: Portb = &H00 F = 1 Cursor Off Locate 1 , 1 Cls Lcd "Set Temp Off" Do Waitms 150 If Pind.3 = 0 Then L = L + 0.1 If Pind.4 = 0 Then L = L -0.1 If Pind.5 = 0 And F = 0 Then Cls Lcd " SAVING..." Waitms 700 Writeeeprom L , 1 Waitms 5 Cls Goto Submain End If Locate 2 , 1 Lcd "Temp Off = " ; L ; Chr(0) ; "c " If Pind.5 = 1 Then F = 0 Waitms 120 Loop '############################7Segment module#################################### Sub Segment Set Portc.5 Set Portc.4 Set Portc.3 Set Portc.2 Set Portc.1 Reset Portc.0 Portb = Lookup(p(1) , Temp_data) If T < 10 Then Portb = Portb Or &H80 If T < 0 Then Portb = &H40 Waitms 4 '============= Set Portc.5 Set Portc.4 Set Portc.3 Set Portc.2 Set Portc.0 Reset Portc.1 Portb = Lookup(p(2) , Temp_data) If T => 10 And T < 100 Then Portb = Portb Or &H80 If Pg < 10 And Pg > 0 Then Portb = Portb Or &H80 Waitms 4 '============= Set Portc.5 Set Portc.4 Set Portc.3 Set Portc.1 Set Portc.0 Reset Portc.2 If Cont(3) <> 20 Then Portb = Lookup(p(3) , Temp_data) If T >= 100 Then Portb = Portb Or &H80 If Pg => 10 And Pg < 100 Then Portb = Portb Or &H80 If Cont(3) = 20 Then Portb = &H39 Waitms 4 '============= Set Portc.5 Set Portc.4 Set Portc.2 Set Portc.1 Set Portc.0 Reset Portc.3 If Cont(4) <> 20 Then Portb = Lookup(p(4) , Temp_data) If Cont(4) = 20 And Cont(3) <> 20 And T => 0 Then Portb = &H39 Elseif Cont(4) = 20 Then Portb = &H00 End If If Pg >= 100 Then Portb = Portb Or &H80 Waitms 4 '============= Set Portc.5 Set Portc.3 Set Portc.2 Set Portc.1 Set Portc.0 Reset Portc.4 If Cont(5) <> 20 Then Portb = Lookup(p(5) , Temp_data) If Cont(5) = 20 And Cont(4) <> 20 Then Portb = &H39 Elseif Cont(5) = 20 Then Portb = &H00 End If Waitms 4 '============= Set Portc.4 Set Portc.3 Set Portc.2 Set Portc.1 Set Portc.0 Reset Portc.5 If Cont(5) = 20 Then Portb = &B0000000 If Cont(5) <> 20 Then Portb = &H39 Waitms 4 '============= End Sub '#############################eeprom data####################################### Temp_data: Data &H3F , &H06 , &H5B , &H4F , &H66 , &H6D , &H7D , &H07 , &H7F , &H6F '############################################################################### Dta: $eeprom Data 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 $data
دیدگاه