View previous topic :: View next topic |
Author |
Message |
eem2am
Joined: 18 Jul 2012 Posts: 21
|
Program is too large error |
Posted: Mon Jul 23, 2012 8:30 am |
|
|
I am writing C for PIC10F200, and MPLAB is giving me the following error:
*** Error 71 "xenon.c" Line 303(0,1): Out of ROM, A segment or the program is too large MAIN
..............is this because my program is too big for the PIC10F200's ROM memory?
Here is the code...............
Code: |
//////////////////////////////////////////////////////////////////////////
#include <10F200.h>
#use standard_io(B)
#use delay(clock=4M)
#fuses NOWDT,NOPROTECT,NOMCLR
#define PIN_TRIGGER PIN_B0 // Output high to trigger
#define PIN_SYNC PIN_B1 // Output low to send sync pulse; Input when listen for sync pulse
#define PIN_PHASE PIN_B2 // Input low flashes IN sync; Input high = anti sync;
// Low to high at 50Hz means AC input, so flash in sync.
#define PIN_FPM PIN_B3 // Input high = 75FPM; Input low = 60FPM
#define ANTI_SYNC 1
#define IN_SYNC 0
#define FPM60 1
#define AC 0
#define DC 1
#define YES 1
#define NO 0
//Remember to disable internal pullups
//Remember to enable watchdog and add clrwdt instuctions
//Remember to calibrate the internal oscillator.
//Are they outputs or inputs by default.?...or are they high impedance by default?
//can you set a port to high Z by just reading from it?
//STATUS REGISTER, Option register,
//DECLARE GLOBAL VARIABLES
short int ACDCflag = DC; //High = DC; Low = AC
short int PHASEflag = IN_SYNC; //Low = in-sync; High = out-of-sync
short int FPMflag = FPM60; //High = 60FPM; Low = 75FPM
short int value=0;
short int value1=0;
short int SYNC_pulse_detected=NO;
int i;
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
void inphase_60FPM(void) {
while(1) {
SYNC_pulse_detected = NO;
output_bit(PIN_TRIGGER,1); //SEND TRIGGER PULSE
delay_us(10);
output_bit(PIN_TRIGGER,0);
//10ms
output_bit(PIN_SYNC,0); //SEND SYNC PULSE
delay_ms(10);
value = input(PIN_SYNC); //SETS PIN_SYNC to High Impedance.
delay_ms(30); //Dont listen for sync pulses within 30ms of the sent SYNC pulse.
//40ms
for (i=0; i<205; i++){
if (!input(PIN_SYNC)) {SYNC_pulse_detected = YES; break; }
delay_ms(2);
} //next i
if (SYNC_pulse_detected == YES) {continue;}
//450ms
delay_ms(100); //STOP LISTENING FOR SYNC PULSE DUE TO CPI "SECOND" PULSE.
//550ms
for (i=0; i<210; i++){
if (!input(PIN_SYNC)) {SYNC_pulse_detected = YES; break; }
delay_ms(2);
} //next i
//970ms
if (SYNC_pulse_detected == YES) {continue;}
delay_ms(30); //Dont listen for sync pulses within 30ms of the sent SYNC pulse.
//1000ms
}
} // end of
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
void antiphase_60FPM(void) {
while(1) {
SYNC_pulse_detected = NO;
output_bit(PIN_SYNC,0); //SEND SYNC PULSE
delay_ms(10);
value = input(PIN_SYNC); //SETS PIN_SYNC to High Impedance.
//10ms
delay_ms(30); //Dont listen for sync pulses within 30ms of the sent SYNC pulse.
//40ms
for (i=0; i<205; i++) {
if (!input(PIN_SYNC)) {SYNC_pulse_detected = YES; break; }
delay_ms(2);
} //next i
if (SYNC_pulse_detected == YES) {continue;}
//450ms
delay_ms(50); //STOP LISTENING FOR SYNC PULSE DUE TO CPI "SECOND" PULSE.
output_bit(PIN_TRIGGER,1); //SEND TRIGGER PULSE
delay_us(10);
output_bit(PIN_TRIGGER,0);
delay_ms(50); //STOP LISTENING FOR SYNC PULSE DUE TO CPI "SECOND" PULSE.
//550ms
for (i=0; i<210; i++){
if (!input(PIN_SYNC)) {SYNC_pulse_detected = YES; break; }
delay_ms(2);
} //next i
if (SYNC_pulse_detected == YES) {continue;}
//970ms
delay_ms(30); //Dont listen for sync pulses within 30ms of the sent SYNC pulse.
}
} // end of
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
void inphase_75FPM(void) {
while(1) {
SYNC_pulse_detected = NO;
output_bit(PIN_TRIGGER,1); //SEND TRIGGER PULSE
delay_us(10);
output_bit(PIN_TRIGGER,0);
//10ms
output_bit(PIN_SYNC,0); //SEND SYNC PULSE
delay_ms(10);
value = input(PIN_SYNC); //SETS PIN_SYNC to High Impedance.
delay_ms(30); //Dont listen for sync pulses within 30ms of the sent SYNC pulse.
//40ms
for (i=0; i<155; i++) {
if (!input(PIN_SYNC)) {SYNC_pulse_detected = YES; break; }
delay_ms(2);
} //next i
if (SYNC_pulse_detected == YES) {continue;}
//350ms
delay_ms(100); //STOP LISTENING FOR SYNC PULSE DUE TO CPI "SECOND" PULSE.
//450ms
for (i=0; i<110; i++) {
if (!input(PIN_SYNC)) {SYNC_pulse_detected = YES; break; }
delay_ms(2);
} //next i
//770ms
if (SYNC_pulse_detected == YES) {continue;}
delay_ms(30); //Dont listen for sync pulses within 30ms of the sent SYNC pulse.
//800ms
}
} // end of
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
void antiphase_75FPM(void) {
while(1){
SYNC_pulse_detected = NO;
output_bit(PIN_SYNC,0); //SEND SYNC PULSE
delay_ms(10);
value = input(PIN_SYNC); //SETS PIN_SYNC to High Impedance.
//10ms
delay_ms(30); //Dont listen for sync pulses within 30ms of the sent SYNC pulse.
//40ms
for (i=0; i<155; i++) {
if (!input(PIN_SYNC)) {SYNC_pulse_detected = YES; break; }
delay_ms(2);
} //next i
if (SYNC_pulse_detected == YES) {continue;}
//350ms
delay_ms(50); //STOP LISTENING FOR SYNC PULSE DUE TO CPI "SECOND" PULSE.
output_bit(PIN_TRIGGER,1); //SEND TRIGGER PULSE
delay_us(10);
output_bit(PIN_TRIGGER,0);
delay_ms(50); //STOP LISTENING FOR SYNC PULSE DUE TO CPI "SECOND" PULSE.
//450ms
for (i=0; i<110; i++) {
if (!input(PIN_SYNC)) {SYNC_pulse_detected = YES; break; }
delay_ms(2);
} //next i
if (SYNC_pulse_detected == YES) {continue;}
delay_ms(30); //Dont listen for sync pulses within 30ms of the sent SYNC pulse.
//970ms
}
} // end of
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//**********************************************************************************************
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
void sixtyFPM(void) {
if (PHASEflag == ANTI_SYNC) {antiphase_60FPM();}
inphase_60FPM();
} // end of
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
void seventyFiveFPM(void) {
if (PHASEflag == ANTI_SYNC) {antiphase_75FPM();}
inphase_75FPM();
} // end of
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//**********************************************************************************************
//M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
// Main program starts here
void main(void)
{
//Disable port B pullups
// port_b_pullups(FALSE);
//ENSURE TIGGER OUTPUT IS LOW
output_bit(PIN_TRIGGER, 0);
delay_ms(100); //Start up delay
//SET FPM FLAG
FPMflag = input(PIN_FPM);
//SET PHASE FLAG
PHASEflag = input(PIN_PHASE);
//SEE IF AC or DC
for (i=0; i < 20; i++) {
value = input(PIN_PHASE);
delay_ms(5);
value1 = input(PIN_PHASE);
if (value != value1) {ACDCflag = AC; break; }
}
//DELAY TO ENSURE TUBE CAPACITOR HAS CHARGED UP ENOUGH TO FLASH THE TUBE.
delay_ms(600);
//BRANCH DEPENDING ON FPM
if (FPMflag == FPM60) {sixtyFPM();}
seventyFiveFPM();
} // end of main
//M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Mon Jul 23, 2012 9:09 am |
|
|
Yes.
The chip only allows 256 instructions _total_. By the time you have perhaps 30 or more for delays, some I/O, etc., you have 'no hope'. Try recompiling for the 202, which supports twice the ROM, and you may have a faint hope, but it is going to be very tight....
Best Wishes |
|
|
eem2am
Joined: 18 Jul 2012 Posts: 21
|
|
Posted: Mon Jul 23, 2012 9:37 am |
|
|
Thanks,
When i "Build All", is there any way of seeing how big the too-big program is.
so that i know how much i need to trim it back.
Also, if i call a function, can i not then call another function from within that function?
(something to do with the stack?) |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Mon Jul 23, 2012 10:57 am |
|
|
Even though your stack is tiny, a CALLABLE routine utilizing timer0, with a 16 bit argument to count a single quantity in "rollover ticks", could replace the vast amount of inline code consumption traceable to all those delay_ms/us calls.
I used that approach with an overfull 16c505 years ago, and if you really can't figure out the 'how' of it - I would post enough of what I wrote then to move you forward. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jul 23, 2012 11:25 am |
|
|
Quote: | When i "Build All", is there any way of seeing how big the too-big program is ?
|
The quick way is to do what Ttelmah suggested - temporarily change
the #include line to the 10F202.h and re-compile. The compiled code
will fit in that PIC and you can look at the top of the .LST file and see
how much ROM is used. You can also browse the .LST file and see what
code or functions are using the most ROM. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Mon Jul 23, 2012 12:22 pm |
|
|
in case it will help you :
Code: |
// 4 mhz -> 1 mhz - div_1 , timer0 rollover = 3906 hz or 256 usec per TIX
// yielding a 16 sec total range ( bummer no OVF flag in 10f parts ;-(( )
// in main: setup_timer0 for div 1 prescalar, internal clock
// i round off to 250 usecs for simplicity
// just be sure you call with a non zero value for tix
unsigned int16 tix=1;
// set global 'tix' to the number of 250 usec increments to delay
// as this is more efficient in use of code than my original version
// as in tix=100; delay_utix256();
void delay_utix256(void){
unsigned int8 newtimer, oldtimer=0;
set_timer0(0);
do{
newtimer=get_timer0();
if (newtimer<oldtimer) --tix; // detect overflow
oldtimer=newtimer;
// also you can check an early exit condition HERE and RETURN;
}while(tix);
}
|
Last edited by asmboy on Tue Jul 24, 2012 4:28 pm; edited 1 time in total |
|
|
eem2am
Joined: 18 Jul 2012 Posts: 21
|
|
Posted: Tue Jul 24, 2012 2:18 am |
|
|
Hi Thanks,
Ive compiled with the PIC10F202.h and it says that it uses 67% ROM.
so does that mean 67% of 512 bytes = 343 bytes....meaning that i have 343-256 = 87 bytes of ROM to get rid of.
Also, how do i know how much RAM the PIC10F200 has?
I am using 25% RAM onPIC10F202.h but does that mean it'll be too much for the PIC10F200.h? |
|
|
eem2am
Joined: 18 Jul 2012 Posts: 21
|
|
Posted: Tue Jul 24, 2012 2:53 am |
|
|
My code is smaller now but still not small enough.
asmboy if i use your delay using the timer will that be better than using a delay_ms(10) and then calling that in a for loop for longer delays?
Code: | #include <10F202.h>
#use standard_io(B)
#use delay(clock=4M)
#fuses NOWDT,NOPROTECT, NOMCLR
#define PIN_TRIGGER PIN_B0 // Output high to trigger
#define PIN_SYNC PIN_B1 // Output low to send sync pulse; Input when listen for sync pulse
#define PIN_PHASE PIN_B2 // Input low flashes IN sync; Input high = anti sync;
// Low to high at 50Hz means AC input, so flash in sync.
#define PIN_FPM PIN_B3 // Input high = 75FPM; Input low = 60FPM
#define ANTI_SYNC 1
#define IN_SYNC 0
#define FPM60 1
#define FPM75 0
#define AC 0
#define DC 1
#define YES 1
#define NO 0
//Remember to disable internal pullups
//Remember to enable watchdog and add clrwdt instuctions
//Remember to calibrate the internal oscillator.
//Are they outputs or inputs by default.?...or are they high impedance by default?
//can you set a port to high Z by just reading from it?
//STATUS REGISTER, Option register,
//DECLARE GLOBAL VARIABLES
short int ACDCflag = DC; //High = DC; Low = AC
short int PHASEflag = IN_SYNC; //Low = in-sync; High = out-of-sync
short int FPMflag = FPM60; //High = 60FPM; Low = 75FPM
short int value=0;
short int value1=0;
short int SYNC_pulse_detected=NO;
int i;
void send_trigger_pulse(void) {
output_bit(PIN_TRIGGER,1); //SEND TRIGGER PULSE
delay_us(10);
output_bit(PIN_TRIGGER,0);
}
void send_sync_pulse(void) {
output_bit(PIN_SYNC,0); //SEND SYNC PULSE
delay_ms(10);
value = input(PIN_SYNC); //SETS PIN_SYNC to High Impedance.
}
///////////////////////////////////////////////////////////////////////////////////////////
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
void sixtyFPM(void) {
while(1) {
SYNC_pulse_detected = NO;
if (PHASEflag == IN_SYNC) {send_trigger_pulse();}
//10ms
send_sync_pulse();
for (i=0; i<3; i++) { //Dont listen for sync pulses within 30ms of the sent SYNC pulse.
delay_ms(10);
}//next i
//40ms
for (i=0; i<205; i++) {
if (!input(PIN_SYNC)) {SYNC_pulse_detected = YES; break; }
delay_ms(2);
} //next i
if (SYNC_pulse_detected == YES) {continue;}
//450ms
for (i=0; i<5; i++) { //STOP LISTENING FOR SYNC PULSE DUE TO CPI "SECOND" PULSE.
delay_ms(10);
}//next i
if (PHASEflag == ANTI_SYNC) {send_trigger_pulse();}
for (i=0; i<5; i++) { //STOP LISTENING FOR SYNC PULSE DUE TO CPI "SECOND" PULSE.
delay_ms(10);
}//next i
//550ms
for (i=0; i<210; i++) {
if (!input(PIN_SYNC)) {SYNC_pulse_detected = YES; break; }
delay_ms(2);
}//next i
//970ms
if (SYNC_pulse_detected == YES) {continue;}
for (i=0; i<3; i++) { //Dont listen for sync pulses within 30ms of the sent SYNC pulse.
delay_ms(10);
}//next i
//1000ms
}
} // end of
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
void seventyfiveFPM(void) {
while(1) {
SYNC_pulse_detected = NO;
if (PHASEflag == IN_SYNC) {
send_trigger_pulse();
}
delay_ms(10);
//10ms
output_bit(PIN_SYNC,0); //SEND SYNC PULSE
delay_ms(10);
value = input(PIN_SYNC); //SETS PIN_SYNC to High Impedance.
for (i=0; i<3; i++) { //Dont listen for sync pulses within 30ms of the sent SYNC pulse.
delay_ms(10);
}//next i
//40ms
for (i=0; i<155; i++) {
if (!input(PIN_SYNC)) {SYNC_pulse_detected = YES; break; }
delay_ms(2);
} //next i
if (SYNC_pulse_detected == YES) {continue;}
//350ms
for (i=0; i<5; i++) { //STOP LISTENING FOR SYNC PULSE DUE TO CPI "SECOND" PULSE.
delay_ms(10);
}//next i
if (PHASEflag == ANTI_SYNC) {send_trigger_pulse();}
for (i=0; i<5; i++) { //STOP LISTENING FOR SYNC PULSE DUE TO CPI "SECOND" PULSE.
delay_ms(10);
}//next i
//450ms
for (i=0; i<110; i++) {
if (!input(PIN_SYNC)) {SYNC_pulse_detected = YES; break; }
delay_ms(2);
}//next i
//770ms
if (SYNC_pulse_detected == YES) {continue;}
for (i=0; i<3; i++) { //Dont listen for sync pulses within 30ms of the sent SYNC pulse.
delay_ms(10);
}//next i
//800ms
}
} // end of
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
///////////////////////////////////////////////////////////////////////////////////////////
//M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
// Main program starts here
void main(void)
{
//Disable port B pullups
// port_b_pullups(FALSE);
//ENSURE TIGGER OUTPUT IS LOW
output_bit(PIN_TRIGGER, 0);
for (i=0; i<10; i++) { //Start up delay
delay_ms(10);
}//next i
//SET FPM FLAG
FPMflag = input(PIN_FPM);
//SET PHASE FLAG
PHASEflag = input(PIN_PHASE);
//SEE IF AC or DC
for (i=0; i < 20; i++) {
value = input(PIN_PHASE);
delay_ms(5);
value1 = input(PIN_PHASE);
if (value != value1) {ACDCflag = AC; break; }
}//next i
//DELAY TO ENSURE TUBE CAPACITOR HAS CHARGED UP ENOUGH TO FLASH THE TUBE.
for (i=0; i<60; i++) { //Start up delay
delay_ms(10);
}//next i
//BRANCH DEPENDING ON FPM
if (FPMflag == FPM60) { sixtyFPM();}
seventyfiveFPM();
} // end of main
//M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
im just wondering if int i should be a long int in order for it to be able to count up to 210?
After all, an int is only 8 bits, and with the sign bit thats down to 7 bits which means 127 maximum? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Tue Jul 24, 2012 3:12 am |
|
|
Data sheet is your friend.
10F200 256words of ROM, 16bytes RAM
10F202 512words of ROM, 24 bytes of RAM
So your 25% is only 6 locations, which will fit in the 200 easily.
Generally, software delays are always a little 'bulky'. The loop is tweaked in length, to give a sub time. and then called multiple times internally. I'd guess that asmboy's code will save significant amount, but not 87 words.
You can save a few more words, by switching to fast_io. You will need to add one instruction to setup TRIS then, but _every_ output and input instruction will then be one instruction smaller.
I suspect the optimiser (hopefully) will have changed:
output_bit(PIN_TRIGGER,1);
into the same code as 'output_high(PIN_TRIGGER)'. Otherwise it will be worth changing all commands where you use a 'value' like this, into the corresponding output_high/low instructions.
It really is going to be terribly tight to get this in, but I suspect with real care it might _just_ fit.
Best Wishes |
|
|
eem2am
Joined: 18 Jul 2012 Posts: 21
|
|
Posted: Tue Jul 24, 2012 3:18 am |
|
|
thanks,
actually ive amalgamated the functions and got it down to PIC10F200.h Size.
I am now working on disabling pullups and enabling the watchdog timer.
The compiler doesnt like me adding set_portb_pullups(FALSE).
Do you know why? |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Jul 24, 2012 3:54 am |
|
|
Quote: | Also, how do i know haw much RAM the PIC10F200 has? | Only one answer to this: RTFM
When working with embedded processors like the PIC you always need to have the datasheet with you. Your program is so tight connected to the hardware that you really need to know the nitty gritty details.
Quote: | im just wondering if int i should be a long int in order for it to be able to count up to 210?
After all, an int is only 8 bits, and with the sign bit thats down to 7 bits which means 127 maximum? | Good thinking, but there is also something like an 'unsigned int'. Check the CCS manual, chapter 'Data Definitions', page 43 for all the info you need.
A tip for finding the parts of code that can be optimized is to study the list file (*.lst). Here you can see the C-code and the assembly code that is generated from it.
Note: from the generated code you will see that generalizing all delays to multiples of 10ms didn't really save space. Sometimes it is, but here it is more efficient to have the compiler use one generic delay_ms call.
Last edited by ckielstra on Tue Jul 24, 2012 5:03 am; edited 1 time in total |
|
|
eem2am
Joined: 18 Jul 2012 Posts: 21
|
|
Posted: Tue Jul 24, 2012 4:15 am |
|
|
I checked the manual, (@ july 2003) theres nothing on page 43, page 66 lists types but theres no "Usigned int".
can you confirm that "int" can only go -127 to +127? |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Tue Jul 24, 2012 4:26 am |
|
|
No.
Signed 8 bit ints (signed int or signed int8) are from -128 to +127.
Unsigned 8 bit ints (int, int8, unsigned int or unsigned int8) are 0 to 255.
CCS C is unusual in that ints are unsigned by default: they are more commonly signed. They are also 8 bit: most C compilers int are 16 or 32 bit.
RF Developer |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Jul 24, 2012 5:11 am |
|
|
eem2am wrote: | I checked the manual, (@ july 2003) theres nothing on page 43, page 66 lists types but theres no "Usigned int". | Why are you using such an old manual version?
The PIC10 series is supported by the free PCB compiler that CCS did include with MPLAB (at least they did a few years ago last time I checked). So there shouldn't be any reason to not use a recent compiler version. |
|
|
eem2am
Joined: 18 Jul 2012 Posts: 21
|
|
Posted: Tue Jul 24, 2012 5:14 am |
|
|
I Have to be compatible with code written by previous engineers years ago. |
|
|
|