View previous topic :: View next topic |
Author |
Message |
ilker07
Joined: 03 Jun 2022 Posts: 32
|
Pic16f690 Data item too big error |
Posted: Tue Dec 12, 2023 2:06 am |
|
|
Hi guys I wanna store at least 1000 unsigned int16 data or more in Pic16f690 but I get data item too big error.How can I handle that?Do I need to do any configuration in ccs c or using any command?I use v5.015.
#include <16F690.h>
#fuses NOWDT,NOPROTECT,NOMCLR
#use delay(clock=4000000)
#define LENGTH 1000
unsigned int16 arr[LENGTH];
void main()
{
while(True) {
}
} |
|
|
gaugeguy
Joined: 05 Apr 2011 Posts: 303
|
|
Posted: Tue Dec 12, 2023 6:47 am |
|
|
Maybe you should start by reading the data sheet. Especially the RAM size of the part you are using. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Tue Dec 12, 2023 6:55 am |
|
|
hmm...from this dinosaur's memory that PIC has 256 bytes of RAM...
Going to be difficult to store 1000 , 16 bit values into 256 , 8 bit locations !!
And that's without subtracting any RAM for other variables used in the program.
If the data has a 'pattern' it may be possible to 'encode' using specific bits to decode but I suspect the 'data' are random 16 bit values.
In the good old days, we HAD to pack data, use bits this way as RAM was very,very small. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Tue Dec 12, 2023 7:28 am |
|
|
As others have said, your chip is just too small for this. In fact 1000 16bit
values needs a much larger PIC. You say 'store', but don't say whether
these are things that need to be variable, or fixed?. This makes a huge
difference.
I must admit, I cannot think of any common 20pin PIC that would be large
enough to hold these in RAM. You have chosen a chip designed to do really
small jobs, and are then trying to ask it to do what (in PIC terms), is a
large job.
The PIC16F18046, is the only 20pin PIC16 that potentially has enough
RAM to handle this, but even this only just has enough room, and you
would run out once any other values are used (so a counter to index
the array for example). The PIC18F16Q20/40/41 have more space, but
requires the PCH compiler instead of PCM which you presumably have?.
You need to understand that the name PIC stands for Peripheral Interface
Controller. Specifically a really small processor designed just to do tiny
jobs involved in interfacing. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Wed Dec 13, 2023 8:14 pm |
|
|
I'm kinda curious as to what the array of 1000, 16 bit variables is for ?
Since stored in RAM, the data must come from 'somewhere' to do 'something' ?
Perhaps there's another way to handle the 'data' ?
A brief description of the needs of the program may shed some light on an easy, possible solution ! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Thu Dec 14, 2023 2:03 am |
|
|
You had already alluded to that before.
Very true.
For example, if they are ADC readings, you could halve the amount of
storage, by using simple 'delta' values. Still too large for this chip, but a
lot less room needed.
If you look at audio ADC's, they commonly use single bit delta encoding.
Can reduce the data needed by perhaps 10:1. |
|
|
|