28x2 clock speeds.

rob235

New Member
Hi,

I’m using a 28x2 with a 4mhz xtal and have used the setfreq em16 command at the start of my code.

However when I use serout T2400_16 the baud rate seems to 1200…

To get 2400, I need to use T2400_8 which doesn't make sense. (using an 08m running at 8mhz as the reciever)

My theory is that the xtal isn’t oscillating and the 28x2 has defaulted to the internal 8mhz. does this make sense?

Thanks.
 

geoff07

Senior Member
It sounds a sensible diagnosis, do you have any means of testing? Such as access to a scope? You would see a signal on the pins.

Do you mean crystal or ceramic resonator? A crystal needs two capacitors to ground, a resonator is already a three-terminal device.

However, if you want 16MHz you don't need an external resonator anyway, just use setfreq m16. (assuming you aren't using one of the old 28x2-5v devices)

You could confirm the clock speed by flashing an led using do/toggle ledpin/pause 1000/loop and seeing how long the flashes actually are.
 
Last edited:

srnet

Senior Member
My theory is that the xtal isn’t oscillating and the 28x2 has defaulted to the internal 8mhz. does this make sense?
Yes it does.

The 18F25K22 (28X2) can be setup to failsafe on the clock. If the external clock fails, the PIC switches to the internal clock.

So I would presume that when the 28X2 firmware is burnt to the chip, the failsafe option has been set.
 

rob235

New Member
Thanks for the advice Geoff07, timing the LED has proven that the picaxe is running at 8mhz.

My chip is a 18F25K22 and I am using a crystal with two 10pf capacitors to ground. However I didn't realise I could use the internal oscillator at 16mhz - I'll just do that for now.
 
Top