PDA

View Full Version : PIC18F458 oscillator modes



josegamez
- 5th September 2006, 00:03
Hello.
I have a question about the programming of the PIC18F458. It involves the oscillator configuration of it,I read the datasheet and it's a bunch of gibberish to me mostly because its's the first time I've used a PIC and didn't have the possibility nor the time to choose a simpler PIC. Also since I'm using PICBasic Pro I don't know how it applies to this language. Basically my question is: how do I "tell" the PIC in which oscillator configuration it should work on? We want to develop our project first with a 4 Mhz crystal and then change to a 36 Mhz crystal (HS mode) so we need to make that change of configuration. I asked the people at Microchip but all they told me was to choose the configuration I needed in one of the MPLAB menus and I'm not even using the MPLAB IDE or even assembler for that matter. So any help would be welcome including source code sample if possible. Thanks to anyone who decides to help, and please excuse my ignorance in the subject. God bless.

niels
- 8th September 2006, 14:02
Hi,

You set the PIC oscillator configuration when you program the chip. If you're using anything other than 4Mhz, make sure you 'DEFINE OSC' to whatever frequency you are using otherwise your delay routines (and some other fuctions) will not work as expected.

I can't give you anything more specific because I don't know what software you are you using to program your PIC.

mister_e
- 8th September 2006, 15:08
have a look there
http://www.picbasic.co.uk/forum/showthread.php?t=543

you can't change toa 36MHZ crystal... it will be over the PIC spec (as far as i remind) BUT you'll be able to run your PIC @36MHZ by using the internal PLL (wich multiply your crystal frequency by 4)

In your case 36/4=9MHZ... if it exist ;)

BUT PBP don't allow 36MHZ... well yes but not directly. You'll have to play with the timing. Why not running it @40MHZ? PBP support this frewuency and you'll need a 10MHZ crystal.

HTH

josegamez
- 9th September 2006, 02:07
Thanks a lot guys. About the PIC supporting 36 Mhz I don't think there's any trouble, the datasheet states that it runs from DC to 40 Mhz, although it is true that PBP supports 33 Mhz and not 36 but I don't think it makes much difference for my aplication if PBP thinks it's 33 and the timings because of that turn to be a little bit off. The reason I didn't use a 40 xtal was that I could NOT get one anywhere so I bought the closest I could find. But thanks about the internal PLL tip, that was great, I hadn't even seen that, I think I will use that to get to an actual 40 MHz thanks. Again thank you guys, you were all very helpful. God bless

BigWumpus
- 10th September 2006, 21:55
I think, the quickest crystal you can get is between 20 and 25MHz. All crystal at higher "speeds" need to be driven on the 3rd harmonic frequency... PICs doesn't do that. Use the PLL-option instead !!