Drax 0 Posted May 10, 2014 Report Share Posted May 10, 2014 Hi, Can you please help me with this c program code. Version of software: SourceBoost IDE version 7.22 PIC : 12F629 You can see from the attachment , program don't going to infinite loop. I made mistake but I don't now where? Can you explain me in my attachment and forward the note. Please. Best regards Drax INTERFON.c Quote Link to post Share on other sites
Reynard 0 Posted May 11, 2014 Report Share Posted May 11, 2014 Hi Drax, Put your "while(1)" at the beginning of the loop body unless you are performing a "do...while();" loop. Cheers Reynard Quote Link to post Share on other sites
Drax 0 Posted June 6, 2014 Author Report Share Posted June 6, 2014 HI Maniac, Thanks' lot for helping me with this beginner problems. I see what I'm doing wrong. I have another problem with load calibration value from 0x3FF register and place that value into OSCCAL register, controller is the same from the first post PIC 12F629. I used C file (OSCCAL) from example in sourseBoostIDE 7.22, and copy in my project file. // This sample code was designed for PIC12F629 and shows how to read factory calibration value.// It will not work unser simulator because simulator doesn't support factory calibration value. #include <system.h> #ifndef _PIC12F629#error "This sample code was designed for PIC12F629"#endif //_PIC12F629 void main(){ asm //Load Factory Calibration Value Into OSCCAL { bsf _status,RP0 call 0x3FF //WHEN I START DEBUGGER PROGRAM RUNING WITH 1,2 LINE , NOT GOING TO 3 LINE AND THAN MASSAGE APPEARS ''HARDWARE STACK OVERFLOW'' movwf _osccal bcf _status,RP0 } while(1); } Best regards, Drax Quote Link to post Share on other sites
Reynard 0 Posted June 6, 2014 Report Share Posted June 6, 2014 Hi Drax, When debugging you do not need to calibrate the oscillator as the debugger does not work in real time. Use a conditional compile like this: #ifndef _DEBUG // Calibrate the internal oscillator. asm { call 0x3ff movwf _osccal } #endif Use the Debug build option when debugging otherwise use Release for the real thing. The _DEBUG flag is set/reset by the compiler depending on the build. Cheers Reynard Quote Link to post Share on other sites
WalterFax 0 Posted March 3, 2016 Report Share Posted March 3, 2016 Also it is preferred to use the .INC file for your pic, then you won't need to enter a register address, just the name. M. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.