PDA

View Full Version : Pause



blue
- 19th December 2005, 17:19
with oscillator frequency of 4MHz. The command of pause will pause the program in milliseconds.e.g pause 1000 for delay of 1 second. May i know that how it's to calculate each pause is 1 milisecond consists of 4Mhz??
Is't come from the equation of T=1/f?

Dave
- 20th December 2005, 12:14
blue, Pause is one of the commands that PBP uses the OSC= directive to calculate the timing in milliseconds. As long as you have declared the oscillator frequency using one of the available choices, PBP will set the step size to 1 millisecond.

Dave Purola,
N8NTA

blue
- 21st December 2005, 03:41
By using different PIC with different frequeacy, would it affect the delay time?
let saying that using 20Mhz PIC, 5 times faster that 4Mhz PIC, would it shoter the delay time 5 times compare to the 4Mhz PIC?
appreciate for yr reply.

Dave
- 21st December 2005, 11:43
blue, As I stated before the instruction PAUSE does the math at compile time to give the instruction a minimum resolution of 1 millisecond depending on your selection of oscillator frequency defined by the OSC= function. It diesn't mater which pic micro you chose.

Dave Purola,
N8NTA

blue
- 23rd December 2005, 02:32
Dave, i understand what you are trying to say. But, in microengineering website, there got a resources/information about using pic basic compiler. inside there, got a statement as below,try to read it.
--------------------------------------------------------
A part of statement:
PICBASIC™ Compiler programs may be run at clock frequencies other than 4MHz if you pay attention to what happens to the time dependent instructions. If you wish to run the serial bus at 19,200 as described above, you would simply clock the PICmicro MCU with an 8MHz crystal rather than a 4MHz crystal. This, in effect, makes everything run twice as fast, including the SERIN and SEROUT commands. If you tell SERIN or SEROUT to run at 9600 baud, the doubling of the crystal speed will double the actual baud rate to 19,200 baud.

However, keep in mind commands such as PAUSE and SOUND will also run twice as fast. The Pause 1000 mentioned above would only wait .5 seconds with an 8MHz crystal before allowing program execution to continue.
--------------------------------------------------------
This is why i'm trying to ask the question about PAUSE/PAUSEUS command.

Darrel Taylor
- 23rd December 2005, 06:20
blue,

From that I can see that you are using the PICBASIC™ Compiler , or at least you're reading the PBC manual.

For PBC, all programs are assumed to run at 4Mhz. So yes, if you run it at 8Mhz instead, everything will be twice as fast, or take half the time, which ever way you want to look at it. (Glass half empty thing)

With PicBasic Pro, there is the OSC define that allows the compiler to compensate for the different oscillator speeds.

And, PBC doesn't have a PAUSEUS command.
<hr>
PBC questions can be a little confusing outside of it's own forum.
mel PIC BASIC
http://www.picbasic.co.uk/forum/forumdisplay.php?f=3

blue
- 28th December 2005, 06:46
Thanks for your help.

Dave
- 29th December 2005, 14:24
blue, Yes you are right, If you declare the OSC= to 1 frequency and use an actual crystal thet is double the defined frequency all of the timed statements used by PBP will run at twice the specified timing.

Dave Purola,
N8NTA