Skip to main content
Tweeted twitter.com/#!/StackElectronix/status/212900819064991746
added 4 characters in body; edited title
Source Link
clabacchio
  • 13.6k
  • 4
  • 45
  • 80

PIC 16F1503 - change the frequency of internal iscillatoroscillator

My configuration bits are as follows:

#include <P16F1503.inc> 
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _BOREN_OFF & _CLKOUTEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _STVREN_OFF & _LVP_OFF

The relevant part of code I am using for changing the frequency is this:

banksel OSCCON
movlw   b'01101000'     ; Int. osc. 4 MHz
movwf   OSCCON
btfss   OSCSTAT, HFIOFR ; Is internal oscillator running?
goto    $-1             ; No, loop one line back...
btfss   OSCSTAT, HFIOFS ; Is internal oscillator stable?
goto    $-1             ; No, loop one line back...

My debug tool is unfortunately just simulator. The problem is, that execution never reachreaches the breakpoint on line 192: 

enter image description here

So this means, that internal oscillator never gets stable?

I am using:

  • IDE: MPLAB X IDE v1.20
  • Compiler: MPASM v5.45

What am I doing wrong?

PIC 16F1503 - change the frequency of internal iscillator

My configuration bits are as follows:

#include <P16F1503.inc> 
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _BOREN_OFF & _CLKOUTEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _STVREN_OFF & _LVP_OFF

The relevant part of code I am using for changing the frequency is this:

banksel OSCCON
movlw   b'01101000'     ; Int. osc. 4 MHz
movwf   OSCCON
btfss   OSCSTAT, HFIOFR ; Is internal oscillator running?
goto    $-1             ; No, loop one line back...
btfss   OSCSTAT, HFIOFS ; Is internal oscillator stable?
goto    $-1             ; No, loop one line back...

My debug tool is unfortunately just simulator. The problem is, that execution never reach the breakpoint on line 192:enter image description here

So this means, that internal oscillator never gets stable?

I am using:

  • IDE: MPLAB X IDE v1.20
  • Compiler: MPASM v5.45

What am I doing wrong?

PIC 16F1503 - change the frequency of internal oscillator

My configuration bits are as follows:

#include <P16F1503.inc> 
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _BOREN_OFF & _CLKOUTEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _STVREN_OFF & _LVP_OFF

The relevant part of code I am using for changing the frequency is this:

banksel OSCCON
movlw   b'01101000'     ; Int. osc. 4 MHz
movwf   OSCCON
btfss   OSCSTAT, HFIOFR ; Is internal oscillator running?
goto    $-1             ; No, loop one line back...
btfss   OSCSTAT, HFIOFS ; Is internal oscillator stable?
goto    $-1             ; No, loop one line back...

My debug tool is unfortunately just simulator. The problem is that execution never reaches the breakpoint on line 192: 

enter image description here

So this means that internal oscillator never gets stable?

I am using:

  • IDE: MPLAB X IDE v1.20
  • Compiler: MPASM v5.45

What am I doing wrong?

Source Link
PrimosK
  • 296
  • 1
  • 4
  • 20

PIC 16F1503 - change the frequency of internal iscillator

My configuration bits are as follows:

#include <P16F1503.inc> 
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _BOREN_OFF & _CLKOUTEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _STVREN_OFF & _LVP_OFF

The relevant part of code I am using for changing the frequency is this:

banksel OSCCON
movlw   b'01101000'     ; Int. osc. 4 MHz
movwf   OSCCON
btfss   OSCSTAT, HFIOFR ; Is internal oscillator running?
goto    $-1             ; No, loop one line back...
btfss   OSCSTAT, HFIOFS ; Is internal oscillator stable?
goto    $-1             ; No, loop one line back...

My debug tool is unfortunately just simulator. The problem is, that execution never reach the breakpoint on line 192:enter image description here

So this means, that internal oscillator never gets stable?

I am using:

  • IDE: MPLAB X IDE v1.20
  • Compiler: MPASM v5.45

What am I doing wrong?