Ahhh ****, ok, so it means, that I cannot use this trick to save the strings to program flash.
OK, great, so is there any way, how could I store and use the strings more efficiently ?
Ahhh ****, ok, so it means, that I cannot use this trick to save the strings to program flash.
OK, great, so is there any way, how could I store and use the strings more efficiently ?
For PIC's that can't access their own flash, the next best option is POKECODE/PEEKCODE, which will work on any chip.
http://www.picbasic.co.uk/forum/showthread.php?p=51931
Notice how the "TOO LOW " and "TOO RICH" strings are stored.
And how it's displayed in the ShowMsg: routine. Just change the LCDOUT to HSEROUT.
It uses 1 word per character stored.
Plus about 30 words for the retreival code.
<br>
DT
Hello, Thanks Darrel and Skimask, I had in my pocket one 16F916 where this trick to store two chars to one pgm word is working well. I was able to rapidly decrease my code space. 1.5K instead of 4K. I will also test this POKECODE/PEEKCODE on my 16F648.
Thanks both of you...
I think, the EEPROM is not solution it has just 256 bytes and I need to store there some data and also external EEPROM will complicate the design. But maybe for the storage of lot of html code this could be the solution.
My webserver with Lantronix Direct port is working pretty well now. I have even some space to make the html more nicer)))
Boban
P.S. I am now thinking about the feature to have the possibility to store the hlml pages during runtime - kind of firmware update. My idea is to reserve the space in code memory like put there spaces and via webserver to have the service to upgrade the html code during the runtime. But I must check the assemler if it is possible to write to program code during the execution. Have no clue....
Would be a load easier just to add an external 24LCxxx serial eeprom and use that. 2 wires, I2Cread/I2Cwrite... Not much code space wasted, lots of room for add-ons...
Not much code space in a '916 as you're well aware I'm sure. Start adding HTML code as data in the program space, and you'll be out of space in no time flat...
Hello, the external eeprom will complicate the design, and if you are writting effectively html you could store almost 10 K of HTML = 5 K words and remaining 3 k of code, I have managed to store what I wanted. I have just little bit fighted with the fact, that if you are doing something like
@ da "abcd",10,"efgh",0 the da will pack 0 and 10 and it caused the cutting of my Strings. So I have decided to put to the end of each string not 0 but 0x7F and I have modified little bit the code to skip 0 byte and use 7F as separator. And it is working pretty well!!! Thanks everyone for help!!!
StringOut:
ReadCode Addr, TwoChars
Char = TwoChars >> 7
if Char = $7F THEN StringDone
if Char <> 0 then hserout [Char]
Char = TwoChars & $7F
if Char = $7F then StringDone
if Char <> 0 then hserout [Char]
Addr = Addr + 1
goto StringOut
StringDone:
return
That'll work!
Might use a few bytes for those extra 0's
You can put the "Escape codes" in the string, and it won't use the extra bytes.
@ da "abcd\nefgh",0
Might even be able to put the "Null terminator" in there too.Code:\a Bell (alert) character 07 \b Backspace character 08 \f Form feed character 0C \n New line character 0A \r Carriage return character 0D \t Horizontal tab character 09 \v Vertical tab character 0B \\ Backslash 5C \? Question mark character 3F \' Single quote (apostrophe) 27 \" Double quote character 22 \0OO Octal number (zero, Octal digit, Octal digit) \xHH Hexadecimal number
@ da "abcd\nefgh\x00"
But I haven't tried that yet.
<br>
DT
Hello Darrel, thanks a this helped I didn't know, taht I could use the escape sequences like in C or Java![]()
Bookmarks