Log in

View Full Version : 16f54 stops running with RC OSC



tshaffer
- 23rd March 2011, 02:12
I think there is something different about the 16f54. I am using it to drive a LCD.
It is the same circuit as the one in the PBP manual that uses the 16F84.
Except the enable goes to PORTB.3 not A4 like 16f84.
The MCU just seems to stop.

@_config_RC_OSC

The Resistor is a 472 ohm the cap is a 22 pf
Not sure what speed to set OSC if thats the problem.

Archangel
- 24th March 2011, 01:47
If that is a copy paste then it is likely the problem.
should be @spaceTwoUnderscoresConfig like so . . .


@ __config_RC_OSC
And it is only going to work if you have commented out the default config in the p16F54.inc file in the PBP root directory, or you can change the default to this and leave it out of your source code And this config is for MPASM assembler not PB.
Then set your OSC speed with the define, This get's the pic peripherals all on the same page as to timing, how long is a pause or pauseus . . .


define OSC 4

BTW the things you define are supposed to be (MUST) be in uppercase letters so OSC is good, osc is not.

tshaffer
- 25th March 2011, 00:25
Thanks Joe
I put a Scope on PORTA whitch is the Data port to the LCD.
There is no activity on the port.
I put a LED on PORTB and it doesn't toggle either.
I have been sucessful whith other chips no problem
16f877A. 18f4550 no problems but this 16f54 has me confused
What am i missing?

Archangel
- 29th March 2011, 08:48
Please post your setup code in Toto, all your configs all your defines and all of your
registers, port, tris. option . . . if it is not secret, post the whole code.
Let's see what is going on here.
EDIT:
I have never used an external R/C osc so I cannot pull some trial values out of my hat
Having said that, I would try some other values, go bigger on both the resistor and the Cap.
Without cracking a bunch of books, methinks the values you picked would make for very high
frequency more than that poor old chip can do. BTW pin 17 the OSC/CLKOUT pin will output the osc freq./4 if you want to measure it.

tshaffer
- 1st April 2011, 00:49
Thanks Joe S
I was using MPLAB to program the chip and was setting the config bits in MPLAB
but when you compile the .asm file in MPLAB it was changing the config bits back to what was set in the PBP p16f54.INC file and I wasn't catching it. Works as expected now.

Thanks All


The greater the destress the greater the success ........... sometimes

Archangel
- 1st April 2011, 01:44
<h1> GREAT ! </h1> Happy to have been of service. Question, how did you determine the R/C values and what FREQ. did you get from them? I didn't see anything in the data sheet in the way of tables or formulas.

tshaffer
- 2nd April 2011, 01:17
These boards were made by someone else I was just reprograming them to be serial displays. HoweverI think that they are probably running at 4 MHz. haven't checked it yet
but seems to run display normaly. I have tryed to run boards with a 16F57 and same RC
values at 8 MHz seemed OK but it didn't like anything higher. Haven't tryed to go higher than 4 MHz. with the 16F54 but I suspect it woul be the same.
I have a project that i want to count the number of pulses in a span of about 2 seckonds.
The pulses go form 0 to 5 volts the attact is strait up the sustain at the top is about .25ms
then drops almost strait down to about 1.25 volts then has a decay of about 2ms to 0.
They happen at irregular intervils and may be non existant. I need to know how many times
they occur in that time span. Usualy 4 or less pulses occure but could be double or tripple
that. woUld like to use 8 pin chip. 12f683 or simular. any IDEAS

tetsujp
- 26th February 2012, 15:48
Resistor low as 472 Ohms looks suspicious to me.
Have you checked MCLR pullup resistor (for instance 4.7k)?

16f54 is specified upto 20 MHz.
I don't think 20 MHz is possible using RC.
the RC oscillator on the PICs is only designed for low frequency (some MHz at best).

There is alternative way: use RF inductor (HS mode), values low as 22uH possible but somewhere there is margin when there is no more oscillation.

Due to high tolerance/temperature affection of small ceramic capacitors, I don't use RC at all.