Is this a problem with PIC18 only, Richard? I haven't tried using a PSECT on PIC18, yet...
Is this a problem with PIC18 only, Richard? I haven't tried using a PSECT on PIC18, yet...
I'm working with a 18f25k22 and getting much grief getting a PSECT to work as intended .
I could store the font as const unsigned int font [][3] { {0,0,0},{……}} but it would be nice to have an include that can be used in either
pic16 or pic18 chips
Warning I'm not a teacher
Hi Richard.
I threw a couple PSECT tables into an XC8 program for an 18F14K22 and when I look at the .LST file it seems XC8 is avoiding those tables just as it should.
Code:/************************************************************************ * Digits '0' thru '9' of a 10x14 font * ************************************************************************/ #asm PSECT my10x14, class=CODE, abs, ovrld, space=0, delta=2 ORG 0x3E00 Font10x14: dw 0x0FFC, 0x1FFE, 0x3F07, 0x3383, 0x31C3, 0x30E3, 0x3073, 0x383F, 0x1FFE, 0x0FFC ; 48 '0' dw 0x0000, 0x0000, 0x300C, 0x300E, 0x3FFF, 0x3FFF, 0x3000, 0x3000, 0x0000, 0x0000 ; 49 '1' dw 0x300C, 0x380E, 0x3C07, 0x3E03, 0x3703, 0x3383, 0x31C3, 0x30E7, 0x307E, 0x303C ; 50 '2' dw 0x0C0C, 0x1C0E, 0x3807, 0x3003, 0x3003, 0x30C3, 0x30C3, 0x38C7, 0x1FFE, 0x0F3C ; 51 '3' dw 0x03C0, 0x03E0, 0x0370, 0x0338, 0x031C, 0x030E, 0x3FFF, 0x3FFF, 0x0300, 0x0300 ; 52 '4' dw 0x0C3F, 0x1C3F, 0x3833, 0x3033, 0x3033, 0x3033, 0x3033, 0x3873, 0x1FE3, 0x0FC3 ; 53 '5' dw 0x0FFC, 0x1FFE, 0x38C7, 0x30C3, 0x30C3, 0x30C3, 0x30C3, 0x39C7, 0x1F8E, 0x0F0C ; 54 '6' dw 0x0003, 0x0003, 0x0003, 0x0003, 0x3FC3, 0x3FE3, 0x0073, 0x003B, 0x001F, 0x000F ; 55 '7' dw 0x0F3C, 0x1FFE, 0x39E7, 0x30C3, 0x30C3, 0x30C3, 0x30C3, 0x39E7, 0x1FFE, 0x0F3C ; 56 '8' dw 0x003C, 0x007E, 0x30E7, 0x30C3, 0x38C3, 0x1CC3, 0x0EC3, 0x07E7, 0x03FE, 0x01FC ; 57 '9' #endasm /************************************************************************ * Packed 96 character 5x7 Font, 2.5-words-per-character, 240 words * ************************************************************************/ #asm PSECT myFonts, class=CODE, abs, ovrld, space=0, delta=2 ORG 0x3F00 Font5x7:
Last edited by Mike, K8LH; - 4th July 2018 at 00:01.
extract from .lst , it all looks good yet the font is not there.
Code:114 psect text 115 3E00 org 15872 ;# 116 3E00 117 ;# 118 3E00 0501 207F dw 1281,8319 ;# 119 3E02 0000 0000 0000 005F 0000 dw 0,0,0,95,0 ;# 120 3E07 0007 0007 0014 3F94 3F94 dw 7,7,20,16276,16276 ;# 121 3E0C 122A 3FAA 0923 0988 3262 dw 4650,16298,2339,2440,12898 ;# 122 3E11 1B49 2AA2 2800 0283 0000 dw 6985,10914,10240,643,0 ;# 123 3E16 001C 1141 0000 20A2 0E00 dw 28,4417,0,8354,3584 ;# 124 3E1B 0A08 1F08 0A08 043E 0408 dw 2568,7944,2568,1086,1032 ;# 125 3E20 0050 1800 0008 0408 0408 dw 80,6144,8,1032,1032 ;# 126 3E25 0060 3000 0020 0808 0202 dw 96,12288,32,2056,514 ;#
Warning I'm not a teacher
That's wierd. The tables show up in the LST file and in the HEX file but not in the Program Memory window...
Ok, section 6.2.9.3.4 in the XC8 User's Guide describes the PSECT "delta" parameter and as soon as I changed the parameters from "delta=2" to "delta=1" my two font tables showed up in the Program Memory window and my TBLPTR test code started working correctly in the simulator... Whew!
Last edited by Mike, K8LH; - 4th July 2018 at 06:26.
I agree , you would think writing word sized data would need delta=2.test code started working correctly in the simulator... Whew!
my brain hurts but it solves the problem , thanks mike
Warning I'm not a teacher
You're very welcome, Sir. And thank you for all the help and hard work you've provided.
BTW, I'm liking this 128x32 I2C SSD1306 OLED display a lot... With built-in RAM for a 128x64 display, you can basically have two display screens. You can write data to one screen while displaying the other then toggle the display screen. Should make easy work for cursor characters, flashing colon characters for a clock, or displaying "odometer" type sliding numbers.
Bookmarks