Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About chuckj

  • Rank

Profile Information

  • Gender
  1. Running Windows XP SP3 MPLAB X ver 1.80 BoostC ver 7.20 I am getting these compilation errors that I was not getting before I updated Boostc: wallcontrol.c(751:26): error: failed to generate expression wallcontrol.c(751:26): error: invalid operand '&(lata)' wallcontrol.c(751:24): error: failed to generate expression wallcontrol.c(752:28): error: failed to generate expression wallcontrol.c(752:28): error: invalid operand '&(stEE.stVars.eWallAMode)' wallcontrol.c(752:26): error: failed to generate expression wallcontrol.c(753:31): error: failed to generate expression The errors go away if I get rid of the parentheses: &(lata) gives an error. &lata does not give an error &(stEE.stVars.eWallAMode) gives an error. &stEE.stVars.eWallAMode does not give an error. I cannot say if this is a bug with respect to ANSI C, but I suspect that it is.... Thanks, Chuck
  2. Jorge, Thanks for the reply, I was not aware about the need to add the library file to the project. I did try adding the library file to the project and yes, I did see the pathname problem in MPLAB X. I agree that it probably has to do with the space in the pathname. I have posted the path issue on the Microchip MPLAB X forum. Chuck
  3. I am running on MPLAB X ver 1.1 with SB ver 7.05.1 and ICD3. To help others, I will list stumbling blocks I had and the 1 issue I need help with(see bottom) Stumbling blocks overcome: 1)I installed MPLAB X after installing BoostC. If you want to do this, first read MplabX_Plugin.pdf in your SourceBoost root directory(C:\Program Files\Sourceboost). It tells you what you need to do. 2)To run NOVO RTOS, you need the -swsc linker option. To add linker options in MPLAB X, select File-Project Properties. Under categories, select "SourceBoost Linker for PIC...." Beside "Options categories", select the "Software Call Stack..." and check the box "Use Software Call Stack for all code" 3)When adding source or library files to your project in MPLAB X, you usually want to select "Auto" under "Store Path As" on the right side of the file chooser dialog. The issue remaining(and my solution): 4) The library file libc.pic18.lib (for me using the PIC18F25K22) was not automatically included in the link like it is in the Sourceboost IDE. This results in lots of math routines not being found. The only way I got the project to link was to copy the file from C:\Program Files\Sourceboost\lib to my project directory and then add it to my library files in the project. I know this is not right, so if anyone has a better way to get this to work, let me know! Thank you, Chuck
  4. Can someone point me to a document which gives the regular expression syntax for SouceBoost IDE search and replace? If it uses Regex, which flavor is it? Thanks, Chuck
  5. This is only a minor issue which is easily worked around. Using latest BoostC download Ver 7.04 on Windows XP SP2. Compiler gives invalid operand on: short sTest; sTest = -(20); sTest = -(20*10); In general, it looks the compiler does not like unary minus followed by a paren. Thanks, Chuck
  6. Thank you! I did not think to look in the linker options. The linker option -isrnocontext removes the extra code from the ISRs. Chuck
  7. Using BoostC compiler on a PIC18F2420. I have a very time critical application which requires an interrupt response on the order of 25 clocks. Is there any way to eliminate the saving and restoring of the PROD and FSR0 regs in the interrupt() routine? This would eliminate about 16 clocks from the routine. Or is there any way to code the entire interrupt() routine in assembly? Thanks, Chuck
  8. My apologies if this has been mentioned somewhere. For PIC 18F processors( and perhaps others) you can use CCP1 and Timer1 to get an accurate tick period without using a software counter. The key is using the CCP Compare Special Event Trigger to reload Timer 1. Here is a code snippet to illustrate setting up 1 millisecond tick on a 40 MHz processor: /**** Defines to make it easy to change clock frequency or prescaler ****/ //40 MHz clock #define FOSC 40000000 #define TIMER1_CLOCKS_PER_US ((FOSC/4)/1000000) //Prescaler value must reflect PS1:PS0 values in PRESCALER_MASK!! #define TIMER1_PRESCALER_VALUE 1 #define PS1PS0_MASK 0x00 #define MICROSECONDS_PER_TICK 1000 //Use CCP1 in compare mode with special event trigger to do timing. // This way, the timer is reloaded in hardware so timing is very accurate #define CCP1_1MS_LOAD (((TIMER1_CLOCKS_PER_US * MICROSECONDS_PER_TICK )/TIMER1_PRESCALER_VALUE)- 1) //Reset timer and interrupt on timer compare mode match. #define CCPX_COMPARE_SPECIAL_EVENT_TRIGGER 00001011b #define MSB(x) (((x)>>8)&0xFF) #define LSB(x) ((x)&0xFF) /************* START OF CODE **************************/ //Initialization int main( void ) { //Init Novo RTOS SysInit(); //Create tasks here SysCreateTask(hMyTask, 1, MyTask); ..... //Start tasks here SysStartTask(hMyTask); ..... //Load CCPR1L and CCPR1H so compare will fire at 1 millisecond(our tick period) //See #defines above for load calculations and values ccpr1l = LSB(CCP1_1MS_LOAD); ccpr1h = MSB(CCP1_1MS_LOAD); //Set up interrupt on CCP event. clear_bit(pir1, CCP1IF); clear_bit(ipr1, CCP1IP); set_bit(pie1, CCP1IE); //This causes a hardware reset of Timer1 when CCP compare hits. // CCPX_COMPARE_SPECIAL_EVENT_TRIGGER is #define above. ccp1con = CCPX_COMPARE_SPECIAL_EVENT_TRIGGER; //Set up timer 1 for 16 bit, prescaler = 1, PS1PS0_MASK is #define above t1con = (1<<RD16) | (1<<TMR1ON) | (PS1PS0_MASK); set_bit(intcon, GIE); while(1) { Sys_Yield(); } } void interrupt( void ) { if( pir1.CCP1IF == 1 ) { //Handle ticker for NOVO RTOS SysTimerUpdate(); clear_bit(pir1, CCP1IF); } } //Tasks, etc............ Note how simple the interrupt handler is. All counting and reloading is done by the CCP. Hope you find this useful! Thanks for a great product, Chuck
  9. Thanks for the replies, I will use both of the suggested methods!
  10. My apologies if this has been asked before! I have a C routine: void CalcCRC( unsigned char ucData ) { } that I would like to call from inline assembly. I found that calling the routine can be done by: asm { //This compiles fine in assembly without a leading underscore. call CalcCRC } My problem is how to access the parameter ucData to the CalcCRC procedure from inline assembly. I have tried: movwf ucData movwf _ucData movwf CalcCRC_ucData movwf _CalcCRC_ucData movwf CalcCRC_arg_ucData movwf _CalcCRC_arg_ucData I know I can declare ucData as a global and have no params on the CalcCRC procedure. Is there a way to do this having ucData as a parameter? Thanks!
  11. Thanks for the reply, I have already tried that. Putting double quotes around the entire path results in a similar error as in my first case: Unable to open input file: C:\Program Files\SourceBoost\include. My Extra compiler options line actually looks like: -O2 -I ..\..\modbus\rtu;..\..\modbus\include;port;"C:\Program Files\SourceBoost\include" It was working fine before I added the last path.
  12. I have started using NOVO RTOS and would like to keep the NOVO .h files in c:\Program Files\SourceBoost\include directory. So in SourceBoost IDE Extra compiler options I put: -I\Program Files\SourceBoost\include Because of the space in "Program Files", this makes the compiler think there is an extra file "Files\SourceBoost\include" to compile. So I try to put Program Files in double quotes like this: -I\"Program Files"\SourceBoost\include This works OK IF I use the COMPILE option. If I use the BUILD option, I get a usage error on pp which spits out all of the pp command line options. Of course I can move the NOVO .h files to my build directory or always use the COMPILE option, but I am wondering if anyone has a solution for accessing include dirs that have a space in the name. Using BoostC ver 6.95. Thanks!
  13. chuckj

    Incorrect Xor Result?

    I get the correct result as long as the (usCRC>>8) term is not the first term in the last line. These last lines all give the correct result: usCRC = (iNum<<1) ^ (usCRC>>8) ^ pNum ^ iNum; usCRC = (iNum<<1) ) ^ pNum^ (usCRC>>8 ^ iNum; usCRC = (iNum<<1) ^ pNum ^ iNum^ (usCRC>>8); Sorry for not using code tags in my bug report!
  14. chuckj

    Incorrect Xor Result?

    Bug description: Getting incorrect(I believe!) result from complex XOR Result should be 0x87FE, am getting 0x7AFE. Same result using -O0 option on compiler. Steps to reproduce: Run this code: #include <system.h> int main( void ) { unsigned short iNum; unsigned short pNum; unsigned short usCRC; usCRC = 0xFFFF; iNum = 0x00F4; pNum = 0xC001; usCRC = (((usCRC>>8) ^ pNum) ^ (iNum<<6)) ^ (iNum<<7); } Got same result with parens only around the '<<' terms. Expected behaviour: I expect the ending usCRC value to be 0x87FE. Here is a breakdown of the last line XOR: 0000 0000 1111 1111 //This is usCRC(0xFFFF) >> 8 1100 0000 0000 0001 //0xC001 0111 1010 0000 0000 // iNum << 7 0011 1101 0000 0000 // iNum << 6 1000 0111 1111 1110 //Result of 0x87FE from XOR of 4 16 bit values above Is the problem 100% reproduceable: Yes IDE version: 6.95 Compiler: BoostC Compiler version: 6.95 Target device: PIC18F2420 OS: Window XP SP2 Comments: Please let me know if I am doing something wrong here.