Witam.
Zrobiłem już część programu:
Nie wiem co jest źle, ale wyświetla mi błąd w linii oznaczonej B , w której jest "Return".
Prosiłbym też o dopisanie tej części programu w której będzie odczyt z czujnika ds18b20 i podzielenie odczytu na poszczególne części, te które są podane w komentarzu.
Oto schemat ideowy:
PS.:Procesor to ATtiny2313.
Z góry dzięki za pomoc...
Pozdrawiam
sim_007
Zrobiłem już część programu:
Code:
$regfile = "2313def.dat"
$crystal = 12000000
'-- konfiguracja zmiennch:
'potrebne do odczytu 1wire itd.
Dim Liczba As Byte
Dim Jednosci As Byte
Dim Dziesiatki As Byte
Dim Czdziesietne As Byte
'--deklaracja podprogramow:
Declare Sub 1
Declare Sub 2
Declare Sub 3
Declare Sub 4
Declare Sub 5
Declare Sub 6
Declare Sub 7
Declare Sub 8
Declare Sub 9
Declare Sub 0
Declare Sub Minus
Declare Sub Resetuj
'-- wyjscia sterowania segmentami:
Config Portb = Output
Set Portb
A Alias Portb.0
B Alias Portb.1
C Alias Portb.2
D Alias Portb.3
E Alias Portb.4
F Alias Portb.5
G Alias Portb.6
Dp Alias Portb.7
'-- wyjscia multipleksowania segmentow:
Config Portd.2 = Output
Config Portd.3 = Output
Config Portd.4 = Output
Config Portd.5 = Output
Reset Portd.2
Reset Portd.3
Reset Portd.4
Reset Portd.5
S1 Alias Portd.2
S2 Alias Portd.3
S3 Alias Portd.4
S4 Alias Portd.5
'-- wejscie czujnika DS18B20:
Config 1wire = Portd.0
Set Portd.0
'-- Program gowny:
Do
'-- tej czesci niemam
'trzeba tu zrobic odczyt temperatury i podzielenie jej na:
' czesci dziesietne -czdziesietne
' jednosci -jednosci
' dziesiatki -dziesiatki
' i calkowita liczbe -liczba
If Liczba < 0 Then
Set S1
Gosub Minus
Reset S1
Gosub Resetuj
End If
Set S3
Reset Dp
Set S3
Gosub Resetuj
'dziesiatki:
Set S2
If Dziesiatki = 1 Then
Gosub 1
End If
If Dziesiatki = 2 Then
Gosub 2
End If
If Dziesiatki = 3 Then
Gosub 3
End If
If Dziesiatki = 4 Then
Gosub 4
End If
If Dziesiatki = 5 Then
Gosub 5
End If
If Dziesiatki = 6 Then
Gosub 6
End If
If Dziesiatki = 7 Then
Gosub 7
End If
If Dziesiatki = 8 Then
Gosub 8
End If
If Dziesiatki = 9 Then
Gosub 9
End If
Reset S2
Gosub Resetuj
' jednosci:
Set S3
If Jednosci = 0 Then
Gosub 0
End If
If Jednosci = 1 Then
Gosub 1
End If
If Jednosci = 2 Then
Gosub 2
End If
If Jednosci = 3 Then
Gosub 3
End If
If Jednosci = 4 Then
Gosub 4
End If
If Jednosci = 5 Then
Gosub 5
End If
If Jednosci = 6 Then
Gosub 6
End If
If Jednosci = 7 Then
Gosub 7
End If
If Jednosci = 8 Then
Gosub 8
End If
If Jednosci = 9 Then
Gosub 9
End If
Reset S3
Gosub Resetuj
' czesci dziesietne:
Set S4
If Czdziesietne = 0 Then
Gosub 0
End If
If Czdziesietne = 1 Then
Sub 1
End If
If Czdziesietne = 2 Then
Gosub 2
End If
If Czdziesietne = 3 Then
Gosub 3
End If
If Czdziesietne = 4 Then
Gosub 4
End If
If Czdziesietne = 5 Then
Gosub 5
End If
If Czdziesietne = 6 Then
Gosub 6
End If
If Czdziesietne = 7 Then
Gosub 7
End If
If Czdziesietne = 8 Then
Gosub 8
End If
If Czdziesietne = 9 Then
Gosub 9
End If
Reset S4
Gosub Resetuj
Loop
End
[b]Sub 1[/b]
Reset B
Reset C
Return
End Sub
Sub 2
Reset A
Reset B
Reset G
Reset E
Reset D
Return
End Sub
Sub 3
Reset A
Reset B
Reset G
Reset C
Reset D
Return
End Sub
Sub 4
Reset F
Reset G
Reset B
Reset C
Return
End Sub
Sub 5
Reset A
Reset F
Reset G
Reset C
Reset D
Return
End Sub
Sub 6
Reset A
Reset F
Reset E
Reset D
Reset C
Reset G
Return
End Sub
Sub 7
Reset A
Reset B
Reset C
Return
End Sub
Sub 8
Reset A
Reset B
Reset C
Reset D
Reset E
Reset F
Reset G
Return
End Sub
Sub 9
Reset G
Reset F
Reset A
Reset B
Reset C
Reset D
Return
End Sub
Sub 0
Reset A
Reset B
Reset C
Reset D
Reset E
Reset F
Return
End Sub
Sub Minus
Reset G
Return
End Sub
Sub Resetuj
Set A
Set B
Set C
Set D
Set E
Set F
Set G
Set Dp
Return
End Sub
Nie wiem co jest źle, ale wyświetla mi błąd w linii oznaczonej B , w której jest "Return".
Prosiłbym też o dopisanie tej części programu w której będzie odczyt z czujnika ds18b20 i podzielenie odczytu na poszczególne części, te które są podane w komentarzu.
Oto schemat ideowy:
![[BASCOM] Odczyt temperatury z dokładnością do 0,1 - DS18B20 [BASCOM] Odczyt temperatury z dokładnością do 0,1 - DS18B20](https://obrazki.elektroda.pl/16_1264184057_thumb.png)
PS.:Procesor to ATtiny2313.
Z góry dzięki za pomoc...

Pozdrawiam
sim_007