Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About SvendW

  • Rank
  1. Hi, thanks for all the explanations! To Pavel: NO porta, portb,... ARE not defined in the header file for eg. PIC12F675, BUT gpio (the only 5 port) IS defined: This is something that eg. the LED array plugin should know (only PortA,.. are selectable) I have learned 2 things: 1) To be more carefull with the preprocessor directives! and that: 2) The BoostC IDE has an option for setting "global" defines: Settings | Options | In the edit box named: Extra compiler options: Type in "-d[space]<your symbol to be defined>" eg. -d ExtraStuff (This would have been my next question ) Regards, SvendW
  2. Thanks SnakeByte, I have overlooked, that the definition of ports are NOT #defines but actually variable declarations like 'char porta@0x0005;' Yes, I aggree that preprocessor commands should be handled solely by the preprocessor! BUT: If I add defines like: #define PORTA porta #define PORTB portb and #define PortOUT PORTB I would expect that: #if PortOUT == PORTA ... #else ... (This code included) #endif Using pointers like char *PortOUT = *porta would cost valuable variable space, so I would like to try and twist the preprocessor to do the job! By the way: My intend is to use 'almost' the same code for single port PIC devices and multiple port PIC devices only controlled by the "Target" selection in the GUI! Regards SvendW
  3. thanks andydavy, it was just a warning on how wrong it goes without an endless loop! ('cause we don't want BoostC to add a fix for this and waist memory for it!) Regards SvendW
  4. Hej, not that it matters very much, but BoostC 1.6 does generate a faulty PIC program IF THE main function does not contain an endless loop: void main() { } generates "stack underflow" under the simulator but newbies may be allerted (like me) Regards SvendW
  5. Hej, using BoostC 1.6, consider the following code: int check=2000; int CheckPassedRight(short *piar) { int ret; short Elap; short Intv; Elap = check - piar[0]; Intv = piar[1]; if ( Elap > Intv ) { ret = 1; } else { ret = 0; } return ret; } int CheckPassedWrong(short *piar) { int ret; short Elap; Elap = check - piar[0]; if ( Elap > piar[1] ) { ret = 1; } else { ret = 0; } return ret; } void main() { short iar[2]; int res; iar[0] = 2010; iar[1] = 75; while (1) { res = CheckPassedRight(iar); res = CheckPassedWrong(iar); } } Both calls: CheckPassedRight) and ...Wrong should give the same result: 0, but CheckPassedWrong ALWAYS returns 1. The only difference is: "Wrong" uses: if ( Elap > piar[1] ) "Right" uses: Intv = piar[1]; if ( Elap > Intv ) and consumes more memory and time! PS: I realy like BoostC! Is this me or the compiler that is wrong? Regards SvendW
  6. I'am not sure of the #if syntax, so I tried this: #include <system.h> #define PortOUT porta void main() { while (1) { #if PortOUT == portb portb = 0; #else #if PortOUT == porta porta = 0; #endif #endif } } hoping that the resulting code would set porta = 0, but it actually assigns portb. Is this a compiler bug, or is #if not suited for this purpose? Regards SvendW
  7. The internal oscilator of most (all?) of the smaller PICs eg. OIC12F675 are "factory-calibrated" by Microchip in the following way: The last program location (eg. 0x3FF) contains a RETLW xx instruction where xx is the value to be written into the OSCCAL register for best oscilator calibration. So the code: asm { call 0x3FF movw OSCCAL,F } is very commonly used. I miss it too in BoostC! Regards Svend
  • Create New...