Pisząc program chciałem wstawić swoje znaki za pomocą polecenia Deflcdchar, ale pojawił się problem . Na wyświetlaczu lcd zamiast zdwfiniowanych znaków pojawiają się krzaczki , próbowałem na różnych prockach attiny2313, atmega8 i atmega32 wszędzie to samo. Wszystko oprócz tego wyświetla się normalnie, ponadto zauważyłem że mój bascom generuje źle kody (jakieś trzy cyfrowe) w innym internetowym generatorze Deflcdchar wygenerował dwucyfrowe tego samego znaku i gdy umieściłem go w prgramie to o dziwo zaczoł wyświetlać sie normalnie, ale niestety tylko pod adresem 0 . Zmieniają adres np na 1 już pojawiają się krzaczki,
co może być przyczyną takiego zachowania, Bascom , wyświetlacz czy brak zaznaczonej jakiejś opcji ?
Umieszczam kod który jest częścią większej całości , ten poniżej jest okrojony i ma za zadanie wyświetlić tylko wartość zmiennej A oraz znaków Deflcdchar o adresach
od 0 do 2 ( znak 0 i 1 wygenerowane są generatorem zewnętrznym a znak 2 w bascomie)[code]$regfile = "m32def.dat"
$crystal = 16000000
Config Porta = &B11111100 : Porta = &B11111100
Config Portb = &B11110000 : Portb = &B11111111
Config Portc = &B11111111 : Portc = &B11111111
Config Portd = &B11111110 : Portd = &B11111111
Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E = Portc.1 , Rs = Portc.0
Config Lcdmode = Port
Config Lcd = 16 * 2
Config Lcdbus = 4
Cls
Cursor Off Noblink
Deflcdchar [2] , 224 , 231 , 229 , 231 , 224 , 224 , 224 , 224 ' replace [x] with number (0-7)
Deflcdchar [0] , 32 , 7 , 5 , 7 , 32 , 32 , 32 , 32
Deflcdchar [1] , 32 , 4 , 4 , 14 , 14 , 14 , 32 , 32
Dim A As Byte
Dim R As Byte
Dim X As Byte
Dim Y As Byte
Dim Z As Byte
Dim Flaga_1s As Bit , Flaga_4ms As Bit , Flaga_500ms As Bit
'
Config Timer0 = Timer , Prescale = 256
Enable Interrupts :
Enable Timer0
On Timer0 Sek
X = 0
Cls
Wait 1
'*******************************************************************************
'***************************** PĘTLA GŁÓWNA ************************************
Do
If Flaga_4ms = 1 Then
Reset Flaga_4ms
End If
If Flaga_500ms = 1 Then
Flaga_500ms = 0
Gosub Wyswietl_1
End If
If Flaga_1s = 1 Then
Flaga_1s = 0
End If
Loop
End
'*******************************************************************************
'*************************** OBSŁUGA PRZERWANIA*********************************
Sek:
Timer0 = 6
Flaga_4ms = 1
Incr Y
If Y = 150 Then
Y = 0
Set Flaga_500ms
Incr Z
If Z = 2 Then
Z = 0
Set Flaga_1s
End If
End If
Return
'*******************************************************************************
'*********************************** LCD ***************************************
Wyswietl_1:
If Z = 0 Then
Incr A
If A > 6 Then
A = 0
End If
End If
If Z = 0 Then
Incr A
If A > 6 Then
A = 0
End If
End If
Cls
Lcd ; A ; Chr(0) ; Chr(1) ; Chr(2)
Return
co może być przyczyną takiego zachowania, Bascom , wyświetlacz czy brak zaznaczonej jakiejś opcji ?
Umieszczam kod który jest częścią większej całości , ten poniżej jest okrojony i ma za zadanie wyświetlić tylko wartość zmiennej A oraz znaków Deflcdchar o adresach
od 0 do 2 ( znak 0 i 1 wygenerowane są generatorem zewnętrznym a znak 2 w bascomie)[code]
Kod: text
$crystal = 16000000
Config Porta = &B11111100 : Porta = &B11111100
Config Portb = &B11110000 : Portb = &B11111111
Config Portc = &B11111111 : Portc = &B11111111
Config Portd = &B11111110 : Portd = &B11111111
Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E = Portc.1 , Rs = Portc.0
Config Lcdmode = Port
Config Lcd = 16 * 2
Config Lcdbus = 4
Cls
Cursor Off Noblink
Deflcdchar [2] , 224 , 231 , 229 , 231 , 224 , 224 , 224 , 224 ' replace [x] with number (0-7)
Deflcdchar [0] , 32 , 7 , 5 , 7 , 32 , 32 , 32 , 32
Deflcdchar [1] , 32 , 4 , 4 , 14 , 14 , 14 , 32 , 32
Dim A As Byte
Dim R As Byte
Dim X As Byte
Dim Y As Byte
Dim Z As Byte
Dim Flaga_1s As Bit , Flaga_4ms As Bit , Flaga_500ms As Bit
'
Config Timer0 = Timer , Prescale = 256
Enable Interrupts :
Enable Timer0
On Timer0 Sek
X = 0
Cls
Wait 1
'*******************************************************************************
'***************************** PĘTLA GŁÓWNA ************************************
Do
If Flaga_4ms = 1 Then
Reset Flaga_4ms
End If
If Flaga_500ms = 1 Then
Flaga_500ms = 0
Gosub Wyswietl_1
End If
If Flaga_1s = 1 Then
Flaga_1s = 0
End If
Loop
End
'*******************************************************************************
'*************************** OBSŁUGA PRZERWANIA*********************************
Sek:
Timer0 = 6
Flaga_4ms = 1
Incr Y
If Y = 150 Then
Y = 0
Set Flaga_500ms
Incr Z
If Z = 2 Then
Z = 0
Set Flaga_1s
End If
End If
Return
'*******************************************************************************
'*********************************** LCD ***************************************
Wyswietl_1:
If Z = 0 Then
Incr A
If A > 6 Then
A = 0
End If
End If
If Z = 0 Then
Incr A
If A > 6 Then
A = 0
End If
End If
Cls
Lcd ; A ; Chr(0) ; Chr(1) ; Chr(2)
Return
Kod: text