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

10F206

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



Joined: 11 Nov 2006
Posts: 181
Location: Birmingham, UK

View user's profile Send private message

10F206
PostPosted: Wed Oct 17, 2018 1:48 pm     Reply with quote

Hi,
I am trying to use a 10F206 for the first time.
I want to use idiv, which the help says is available for all devices.
However, when I add #include <stdlib.h>, I get a raft of errors, the first being char digits[]="0123456789abcdefghijklmnopqstuvwxyz"; data item too long!

So, is idiv not for all devices or how do I stop all these errors please?

Brian
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Oct 17, 2018 2:03 pm     Reply with quote

I just looked at the data sheet, 512 words for program, 24 bytes for RAM. You don't show your complete program but I suspect you're out of memeory !
Your array is 37 bytes so that exceeds the RAM amount..

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Oct 17, 2018 2:08 pm     Reply with quote

It's complaining, because the amount of RAM in the chip is so small that it 'knows' it can't actually store this array if required to. However this is part of the strtoul function, not the div function (the function is actually div, not idiv).
So simply REM this function out. Add a /* the line in front of strtoul, and a */ the line after the end of the function, save the result with your project, and change the load to #include "stdlib.h", which will make it load the local copy.

The core reason is simply that the manual section here 'predates' the introduction of these ultra small chips.

However be aware that you are unlikely to be able to do anything actually with the function. The amount of RAM in the chips is so small that you will not have space to do pretty much anything involving division....

Code:

#include <10F206.h>
#use delay(internal=4MHz)
#include "stdlib.h"

void main()
{
   div_t val;
   val=div(3,2);
   
   while(TRUE)
   {
   }
}


On it's own uses 79% of the available RAM in the chip... Sad
BLL



Joined: 11 Nov 2006
Posts: 181
Location: Birmingham, UK

View user's profile Send private message

10F206
PostPosted: Wed Oct 17, 2018 3:05 pm     Reply with quote

Hi respondents and thanks for the suggestions.

It is now working, but using 92% RAM!

Thanks

Brian
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