سلام
راستش با یه میکرو امتحان کردم دما رو 55 نشون داد. البته نمی دونم چرا تازگش ها این میکر اینقدر داغ می کنه
با یه میکر دیگه هم امتحان کردم دما رو 0 نشون داد.
کد: (این کدیه که قبلا استفاده می کردم)
کد:
'-config------------------------------------------------------------------------------------
$regfile = "m8def.dat" : $crystal = 8000000
Config Portc.1 = Output : Config Portd = Output : Config Portc.2 = Output : Config Portc.3 = Output
Dim N As Word : Dim A As Word : Dim B As Word : Dim C As Word : Dim D As Word : Dim I As Word : Dim P As Word
Config Portc.4 = Output : Config Portc.0 = Output
Reset Portc.4
Reset Portc.0
Waitms 10
Dim Res As Word
Res = 0
Config Pinb.0 = Input : Config Pinb.1 = Input : Config Pinb.2 = Input
Dim Y As Word
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Config Debounce = 25
Reset Portc.3
'-begin-------------------------------------------------------------------------------------
For I = 1 To 3
Reset Portd
Set Portc.1
Set Portc.2
Waitms 300
Set Portd
Reset Portc.1
Reset Portc.2
Waitms 200
Next I
Readeeprom P , 1
Waitms 1000
'-show--------------------------------------------------------------------------------------
Start Adc
N = Getadc(5) : N = N / 2
Stop Adc
Sss:
Do
Reset Portc.3
Start Adc
N = Getadc(5) : N = N / 2
Stop Adc
I = 0 : Y = 0 : A = 0 : B = 0 : C = 0 : D = 0
For I = 1 To N 'change
Incr A : If A > 9 Then : A = 0 : Incr B : End If 'change
If B > 9 Then : B = 0 : Incr C : End If
Debounce Pinb.0 , 1 , Setting 'check
Next I
If P > N Then '''''''''''
Set Portc.4
Set Portc.0
End If
If P <= N Then
Reset Portc.4
Reset Portc.0
End If 'change
Debounce Pinb.0 , 1 , Setting 'check
For Y = 1 To 100
If P <= N Then '''''''''''''
Set Portc.4
Else
Reset Portc.4
End If
Debounce Pinb.0 , 1 , Setting 'check
Set Portc.1
Reset Portc.2
Portd = Lookup(a , Digits)
Reset Portd.7
Waitms 1
Reset Portc.1
Set Portc.2
Portd = Lookup(b , Digits)
Set Portd.7
Waitms 1
Next Y
Set Portc.3
Waitms 40
Loop
End 'end program
Setting:
Set Portd
Reset Portc.1
Reset Portc.2
Readeeprom P , 1
Waitms 500
Sett:
Do
Res = Res + 1
Set Portc.3
I = 0 : Y = 0 : A = 0 : B = 0 : C = 0 : D = 0
For I = 1 To P 'change
Incr A : If A > 9 Then : A = 0 : Incr B : End If 'change
If B > 9 Then : B = 0 : Incr C : End If
Debounce Pinb.1 , 1 , Upp
Debounce Pinb.2 , 1 , Down
Debounce Pinb.0 , 1 , Sa 'check
Next I 'change
Debounce Pinb.1 , 1 , Upp
Debounce Pinb.2 , 1 , Down
Debounce Pinb.0 , 1 , Sa 'check
'For Y = 1 To 1000
' Debounce Pinb.1 , 1 , Upp
' Debounce Pinb.2 , 1 , Down
' Debounce Pinb.0 , 1 , Sss 'check
Set Portc.1
Reset Portc.2
Portd = Lookup(a , Digits)
Waitms 1
Reset Portc.1
Set Portc.2
Portd = Lookup(b , Digits)
Waitms 1
' Next Y
If Res > 500 Then
Res = 0
Reset Portc.1
Reset Portc.2
Reset Portd
Waitms 150
End If
Loop
End
Sa:
Writeeeprom P , 1
Waitms 500
jmp SSS
End
Upp:
P = P + 1
Waitms 10
Goto Sett
Return
End
Down:
P = P - 1
Waitms 10
Goto Sett
Return
End 'end program
'******** Data **********************************
Digits:
Data &B11000000 , &B11111001 , &B10100100 , &B10110000 , &B10011001 , &B10010010 , &B10000010 , &B11011000 , &B10000000 , &B10010000 , 64 , 128 , 56 , 70 , 00
' 0 1 2 3 4 5 6 7 8 9 - dp L +
'************************************************
این کدی هست که همین الان استفاده کی کنم.
چون این دستگاه یک ترموستات هم هست برای همین یک قسمت هاییش مربوط به دما سنج نمی شه.
کد: این کدیه که با کانفیگ شما استفاده کردم:
کد:
'-config------------------------------------------------------------------------------------
$regfile = "m8def.dat" : $crystal = 8000000
Config Portc.1 = Output : Config Portd = Output : Config Portc.2 = Output : Config Portc.3 = Output
Dim N As Word : Dim A As Word : Dim B As Word : Dim C As Word : Dim D As Word : Dim I As Word : Dim P As Word
Config Portc.4 = Output : Config Portc.0 = Output
Reset Portc.4
Reset Portc.0
Waitms 10
Dim Res As Word
Res = 0
Config Pinb.0 = Input : Config Pinb.1 = Input : Config Pinb.2 = Input
Dim Y As Word
Config Adc = Single , Prescaler = Auto , Reference = Internal
Config Debounce = 25
Reset Portc.3
'-begin-------------------------------------------------------------------------------------
For I = 1 To 3
Reset Portd
Set Portc.1
Set Portc.2
Waitms 300
Set Portd
Reset Portc.1
Reset Portc.2
Waitms 200
Next I
Readeeprom P , 1
Waitms 1000
'-show--------------------------------------------------------------------------------------
Start Adc
N = Getadc(5) : N = N / 4
Stop Adc
Sss:
Do
Reset Portc.3
Start Adc
N = Getadc(5) : N = N / 4
Stop Adc
I = 0 : Y = 0 : A = 0 : B = 0 : C = 0 : D = 0
For I = 1 To N 'change
Incr A : If A > 9 Then : A = 0 : Incr B : End If 'change
If B > 9 Then : B = 0 : Incr C : End If
Debounce Pinb.0 , 1 , Setting 'check
Next I
If P > N Then '''''''''''
Set Portc.4
Set Portc.0
End If
If P <= N Then
Reset Portc.4
Reset Portc.0
End If 'change
Debounce Pinb.0 , 1 , Setting 'check
For Y = 1 To 100
If P <= N Then '''''''''''''
Set Portc.4
Else
Reset Portc.4
End If
Debounce Pinb.0 , 1 , Setting 'check
Set Portc.1
Reset Portc.2
Portd = Lookup(a , Digits)
Reset Portd.7
Waitms 1
Reset Portc.1
Set Portc.2
Portd = Lookup(b , Digits)
Set Portd.7
Waitms 1
Next Y
Set Portc.3
Waitms 40
Loop
End 'end program
Setting:
Set Portd
Reset Portc.1
Reset Portc.2
Readeeprom P , 1
Waitms 500
Sett:
Do
Res = Res + 1
Set Portc.3
I = 0 : Y = 0 : A = 0 : B = 0 : C = 0 : D = 0
For I = 1 To P 'change
Incr A : If A > 9 Then : A = 0 : Incr B : End If 'change
If B > 9 Then : B = 0 : Incr C : End If
Debounce Pinb.1 , 1 , Upp
Debounce Pinb.2 , 1 , Down
Debounce Pinb.0 , 1 , Sa 'check
Next I 'change
Debounce Pinb.1 , 1 , Upp
Debounce Pinb.2 , 1 , Down
Debounce Pinb.0 , 1 , Sa 'check
'For Y = 1 To 1000
' Debounce Pinb.1 , 1 , Upp
' Debounce Pinb.2 , 1 , Down
' Debounce Pinb.0 , 1 , Sss 'check
Set Portc.1
Reset Portc.2
Portd = Lookup(a , Digits)
Waitms 1
Reset Portc.1
Set Portc.2
Portd = Lookup(b , Digits)
Waitms 1
' Next Y
If Res > 500 Then
Res = 0
Reset Portc.1
Reset Portc.2
Reset Portd
Waitms 150
End If
Loop
End
Sa:
Writeeeprom P , 1
Waitms 500
jmp SSS
End
Upp:
P = P + 1
Waitms 10
Goto Sett
Return
End
Down:
P = P - 1
Waitms 10
Goto Sett
Return
End 'end program
'******** Data **********************************
Digits:
Data &B11000000 , &B11111001 , &B10100100 , &B10110000 , &B10011001 , &B10010010 , &B10000010 , &B11011000 , &B10000000 , &B10010000 , 64 , 128 , 56 , 70 , 00
' 0 1 2 3 4 5 6 7 8 9 - dp L +
'************************************************
راستی این قیمت ها تا کجا می خواهد افزایش پیدا کنه. الان هر چه بخریم بهتره چون شاید یهو فردا شد 10000