Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Simple way to bypass OSCON check

Status
Not open for further replies.

jpanhalt

Well-Known Member
Most Helpful Member
I am using a 12F683 at 8 MHz and find that checking stability of the internal RC oscillator is necessary.

Code:
btfss      OSCCON,2       ;check oscillator stable                         
goto       $-1            ;                                                 
<next step>

I am using MPLab 8.89 and MPLab Sim to debug.

When running in debug, the program hangs on those two steps. So, I comment them out. Then in the release version, I have to uncomment them. Unfortunately, I sometimes forget to do that.

Is there an easier way?

John
 
Just use a delay? It does not take long to stabilise, so you can add a hard-coded delay in the start of your code. If you do not already have one it is also a good practice having a delay to allow PSU voltages etc to stabilise after turn on.
 
I could change the code. But of course, that is what I am currently doing. ;)

Register injection at a specific program counter sounded like the right term for what I wanted to do with the stimulus worksheet You can access OSCCON in the dialog. It would be so easy if all you had to do was indicate which bit to flip at that location, like: bsf OSCCON, 2. I'll give it a fresh look today.

John
 
After no small amount of testing and searching, I came across this: https://www.electro-tech-online.com/threads/pic12f683-lcd-question.122814/#post1017210

It may not be a valid assumption, but if Mike K8LH doesn't use a stimulus for that step, then I am assuming that OSCCON,2 (HTS) cannot be set by the user.

In fact, this little change compiles, but still doesn't skip:
Code:
	movlw      b'01100100'
        movwf      OSCCON
	btfss	   OSCCON,2     
	goto       $-1


John
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top