PDA

View Full Version : PicBasic Pro 16F628A Clock speed help !



andybarrett1
- 14th April 2014, 13:14
Hi All

Using PBP 2.50C

Confused..... I am attempting to slow a 16F628A from the default 4Megs to 48K Clock Speed

Am I right in assuming the Command :-

PCON.3 = 0

At beginning of code should do it....

My code works fine at 4Megs and is not that complex... :-) Just drives a LCD and a few buttons.

Any help welcome :)

ardhuru
- 14th April 2014, 16:07
Hi Andy,

The 16F628A does not have a frequency multiplier; you can either use the internal osc at 4 Mhz, or an external crystal upto a maximum of 20 Mhz.

Regards,

Anand

Oops, sorry read the 48 Khz as MHz

HenrikOlsson
- 14th April 2014, 16:12
Hi,
Yes, as far as I can see setting PCON.3=0 should switch from 4Mhz (default) to 48kHz.
However, PBP doesn't have a suitable DEFINE OSC xx for that frequency so all software timed commands will be off by a factor of about 83 (if you're using the default DEFINE OSC 4), ie a PAUSE 10 will in reality be a PAUSE 830 and so on. This affects ALL selftimed commands, like PULSIN/OUT, SERIN/OUT, LCDOUT, PAUSE, PAUSEUS, PWM and so on.

For LCDOUT perhaps you could try changing your data and command delays by a factor of ~80 and see what happens. I'm not saying it'll work but it's worth a try. If you have any PAUSE or PAUSEUS in your code then you'd need to scale those too obviously.

/Henrik.

Demon
- 14th April 2014, 16:27
I'm curious why you would want to slow the PIC to 48 kHz. What requirement prevents you from running at 4 MHz?

It might be easier to run everything at 4 MHz and tweak whatever specific logic you want to simulate 48 kHz.

Robert

ardhuru
- 15th April 2014, 11:04
Battery conservation, perhaps?

andybarrett1
- 15th April 2014, 21:24
Yes…. Am attempting to use a pic in field from solar sources… so saving power is a premium !!!

andybarrett1
- 15th April 2014, 21:26
In Short ….

It should work,,,?

I understand Pause etc will be somewhat slower !

andybarrett1
- 15th April 2014, 21:28
Thank you all for help !

BR
Andy

rsocor01
- 16th April 2014, 03:38
Yes…. Am attempting to use a pic in field from solar sources… so saving power is a premium !!!

This is from the datasheet


• Standby Current:
- 100 nA @ 2.0V, typical
• Operating Current:
- 12μA @ 32 kHz, 2.0V, typical
- 120μA @ 1 MHz, 2.0V, typical

You can put the chip in standby mode and wake the chip up when needed using interrupts.

Robert

andybarrett1
- 16th April 2014, 11:09
This is from the datasheet



You can put the chip in standby mode and wake the chip up when needed using interrupts.

Robert

I Never thought of interrupts.... Even Better!!!

Thank you

AvionicsMaster1
- 17th April 2014, 00:43
Not interrupts but SLEEP or NAP. Interrupts keep the clock running but with SLEEP and NAP it all shuts down for a selectable period of time, wakes up, does its thing and goes back to sleep.

The data sheet I saw said 1uA at 3.3V so you may get down that low if you work at it.

It also looks like this chip has LED driver pins. Maybe you should look at a different chip for your more specific needs.