Skip to main content
added 742 characters in body
Source Link
Adam Lawrence
  • 33.3k
  • 3
  • 60
  • 110

The directive FOSC_INTOSCIO means that the part is using its internal oscillator, and the lines normally used for the crystal are set as I/O lines. That's why your crystal isn't oscillating.

This device has an internal oscillator frequency of approximately 4MHz, so it's quite possible that your ISR is executing faster than your eye can perceive the LED flashing.

You will want to use something like LP_OSC instead of FOSC_INTOSCIO (I don't have that exact header file, so I cannot tell you which exact one to use).


Further to the comment below: according to the datasheet, the choices for the timer clock source are: an external clock from RB6 or the internal oscillator / 4. What this means is that you can use the internal 4 MHz oscillator for the main clock, and bring a clock signal to RB6 for the timer. However, since you're not using the built-in oscillator hardware, you'll have to externally generate a clock from the crystal and apply it to RB6.

Luckily Microchip explains how in the datasheet:

Parallel crystal circuit

Serial crystal circuit

The directive FOSC_INTOSCIO means that the part is using its internal oscillator, and the lines normally used for the crystal are set as I/O lines. That's why your crystal isn't oscillating.

This device has an internal oscillator frequency of approximately 4MHz, so it's quite possible that your ISR is executing faster than your eye can perceive the LED flashing.

You will want to use something like LP_OSC instead of FOSC_INTOSCIO (I don't have that exact header file, so I cannot tell you which exact one to use).

The directive FOSC_INTOSCIO means that the part is using its internal oscillator, and the lines normally used for the crystal are set as I/O lines. That's why your crystal isn't oscillating.

This device has an internal oscillator frequency of approximately 4MHz, so it's quite possible that your ISR is executing faster than your eye can perceive the LED flashing.

You will want to use something like LP_OSC instead of FOSC_INTOSCIO (I don't have that exact header file, so I cannot tell you which exact one to use).


Further to the comment below: according to the datasheet, the choices for the timer clock source are: an external clock from RB6 or the internal oscillator / 4. What this means is that you can use the internal 4 MHz oscillator for the main clock, and bring a clock signal to RB6 for the timer. However, since you're not using the built-in oscillator hardware, you'll have to externally generate a clock from the crystal and apply it to RB6.

Luckily Microchip explains how in the datasheet:

Parallel crystal circuit

Serial crystal circuit

Source Link
Adam Lawrence
  • 33.3k
  • 3
  • 60
  • 110

The directive FOSC_INTOSCIO means that the part is using its internal oscillator, and the lines normally used for the crystal are set as I/O lines. That's why your crystal isn't oscillating.

This device has an internal oscillator frequency of approximately 4MHz, so it's quite possible that your ISR is executing faster than your eye can perceive the LED flashing.

You will want to use something like LP_OSC instead of FOSC_INTOSCIO (I don't have that exact header file, so I cannot tell you which exact one to use).