PDA

View Full Version : Using the OSC value in PBP



Darrel Taylor
- 29th August 2005, 00:50
Hi all,

This is a ridiculously simple example, but it's something that's been puzzling me for a while, (maybe you too). It's hard to believe it took so long to figure out.

Often, for calculating time related routines that depend on the oscillator speed, I'd need to know the "OSC" value that was set using a DEFINE statement.   But it's no-where to be found in PBP.

It is available at the ASM level, and I used to copy it into a Temp variable with the MOVE?CB macro. But that uses both Code Space, and a RAM location.

This, that I just discovered, solves both problems.

@FOSC = OSC
FOSC CON EXTNow it's just another constant called FOSC that can be used with any PBP statements.

HTH
<br>