Astrolupa 0 Report post Posted January 11, 2008 Hi all! Been testing the BoostBasic editor & compiler and it's a great product indeed. Get's even better if you buy the plugins. I have this question... I did a sample coding for a 4Mhz 16F628A PIC, which worked right away! (Nothing too dificult to make a LED go on and off). Between the on and off cycle, I did a delay_s(1), which worked great. Now I changed the PIC speed up to 20Mhz, and the 1 second delay is no more 1 second but just a few miliseconds. I tried to tell BB that the speed was now 20Mhz in the only place I found (clock rate under settings). Did not make a diference. Is there any #define or alike that will instruct the compiler to be aware of the clock change? Thank you! Best regards, Nelson Quote Share this post Link to post Share on other sites
trossin 0 Report post Posted January 14, 2008 I checked out the manual and found that the BASIC compiler uses the same prgama statements as the C compiler. So the answer is to add this line to your program. #pragma CLOCK_FREQ 20000000 This tells the delay functions what your clock frequency is. The frequency setting that you changed with a pull down menu is for the simulator to be able to display time correctly if you use a timer plug in. I hope this helps Quote Share this post Link to post Share on other sites
Astrolupa 0 Report post Posted January 22, 2008 Hi there! Thanks for your help. I've looked again at the b.b. manual, and although there's an example that uses the CLOCK_FREQ pragma, b.b. doesn't seem to know it. When compiling it gives out the following: _.bas tc_proj.bas(13): warning: unknown or invalid pragma (ignored) Any ideas? Best regards, Nelson Quote Share this post Link to post Share on other sites
Pavel 0 Report post Posted January 22, 2008 I've looked again at the b.b. manual, and although there's an example that uses the CLOCK_FREQ pragma, b.b. doesn't seem to know it. When compiling it gives out the following: _.bas tc_proj.bas(13): warning: unknown or invalid pragma (ignored) Any ideas? BoostBasic understands all pragmas supported by BoostC compiler as they use the same engine. I just verified this on a BoostBasic sample included into the installation. Here is basic code that uses the pragma and compiles. Use it as starting point: #pragma CLOCK_FREQ 20000000 sub main() end sub Regards, Pavel Quote Share this post Link to post Share on other sites
Astrolupa 0 Report post Posted January 31, 2008 Hi Pavel! Thanks for looking. Somehow, I just pulled the pragma line to the top (I also have other pragma for eeprom and configuration bits) and it worked! Thank you very much! (Thanks to trossin too!) Best regards, Nelson Viegas Quote Share this post Link to post Share on other sites