PDA

View Full Version : data storage label



MINHLE
- 16th December 2009, 20:05
hi,

i would store information in different DATA files i.e. label1 DATA $01, , 10,...
and label2 DATA $21, $45

here is the program but it gave error message

CMCON = 1
TRISA = 0
TRISB = 0

I VAR BYTE
TEMP VAR WORD ; temporary storage out put


LOOP:
.....
.....

for i = 0 to 5
read display + i , temp ;increase the index to read data from

"display". display is @ first data l location and store it in the "temp"

portb = temp ; out put to hardware
next i

GOSUB LOOP

ENd

display DATA $00,$40,$40,$7F,$40,$40 ;data storage here

thanks for your help

Darrel Taylor
- 16th December 2009, 22:00
It's just a Warning, so you can turn it off.

    @ errorlevel -202
<BR>

MINHLE
- 16th December 2009, 23:50
thanks Darrel,
i try it but now bad token
i try to check on the data sheet of 16 f628 have not seen it yet.

MINHLE
- 17th December 2009, 02:05
Hi Darrel

I could not find the "error level" in the data sheet of 16f628. where is it information from?


thanks for yuor help

Minh le

Darrel Taylor
- 17th December 2009, 03:21
Sorry, I assumed you were using an 18F, which can have problems with EEPROM Math.
Since you are using a 16F628, please ignore my previous comment.

Not sure why you would get that error with a 16F, so give this a try and let me know what happens.
Set you're OSC and LCD defines first ...

<font color="#0000FF"><b><i>'----[EEPROM DATA]----------------------------------------------------------
</i></b></font><b>EEstring1 </b><font color="#008000"><b>DATA </b></font><font color="#FF0000">&quot;Hello World!&quot;</font>,<font color="#800000"><b>0 </b></font><font color="#0000FF"><b><i>; null-terminated strings in EEPROM
</i></b></font><b>EEstring2 </b><font color="#008000"><b>DATA </b></font><font color="#FF0000">&quot;Didn't expect That.&quot;</font>,<font color="#800000"><b>0

</b></font><font color="#0000FF"><b><i>'----[Variables / Aliases]--------------------------------------------------
</i></b></font><b>Idx </b><font color="#008000"><b>VAR BYTE </b></font><font color="#0000FF"><b><i>' String Index pointer
</i></b></font><b>Char </b><font color="#008000"><b>VAR BYTE </b></font><font color="#0000FF"><b><i>' Character to display
</i></b></font><b>String </b><font color="#008000"><b>VAR BYTE </b></font><font color="#0000FF"><b><i>' Pointer to String in EEPROM memory

'----[Initialization]-------------------------------------------------------
</i></b></font><b>CMCON </b>= <font color="#800000"><b>7
</b></font><font color="#008000"><b>LCDOUT </b></font><font color="#800000"><b>$FE</b></font>,<font color="#800000"><b>1</b></font>:<b>FLAGS</b>=<font color="#800000"><b>0</b></font>:<font color="#008000"><b>PAUSE </b></font><font color="#800000"><b>250</b></font>:<font color="#008000"><b>LCDOUT </b></font><font color="#800000"><b>$FE</b></font>,<font color="#800000"><b>1</b></font>:<font color="#008000"><b>PAUSE </b></font><font color="#800000"><b>250 </b></font><font color="#0000FF"><b><i>' Initialize LCD

'----[Main program loop]----------------------------------------------------
</i></b></font><b>Main</b>:
<font color="#008000"><b>LCDOUT </b></font><font color="#800000"><b>$FE</b></font>, <font color="#800000"><b>1 </b></font><font color="#0000FF"><b><i>' Clear LCD screen
</i></b></font><b>String </b>= <b>EEstring1 </b>: <font color="#008000"><b>GOSUB </b></font><b>EEString2LCD </b><font color="#0000FF"><b><i>' Display String1
</i></b></font><font color="#008000"><b>PAUSE </b></font><font color="#800000"><b>1000
</b></font><font color="#008000"><b>LCDOUT </b></font><font color="#800000"><b>$FE</b></font>,<font color="#800000"><b>$C0 </b></font><font color="#0000FF"><b><i>' move cursor to Line2
</i></b></font><b>String </b>= <b>EEstring2 </b>: <font color="#008000"><b>GOSUB </b></font><b>EEString2LCD </b><font color="#0000FF"><b><i>' Display String2
</i></b></font><font color="#008000"><b>PAUSE </b></font><font color="#800000"><b>1000
</b></font><font color="#008000"><b>GOTO </b></font><b>Main </b><font color="#0000FF"><b><i>' Rinse &amp; Repeat

'----[Display the specified EE string]--------------------------------------
</i></b></font><b>EEString2LCD</b>:
<b>Char </b>= <font color="#800000"><b>$FF </b></font><font color="#0000FF"><b><i>' Make sure Char &gt; 0 to start
</i></b></font><b>Idx </b>= <font color="#800000"><b>0 </b></font><font color="#0000FF"><b><i>' start at beginning of string
</i></b></font><font color="#008000"><b>WHILE </b></font><b>Char </b>&gt; <font color="#800000"><b>0 </b></font><font color="#0000FF"><b><i>' do Null-terminated string
</i></b></font><font color="#008000"><b>Read </b></font><b>String </b>+ <b>Idx</b>, <b>Char </b><font color="#0000FF"><b><i>' get the character
</i></b></font><font color="#008000"><b>IF </b></font><b>Char </b>&gt; <font color="#800000"><b>0 </b></font><font color="#008000"><b>THEN LCDOUT </b></font><b>Char </b><font color="#0000FF"><b><i>' display the character,If>0
</i></b></font><b>Idx </b>= <b>Idx </b>+ <font color="#800000"><b>1 </b></font><font color="#0000FF"><b><i>' point to next character
</i></b></font><font color="#008000"><b>WEND
RETURN

</b></font>

MINHLE
- 17th December 2009, 04:27
sory Darrel,

the one i do id for the LED matrix display. the data include happy face. letters....scrolling. for the alphabets i store in one data file , the happy face i do it in another data file.

i.e. running_letter DATA $10,$10...$30..
running_face DATA $30, $68....
the label give out the error when compiled
------------------------

for i = 0 to 3
READ running_letter +i, temp ; tenp is temporary storage

next i
--------------------

the pic is 16f628
i could not find rhe ERRORLEVEL in the data sheet of that chip

thank for your attention

regards,

MINHLE
- 17th December 2009, 14:04
hello Darrel,

i found where the problem comes from,
that is bacause i left the DATA table at the end of the program. now i move to the beginning of the program , it works,

thanks gain for your help
MInh le