PDA

View Full Version : 16F628A and 37 KHZ internal clock



Pimentel
- 1st October 2015, 10:44
Hi All,

I would like to use a 37 KHZ internal clock mode with 16F628A. I never user it internal clock option, just 4 MHZ.
Anybody know how to do it with PBP?
I know that by default the compiler uses 4MHZ, but I can't to use it. I need 37KHZ but my problem is that I also need to put a LCD in my project and I don't know how to ajust the timming to the commands. Maybe a DEFINE 37, or something ???

Thanks

HenrikOlsson
- 1st October 2015, 12:51
Hi,
* There is no internal 37kHz mode on the 628A. It's either 4MHz or 48kHz.
* You can RUN the PIC at 48kHz.
* You can NOT make PBP aware of it - ie. no DEFINE OSC for such low frequency.

Why do you NEED to run it at such slow speed? Power?

If so then one or more of these ideas might be worth to consider:
* There are modern parts with lower current consumption.
* Use the switchable oscillator and run it at 4MHz when needed, switch it back to 48kHz when you don't.
* Use the sleep feature and wake the PIC up when needed.

/Henrik.

Pimentel
- 2nd October 2015, 01:03
Hi Henrik

I am trying to help a friend who built an air band receiver but he's having trouble in a certain frequency approach, 120.00 MHZ, because there is a noise that he believes happen to be multiple of 4 MHz, which is crystal value it are using today with a 16F84A mcu. I found the information in the datasheet of 16F628A (page 97) on two options for internal clock, 4 MHz and 37 KHz. I got to work with 37 KHZ doing PCON.3 register = 0.
However, latency commands such as PAUSE, SEROUT / SERIN, are compromised.
The idea is to make the mcu control a PLL, the MB1501, so I think the problem of latency should not influence much.
I appreciate your feedback and suggestions.

Pimentel

Archangel
- 2nd October 2015, 02:24
120 mhz is high enough to have several frequencies of which a harmonic will be 120 mhz. I would recommend putting the PIC and it's crystal in a shielded box and have feed through caps for power and I/O. Also filter the power in with a choke.

HenrikOlsson
- 2nd October 2015, 07:51
Hi,

I found the information in the datasheet of 16F628A (page 97) on two options for internal clock, 4 MHz and 37 KHz. I got to work with 37 KHZ doing PCON.3 register = 0.
Then it's got to be a typo in the datasheet, either yours or mine (http://ww1.microchip.com/downloads/en/DeviceDoc/40044F.pdf) because it does say 48kHz where I look:


A software programmable dual-speed oscillator mode
is provided when the PIC16F627A/628A/648A is
configured in the INTOSC oscillator mode. This feature
allows users to dynamically toggle the oscillator speed
between 4 MHz and 48 kHz nominal in the INTOSC
mode.

Make sure you always download your datasheets directly from Microchip as they will always have the latest versions.

/Henrik.

Pimentel
- 3rd October 2015, 00:21
Look Henrik,
14.3 Special Feature: Dual Speed
Oscillator Modes
A software programmable Dual Speed Oscillator mode
is provided when the PIC16F62X is configured in either
ER or INTRC Oscillator modes. This feature allows
users to dynamically toggle the oscillator speed
between 4 MHz and 37 kHz. In ER mode, the 4 MHz
setting will vary depending on the value of the external
resistor. Also in ER mode, the 37 kHz operation is fixed
and does not vary with resistor value. Applications that
require low current power savings, but cannot tolerate
putting the part into SLEEP, may use this mode.
The OSCF bit in the PCON register is used to control
Dual Speed mode. See Section 3.2.2.6, Register 3-4.

And Archangel, I will test it, thanks!

HenrikOlsson
- 3rd October 2015, 08:27
Hi,
But that's the thing. You're quoting "the same" paragraph of the datasheet as I was but in "your" datasheet it says 37kHz, while in "mine" it says 48kHz. One of them is wrong or they've changed the silicon (unlikely). I'm not saying mine's correct and your's wrong (actually perhaps I am....) just that there is an inconsistency and that the 37kHz you might think you're running at might not be 37kHz.

The one I'm reading is called DS40044F and is dated 2007. Is it possible that you're looking at either an old version (prior to revision C is my guess) of the datasheet OR perhaps a version for the 16F628 (non A version?)

Anyway, good luck with the project!

/Henrik.

Pimentel
- 4th October 2015, 01:12
Hi Henrik,

Thanks for your help.
I solved the problem using internal OSC config ( the noise finished using 37/48KHZ or 4 MHZ).
I don't remember where I downloaded the datasheet, but I perceved that was very slow speed. Maybe was 16f628 as you said.
Thank you again my friend.

Acetronics2
- 12th October 2015, 20:38
The truth ...

37 khz is for 16F628
48 khz is for 16F628 A ...

Alain

MarshRu
- 20th November 2015, 15:22
Actually as per my experience with it a software programmable Dual Speed Oscillator mode is provided when the PIC16F62X is configured in either ER or INTRC Oscillator modes. This feature allows users to dynamically toggle the oscillator speed between 4 MHz and 37 kHz. In ER mode, the 4 MHz setting will vary depending on the value of the external
resistor.
And in ER mode, the 37 kHz operation is fixed and does not vary with resistor value. Applications that require low current power savings, but cannot tolerate
putting the part into SLEEP, may use this mode.