Jump to content

Recommended Posts

Hi guys,


how come that if I change the clock rate in the SourceBoost IDE simulator and then run the code with some delay_ms() functions, the "ticks counter" in the bottom of the screen still gives me the same number? For example I've got delay_ms(40) and I still get cca 156k ticks after that no matter how big the clock rate is... could you give me a hint why is that so?


Thanks so much,



Link to post
Share on other sites



What exactly do you mean by changing the clock rate in the IDE? Is it the settings menu?


In order to have an acurate simulation you have to keep the following items in sync.

- PIC configuration and oscillator options

- #pragma CLOCK_FREQ xxxxxxx

- IDE settings/clock rate menu


The "delay_ms()" macro generates code based on the CLOCK_FREQ pragma.

The IDE settings/clock rate is used to inform the simulator calculator so it can compute run time and is also used by the plug-in system.


And don't mix "time" with "instructions", whatever clock rate you use, the number of executed instructions betwen 2 breakpoints will allways be the same, only the calculated time lapse will change.




Best regards


Edited by JorgeF
Link to post
Share on other sites

Thank you for your answer,


now I realize I may have put this topic in incorrct thread, because what I'm trying to do is develop a plug-in for the SB IDE, so I was thinking I only use the Settings Clock Rate. The particular problem is I want to get the plugin to work after approximate time of 15ms. In the plugin syste there's a callback function which is called by every clock tick of the simulator (clk is the current count of ticks provided by the simulator itself), so I was just thinking putting something like

if (clk < clockRate*15/1000) {
// dont do anything

// code after 15ms

will do the thing, but as you're saying when using delay_ms in the code for testing of the plugin will always look at the pragma.



Link to post
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...