Hallo
Ik probeer met een AVR16 binnenkomende data via een UART op een LCD (240x128) te schrijven.
Maak ook gebruik van een scroll functie.
Dus alle tekst wordt op de laatste regel (lcd) weergegeven.Als de regel vol is of dmv LF en CR wordt alle tekst een regel naar boven gescrollt.
Op zich lukt da wel met onderstaand programma. Maar ik krijg hier vreemde characters, die ik liever kwijt dan rijk ben. Deze tekens zijn meestal de cijfers 4, 5 of 6
Maar ik kan op zich het probleem niet vinden.
Variable out[outx][outy] is een array 40x16 die alle tekens opslaat en naderhand wegschrijft naar het lcd.
Programma:
outx=0
outy=15
T6963C_set_cursor(outx, outy)
while TRUE
if (UART1_Data_Ready() <> 0) then ' ontvangen data
tmp = UART1_Read() ' lees data,
if tmp > 31 then ' ascii boven 31 ?
out[outx][outy] = tmp ' schrijf data in buffer
T6963C_Write_Char(tmp,outx,15,T6963C_ROM_MODE_XOR) ' en naar lcd
inc(outx)
T6963C_set_cursor(outx, outy) ' positioneer cursor
if outx > 39 then ' eind regel?
'scroll
for j = 1 to 15 ' scroll lcd
for i = 0 to 39
out[i][j-1] = out[i][j]
next i
next j
for i = 0 to 39
out[i][15]=32
next i
outx=0
T6963C_set_cursor(outx, outy)
for j = 0 to 15
for i = 0 to 39
T6963C_Write_Char(out[i][j],i,j,T6963C_ROM_MODE_XOR)
next i
next j
end if
else
if tmp = 10 then 'LineFeed
'scroll
for j = 1 to 15
for i = 0 to 39
out[i][j-1] = out[i][j]
next i
next j
for i = 0 to 39
out[i][15]=32
next i
for j = 0 to 15
for i = 0 to 39
T6963C_Write_Char(out[i][j],i,j,T6963C_ROM_MODE_XOR)
next i
next j
else
if tmp = 13 then 'Carriage Return
outx = 0
T6963C_set_cursor(outx, outy)
end if
end if
end if
end if
wend