This method consumes average 82 bytes per character, so for full, 255 character set, it will require 20K of program memory - too much....
This method consumes average 82 bytes per character, so for full, 255 character set, it will require 20K of program memory - too much....
Yes, ARRAWRITE quite wasteful and not "worth it" for simple things like static data.
There are other ways that are more efficient.Code:Select Case Z Case "A" FONTLINE[0] = 12 FONTLINE[1] = 23 FONTLINE[2] = 34 FONTLINE[3] = 45 FONTLINE[4] = 56 FONTLINE[5] = 78 FONTLINE[6] = 33 FONTLINE[7] = 44 Case "B" FONTLINE[0] = 42 FONTLINE[1] = 23 FONTLINE[2] = 34 FONTLINE[3] = 55 FONTLINE[4] = 56 FONTLINE[5] = 78 FONTLINE[6] = 93 FONTLINE[7] = 44 END SELECT
The FLASH memory of PIC16 devices are 14bits wide. If your characters are 7 pixels wide you can store 2 "lines" in each memory location. See, for example Richards code here:
http://www.picbasic.co.uk/forum/showthread.php?t=24171
Thanks!
Will try that "case" version and check, what amount of memory it will consume.
regarding the MAX7219 example, there's some ASM code doing "unpack".
Is it portable? I mean, can be used with other PIC hardware?
I did some quick tests yesterday and the arraywrite method consumes about double the space compared to loading the array "manually" - no where near 82 bytes though so I don't know what's going on there.
SELECT CASE uses slightly more space than multiple IF/THEN but it's cleaner and the execution time is always the same.
Since the memory width of PIC18 is 8 bits the method of packing two 7-bit wide "character lines" into one word isn't suitable for that series.
Of by the way, I "took apart" the code I've provided, and out of 82 bytes, ARRAYWRITE uses only 19, remaining is used by IF-THEN![]()
That sounds very very strange to me. I can't imagine that a single IF/THEN clause would "eat" 63 bytes.
I'm using PIC16F886.
Bookmarks