Will the "different messages" come from an external source or there will be a fixed pattern inside the program and once the PIC is programmed then that fixed pattern will never be changed?Originally Posted by RUBiksCUbe
--------
Will the "different messages" come from an external source or there will be a fixed pattern inside the program and once the PIC is programmed then that fixed pattern will never be changed?Originally Posted by RUBiksCUbe
--------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
As Sayzer is hinting, if your data does not change after you do the initial programming, you could use the LOOKUP or LOOKUP2 command. (or just the READCODE command referenced below if you preloaded your data)
If your data is going to change, you could use WRITECODE and READCODE. Also see: http://www.picbasic.co.uk/forum/showthread.php?t=137 for reference
Paul Borgmeier
Salt Lake City, UT
USA
__________________
The READCODE command actually looks perfect for me. Thanks for pointing that out.
The PIC will switch between different messages when external buttons are pushed.
Well, it was too good to be true. Whenever I compile with this in my project:
I get some nice errors:Code:Asm CODE 1400 DB 0 DB 220 DB 476 DB 384 DB 384 DB 476 DB 220 DB 0 DB 999 Endasm
Found directive in column 1. (CODE)
Directive only allowed when creating an object file
Found directive in column 1. (DB)
Argument out of range. Least significant bits used.
There are 15 errors total, but they're all just copies of those 4.
Am I missing something?
You need to indent your program like that below. However, I believe DB is used for bytes only and you must use packing to place the word (i.e., DB 476 will not do what you want)? Others with more 16 bit processor Assembly experience might be able to offer a (better) solution in ASM.
You might want to consider using PBP's WRITECODE instead of the ASM for the initial write. Look here http://www.picbasic.co.uk/forum/show...ight=writecode and also search “WRITECODE” on this forum for examples of how to write to the 18F family, which is not as straight forward as one might think.
Good LuckCode:Asm CODE 1400 DB 0 DB 220 DB 476 DB 384 DB 384 DB 476 DB 220 DB 0 DB 999 Endasm
edit: or consider LOOKUP2 tables
Last edited by paul borgmeier; - 3rd September 2006 at 09:29. Reason: added option?
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Originally Posted by paul borgmeier
I also was going to suggest LOOKUP table but arrays can not be used with Lookup tables!
Say there are 90 messages.
Code:'This code is just a part of the idea to start from somewhere. Message var byte[90] MessageTemp var byte Loop var byte for loop = 0 to 89 lookup loop,[$AA,$2C,$4D,.....................], MessageTemp message[loop]=messageTEMP next loop
This way,
Originally Posted by RUBiksCUbe
can be achieved.
------------------------------------
-------
Last edited by sayzer; - 3rd September 2006 at 14:22.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
I never knew about LOOKUP, but the lookup and loop should work perfectly. The intenting fixed the "DB"s but the "CODE" line still causes a problem, so I'm going to abandon READCODE and just stick with LOOKUP.
Thanks!
Bookmarks