PDA

View Full Version : strange lcd out with array



maus
- 24th January 2006, 20:46
i'm trying to put different text's on the lcd (8 char's long)

with a for next loop from 1 to 3

if the counter is 1 the display should say "one1one1"
wait 500 ms , clear screen
if the counter is 2 the display should say "twotwo22"
wait 500 ms, clear screen
if the counter is 3 the display should say "three333"

then goto start

i'm trying to put the text in a array and finding it back with lookup but
whatever i try it doesn't do it like it should

the goal is to put all text in one block, so i can change it easy, because i
need the different text on different places in my program,
and keeps my main routine short!

I've searched thru the entire board, but can't find somthing like it

this is only the test program, but it keeps me puzzled all day

pic 16F876 and 2*16 lcd module

INCLUDE "bs1defs.bas"
define osc 8
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 5
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
DEFINE ADC_BITS 8


tel var word

waarde var BYTE
waarde2 var word
text var BYTE
counter var word
counter1 var word
stap var word

start:
stap=0
lcdout $fe,1 'cls
pause 10

for counter = 1 to 3

gosub numbers
PAUSE 100
lcdout $FE,1,str waarde\8
pause 500
lcdout $fe,1 'cls
pause 500
next counter

pause 1000

goto start

numbers:

for counter1 =STAP to STAP+7
lookup counter1,["one1one1twotwo22three333"],text
waarde(counter1)=text
next counter1
stap=stap+8
if stap>24 then
stap=0
endif