Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About cridarco

  • Rank

Profile Information

  • Location
  1. GP0 and GP1 are inputs of the internal comparator. If you want to use them as digital I/O you must disable comparator setting cmcon0=0x07; GP0 and GP1 are also used for ICSP. If you use a demo board like low pin count and pickit2 from microchip to program it, these two pins remains connect to programmer. If you want to use them, you must review your project as explained in microchip 12F683 datasheet, chapter 12.10, page 100. Regards. Cridarco
  2. I tried ver. 6.84 and it works! No more problems. THANKS PAVEL, AND THANKS TO ALL SOURCEBOOST TEAM! Regards. Cridarco
  3. Yes, I do so. The previous answer convinced me that this way is the best. I use the interrupt only to set flag. Thanks. Cridarco
  4. Thanks to all for answers. Your comments have cleared my doubt and convinced me that the best way is to deal with the event in the main loop. Regards. Cridarco
  5. Hi, this is what BOOST C Compiler Reference Manual, PAG.64, says: General functions and interrupts Standard user functions are not thread-safe: their local variables are not saved when function execution gets interrupted by an interrupt. This can lead to very hard to trace errors. To prevent this pitfall, the linker does not allow to call a given function from both main() and interrupt threads. If you really need to use same function in both threads, you need to duplicate its code and assign a different name to the second copy. I tried to build a file, that has a main function and a timed interrupt function. In both I need to call the embedded "delay_ms()" function. This is the builder text: Building... BoostC Optimizing C Compiler Version 6.83 (for PIC16 architecture) ... ... ... my_demo.c success BoostLink Optimizing Linker Version 6.83 ... ... ... Building CASM file Serious Warning: Possible sw stack corruption, function 'delay_ms' called by more than one asynchronous thread (main/Task, interrupt, interrupt low) ... ... ... success ... ... ... Done The manual says to duplicate function and call the copy from interrupt function, but how can I do with delay_ms()? I must write my own? In addiction delay_ms() seems to work. Note I'm sure that there are no possibilities to conflict during the execution of delay_ms routine when called from main() or from interrupt(). What you suggest to do?
  6. Hi, Pavel, thanks for help. I sent you the code at support@sourceboost.com. Regards. Cridarco
  7. hi, Orin. I try to substitute "switch" code with "if" code, as you said, and there are not differences . I dowloaded demo version of another compiler, and I will try to compile my code with it. If the same problems appens, I think it's my code to be reviewed, and I can clear any doubt about the compiler. After that test, I will write in this thread the results. Cridarco
  8. You can see the .asm translation of your code. The base time is clock. One instruction cycle consists of four oscillator period. Every instruction needs 1 or 2 cycles for execution (you can see how much in the PIC data sheet). Count assembler instructions of your desired code, and you can calculate the exact time the instructions need to execute. It's a bit difficult method, but if you need precision is the best. Cridarco
  9. thanks for help, Orin. This is the declarations: #define DUTY_MAX 1020 #define DUTY_MIN 4 #define ON_MODE 1 #define OFF_MODE 0 int data_array[4]; int *point_to_data_array=&data_array[0]; bit flag_on_off; Don't care the possible over/underflow because the duty range is 0 to 1023 (decimal). The application is a light dimmer with three pwm channel. I use a PIC16F737. In the OFF_MODE case (that is the one that don't work), if I use only *(point_to_data_array+i)-=2; inside the for loop (without the "if...else") it works. But I haven't the check for DUTY_MIN. It's a strange behaviour, I don't understand it. Any idea? Thanks.
  10. I have the following switch inside a timer interrupt routine; the first case works, the second don't. switch (flag_on_off){ case ON_MODE: //THIS CASE WORKS for (i=1; i<4; i++) { if (*(point_to_data_array+i)< DUTY_MAX) *(point_to_data_array+i)+=2; else *(point_to_data_array+i)= DUTY_MAX; } break; case OFF_MODE: for (i=1; i<4; i++) { //THE FOLLOWING IF STATEMENT DON'T WORKS!!!! //IT EVER JUMP TO else CASE, ALSO WHEN DATA>DUTY_MIN!! if (*(point_to_data_array+i)> DUTY_MIN) *(point_to_data_array+i)-=2; else *(point_to_data_array+i)= DUTY_MIN; } break; default: break; } //end switch The pointer, constants, variables are declared as global. Counter variable "i" starts from 1 because data_array[0] don't need changes. The switch is inside an interrupt function like this: void interrupt(void) if (...){ while(...){ switch(...) --> PREVIOUS CODE Any one can say me why doesn't work? Too many levels for the compiler? Or I make some wrong use of pointers? Thanks for help. Cridarco
  11. when i try to declare and init a multi-dimension array like: int multi_array [3][2] = {{1,2},{3,4},{5,6}}; the compiler write: "error: missing semicolon" ? thanks for help.
  12. Anyone has developed a dmx512 receiver? I found application note AN1076 on microchip site that describe how implement DMX512 protocol on a PIC, but I was not able to translate in BoostC code. I'm interest on how implement point 1 and 2 at page 7 of this AN. Thanks a lot for help.
  • Create New...