Eeprom symbols?

johndo

Member
Hi all,

I have been using the following code to run a display for some time now, displaying letters only, now i want to display some numbers,and represent them in eeprom.Here's a snippet...

Symbol l_A = 0 :EEPROM l_A,($7E, $11, $11,
$11, $7E) ' Letter A
Symbol l_B = 5 :EEPROM l_B,($7F, $49, $49, $49, $36) ' B
Symbol l_C = 10 :EEPROM l_C,($3E, $41, $41, $41, $22) ' C
Symbol l_D = 15 :EEPROM l_D,($7F, $41, $41, $22, $1C) ' D
Symbol l_E = 20 :EEPROM l_E,($7F, $49, $49, $49, $41) ' E
etc...
ready: b5="A"
gosub sendthechar
b5="B"
gosub sendthechar
b5="C"
gosub sendthechar
b5="D"
gosub sendthechar
b5="E"
gosub sendthechar

sendthechar: b5 = b5 - "A" * 5
for b7 = 1 to 5
read b5,b0
gosub sendbytechar
b5 = b5 + 1
next b7
pause 50
pulsout 7,1
low 4
return

sendbytechar: low 5
low 7
for b3 = 1 to 8
pin4=bit7
skiphHi:
pulsout 6,1
b0 = b0 * 2
next b3
return

when i try and write eg. Symbol l_0 = 130 :EEPROM l_0,($7F, $49, $49, $49, $41) ' 0
etc...

and then b5= "0" in the program to represent a number it doesn't work.The character for that position is missing. Am i doing somthing wrong with the symbol or b5?.Using a picaxe 18X which should have enough room in eeprom for letters and numbers 0-9.

Thank you...
 

Jeremy Leach

Senior Member
Not too sure what you mean, but my guess is that the problem lies in your statement :
<code><pre><font size=2 face='Courier'>
sendthechar: b5 = b5 - &quot;A&quot; * 5
</font></pre></code>

When b5 is a letter, the result of this calculation gives an index to the EEPROM start address for the 5 bytes you want to send representing the letter (I don't understand why you're sending 5, but that doesn't matter!).

If b5 is &quot;A&quot; on entry to this statement, then the index will be EEPROM address 0, which corresponds to your code.

However if b5 = &quot;0&quot; then because 0 is quite a few characters before A in ASCII, then you'll get a strange address index.

I think the solution will be to decide on how your data is going to be laid out in EEPROM, then make sure your statement(s) to calculate the index are correct.

 
Top