Out of Data Space

38 views
Skip to first unread message

FraserSmith51

unread,
Feb 21, 2026, 10:15:32 AM (3 days ago) Feb 21
to jallist
Hi

I have a program running on a PIC16F18346 that contains code for driving a WS2812 string. At the moment I have 80 devices and it compiles with Code area 7298 of 16384 and Data area with 604 of 2048. This works fine on the demo rig that I have. I now want to have the program drive 146 devices but compilation failed with Out of Data Space at that. Working backwords i ended up with needing to go back to 80. Even 81 wouldn't compile. Quite confused as to why it won't work with the bigger number

As I have built this program up bit by bit I have quite a lot of the configuration and code in separate include files. I hope the ZIP file attachment has all that's needed. 

I hope that someone can shed some light on this problem.

Chers

Fraser
Ambience_Controller_WS2812.zip

pinhe...@gmail.com

unread,
Feb 21, 2026, 3:06:19 PM (3 days ago) Feb 21
to jallist
Hi

Your arrays may not exceed the size of a ram page, which is 80 bytes.

Try using the large_array lib, but this could pose problems with the sensitive timings for the WS leds.




--
You received this message because you are subscribed to the Google Groups "jallist" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallist+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jallist/19974d5e-88bb-4ad7-9fb7-a3f941dc9132n%40googlegroups.com.

FraserSmith51

unread,
Feb 22, 2026, 5:01:05 AM (2 days ago) Feb 22
to jallist
Thanks Pinhead

I'll see if I can get that to work.

Cheers

Fraser

Patrick FROUCHT

unread,
Feb 22, 2026, 5:33:46 AM (2 days ago) Feb 22
to jal...@googlegroups.com
Hello Fraser
My system is much simpler than yours but works xith. 252 ledsI have 6 main colors and up to 42 loop to get a max figure value less than 255
I have built for Christmas a string of 252 leds with various lighting effects using a PIC12F1840 
After compilation I get: Code   :3029/4096    Data:126/256  Hardware Stack : 3/16  Software Stack :80
The "only" problem I had was wanting to add a "complex" procedure : the stack system could not afford  nested procedures.

Simplify your SW leaving only the SW for the  WS2812 building up when you are satisfied with what you get.


Patrick


noname

FraserSmith51

unread,
Feb 22, 2026, 5:43:18 AM (2 days ago) Feb 22
to jallist
OK, I now have the large arrays defined by using code from 16f1825_large_array.jal.
const WS2812B_NUM = 176
;target_cpu == PIC_16
const _large_array_core=16

const large_array_1_size = ws2812b_num
const LARGE_ARRAY_1_VARIABLE_SIZE = 1
include large_array_1
const large_array_2_size = ws2812b_num
const LARGE_ARRAY_2_VARIABLE_SIZE = 1
include large_array_2
const LARGE_ARRAY_3_VARIABLE_SIZE = 1
const large_array_3_size = ws2812b_num
include large_array_3
alias agrn is large_array_1               -- grn array
alias ared is large_array_2               -- red array
alias ablu is large_array_3               -- blu array


when I compile it fails with 
my_procedures.jal:311: Too few parameters (1 expected, 0 found)
my_procedures.jal:311: type mismatch
my_procedures.jal:311: Too few parameters (1 expected, 0 found)
my_procedures.jal:311: type mismatch
my_procedures.jal:311: Too few parameters (1 expected, 0 found)
my_procedures.jal:311: type mismatch

where 311 is the last line in the block below. It doesn't see any problem with the lines above that and it has worked before the large arrays were involved.

   for WS2812B_NUM using i loop
      if (i >= ws2812_start_1) & (i <= ws2812_finish_1) then              
         agrn[i] = byte(grn_val)
         ared[i] = byte(red_val)
         ablu[i] = byte(blu_val)
      else
         agrn[i] = 0
         ared[i] = 0
         ablu[i] = 0
      end if
   end loop

   ws2812b_refresh(agrn, ared, ablu)

What am I missing?

Cheers

Fraser

FraserSmith51

unread,
Feb 22, 2026, 6:06:50 AM (2 days ago) Feb 22
to jallist
Hi Patrick

I would be interested in seeing your program. I am trying to get different lighting conditions for a model railway taking in a cycle of a whole day with sun and moon moving along the strip so really wanting subtle changes in colour. Not sure if your six main colours would do that so well but I guess it's worth a look at your method.

You can contact me via the MERG Tayside Area Group

Cheers

Fraser

Rob CJ

unread,
Feb 22, 2026, 12:26:49 PM (2 days ago) Feb 22
to jallist
Hi Fraser,

I compiled your program 'setup_everithing.jal' after including your example for large array in Ambience_Controller_ws2812.jal

It compiles with a warning but that seems to be OK. Not sure if this is the whoo program since the code area seems to be very small.

jal jalv25r9 (compiled Jan 12 2025)
generating p-code
737 tokens, 475257 chars; 11841 lines; 28 files
generating PIC code pass 1
generating PIC code pass 2
39 branches checked, 0 errors
222 data accesses checked, 0 errors
6 skips checked, 0 errors
writing result
/home/rob/Tools/Jallib/lib/ws2812b_common.jal:56: warning: "WS2812B_NUM not defined, defaults to 30"
Code area: 555 of 16384 used (words)
Data area: 37 of 2048 used
Software stack available: 80 bytes
Hardware stack depth 2 of 16
0 errors, 1 warnings
 *  Press any key to close the terminal. 

Van: jal...@googlegroups.com <jal...@googlegroups.com> namens FraserSmith51 <fra...@cairntoul.net>
Verzonden: zondag 22 februari 2026 11:43
Aan: jallist <jal...@googlegroups.com>
Onderwerp: Re: [jallist] Out of Data Space
 

Patrick FROUCHT

unread,
Feb 22, 2026, 12:30:10 PM (2 days ago) Feb 22
to jal...@googlegroups.com
Hi Fraser

As  told before, my program is much simpler and has only six different colors active.yellow light rust color the 
At the beginning there is a general rust yellow color then many white flashes. Then a blue red white full color in various configurations with chasing effect. 
Then the five olympic colors(white or black green red blue yellow) plus purple. Chasing each other.
I don't have the subtle evolution you are looking for.
The added file is my program and randm3.jaj which is much simpler(also less program space and time to execute) than the random.jal. 

Don't hesitate to ask

Patrick





Noel_guirlande_255_ledsX.jal
random3.jal

FraserSmith51

unread,
Feb 22, 2026, 2:58:21 PM (2 days ago) Feb 22
to jallist
Hi Rob

Thanks for having a look at my code. Apologies as I should have said that the main part of the code is Ambience_Controller_WS2812.jal. That will give you a significantly bigger file.

Maybe that will help you to find my problem.

Thanks again

Fraser

Rob CJ

unread,
Feb 23, 2026, 1:10:54 PM (yesterday) Feb 23
to jallist
Hi Fraser,

It took me some time to get it compiled since the order in which files where included it did not compile in the version you sent. Maybe it was not a final version?

But I could reproduce it and the problem is caused by the fact that large array is not really an array but a trick to make a large array and apparently you cannot pass this type of array as a parameter. I tested it by using the standard data array with a limited number of bytes (<80) and then the problem is gone.

It is also the first time I ran into this issue. The solution I know at this moment if you would switch to a PIC18F. There an array can be 256 bytes per array.

Kind regards,

Rob



Verzonden: zondag 22 februari 2026 20:58

Aan: jallist <jal...@googlegroups.com>
Onderwerp: Re: [jallist] Out of Data Space

FraserSmith51

unread,
Feb 23, 2026, 5:37:15 PM (21 hours ago) Feb 23
to jallist
Thanks Rob,

The program should be compiled via the Ambience_Controller_WS2812.JAL file. The program is someting that I have been working on intermittantly for several years and It really needs a big tidy up. I started with rain then added thunder. Then came the DFPlayers for trains, city sounds, Big Ben and RGB strip. The reason for recent changes has been to add WS2812 LEDs to get a sun or moon to cross the sky. The 10 chosen WS2812 LEDs work their way along the strip to give some form of directional lighting. It is supplemented by an RGB strip and shares the RGB colour values with the simpler LEDs.

It's too late in the day to start working on your suggestions but I will get back to it in the next day or so. 

Thanks again

Fraser

Mike

unread,
Feb 23, 2026, 8:59:11 PM (18 hours ago) Feb 23
to jallist
It wouldn't be difficult to code for handling separate smaller arrays, like:

if index < 74 then
    ws2812b_refresh(agrn1, ared1, ablu1)
else
    ws2812b_refresh(agrn2, ared2, ablu2)
end if

Rob CJ

unread,
1:19 AM (13 hours ago) 1:19 AM
to jallist
Hi Fraser, Mike,

There is a workaround and that is using the code of ws2812b_common in your own program.

So instead of calling ws2812b_refresh() use the code of routine itself:

   var bit old_gie
   var byte i

   old_gie = INTCON_GIE                      -- save interrupt state
   INTCON_GIE = disabled                     -- temporary disable interrupts
   for WS2812B_NUM using i loop              -- all pixels
      _ws2812b_write_pixel(agrn[i], ared[i], ablu[i])
   end loop
   INTCON_GIE = old_gie                      -- restore interrupt state
   delay_10us(5)                             -- reset

So you do not pass the large array as a parameter. Mabybe nog so nice but it should work.

Kind regards,

Rob


Van: 'Mike' via jallist <jal...@googlegroups.com>
Verzonden: dinsdag 24 februari 2026 02:59
Reply all
Reply to author
Forward
0 new messages