CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Pic16f690 Data item too big error

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ilker07



Joined: 03 Jun 2022
Posts: 18

View user's profile Send private message

Pic16f690 Data item too big error
PostPosted: Tue Dec 12, 2023 2:06 am     Reply with quote

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: 290

View user's profile Send private message

PostPosted: Tue Dec 12, 2023 6:47 am     Reply with quote

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: 9124
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Dec 12, 2023 6:55 am     Reply with quote

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: 19245

View user's profile Send private message

PostPosted: Tue Dec 12, 2023 7:28 am     Reply with quote

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: 9124
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Dec 13, 2023 8:14 pm     Reply with quote

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: 19245

View user's profile Send private message

PostPosted: Thu Dec 14, 2023 2:03 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group