Hello,
Im using a 16F648A and my program has a bunch of LCDOUT commands so that the user can select different settings. Well, I am adding new features, and am out of space. I saw Melanies post "Making Program Code Space your playground" for program space, but this chip won't allow that, so I'm thinking EEPROM is the Solution?
Here's part of the code I cut out to give a better idea of what I'm doing. Each time a certain button is pushed, it loops back through this part of the code:
Case 2
Refresh = Refresh + 1
IF Refresh = 9 Then Refresh = 1
ref:
Select Case Refresh
GoSub lcdone ' Position cursor at home
LCDOut "Refresh"
GoSub lcdsec
Case 1
LCDOut "None"
RefTime = 0
Case 2
LCDOut "30 Sec"
RefTime = 30 ' Move to 2nd line on LCD
Case 3
LCDOut "2.5 Min"
RefTime = 140
Case 4
LCDOut "7 Min"
RefTime = 400
Case 5
LCDOut "15 Min"
RefTime = 900
Case 6
LCDOut "30 Min"
RefTime = 1700
Case 7
LCDOut "1 Hour"
RefTime = 3500
Case 8
LCDOut "2 Hour"
RefTime = 7000
End Select
Pause 400
I have several of these menus throughout the program and the strings for most LCDOUT commands are different. I have played a little with EEPROM, but am not sure the easiest way to us it. Here's the only thing that I've gotten to work, but I'm afraid in may take more space (and a ton of work). I'm using values 0-15 for other stuff, so "A" is at 16. The code below displays "BAD" on the LCD.
EEPROM 0, [1,1,10,0,0,0,24,1,1,150,0,250,0,1,1,0,"A","B","C", "D","E","F","G","H","I","J","K","L","M"]
testmem VAR BYTE[8]
Read 17, testmem[0]
Read 16, testmem[1]
Read 19, testmem[2]
testmem[3] = " "
testmem[4] = " "
testmem[5] = " "
testmem[6] = " "
testmem[7] = " "
LCDOut STR testmem
I had to add all of the blank spaces in the last 5 spots of the array to keep "wierd" characters from being displayed. In the manual where it talks about strings in EEPROM, it says "No lenghth or terminator is automatically added", so I assume that's the reaon for the wierch characters, but don't really know how to fix it. I'm using the array of 8 since the LCD is a 2x8 display. Anyway, am I wasting my time here? Would I be better off just saying:
LCDOUT "BAD"
Sure could use some ideas on how to free up some space. Thanks,
Gary
Bookmarks