PDA

View Full Version : Please help with storing strings in codespace



g-hoot
- 15th May 2008, 17:40
Hello,
I have read Melanie's infamous "Making Program Code Space your playground..." post and some others and am trying to do what El AMPo posted below. I still don't grasp what "program code space" really is. I'm using a 16F648A and my program uses all 4K and I also have the EEPROM full of strings, but still need more space. So, since all of the 4K is used, is there still "program code space" that can be used? From what I've read, it sounds like the program would have to be smaller that the 4K and then I could use the rest for program code space, and then the strings would be smaller in program code space than in the regular code space?



--[To Write]--
Just include after the END tag of the program:

POKECODE @[start address],[byte0],[byte1],[byte2]....(up to 79)

(note: start address must be bigger than your program size, and the command only works when programming the pic)

--[To Read]--

(use something like...)

OUT var byte
y var word

For y = [start address] to [start address + nºbytes]
PEEKCODE y, OUT
Next y


I tried something like the code below, and I know it's basic, but I'm very ignorant with this stuff. The LCD displayed something like 237 (can't remember exactly, tried it at home last night). My assumption is that the variable "OUT" is filled in with the value, "AB" in this case, at programming time, so as soon as power is applied, it should display "AB" on the LCD once I have the code right...correct? I guess my mistake is pointing the PEEKCODE command to the correct memory location?



OUT var byte
y var word

pause1000
LCDOut OUT
pause1000
end

@ org $384 'start storing at 900
POKECODE A,B 'stor A and B
For y = 900 to 901
PEEKCODE y, OUT
Next y

mister_e
- 15th May 2008, 20:49
How about that famous....
http://www.pbpgroup.com/modules/wfsection/article.php?articleid=10

g-hoot
- 15th May 2008, 22:23
How about that famous....
http://www.pbpgroup.com/modules/wfsection/article.php?articleid=10

Yes, seen that one many times too. Ya know, I just remembered from back when you and some others helped me get going on storing the strings in EEPROM that "Flash Program Write" is disabled for the 16F648A. So, I guess that means that none of the program code space options will work for me. The peekcode/pokecode commands do use program code space right? I probably just need to do a new board design and go to a bigger chip. I do have a lot of features that I want to add and will need more pins anyway at some point.
Gary

skimask
- 16th May 2008, 01:02
The peekcode/pokecode commands do use program code space right? I probably just need to do a new board design and go to a bigger chip. I do have a lot of features that I want to add and will need more pins anyway at some point.
Probably as you said, need to go to a bigger chip...but...
If you think about it a bit, depending on how your hardware is set up, you might be able to stack a serial eeprom chip, like a 24LC256 on TOP of your 16F648 chip (assuming it's a DIP style chip) and store all of your strings in it that way.
It's kinda a half-a$$ way of doing things, but hey, if it works........ :D