Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Clock problems - PIC16F88

Status
Not open for further replies.

Tom81

Member
Hi All,

I've been using PIC16F88's and up until now I've had no dramas with them.

This latest problem has me absolutely stumped. I'm sure it's an obvious fix but I just cannot see it.

Ok, so the PIC is basically used to control 3 x 7 segment displays. I'm using MPLAB to write the program. I'm using a 4Mhz crystal with 2 x 15pF caps. In doing so, my config register is adjusted as such:

__CONFIG _CONFIG1, _CP_OFF & _WDT_OFF & _XT_OSC & _CCP1_RB0 & _LVP_OFF

I've used this code before under very similar circumstances, with no problems at all.

Anyway, I compile the code, everything seems fine. but when I test the pic in my circuit, the program runs a lot slower than normal. Then (this is where the confusion really sets in), I switch the circuit off, remove the crystal, turn the circuit back on, and it still runs. so I'm assumming it's running off an internal clock, despite the fact that I set it to external in the config.

Any suggestions?

Thanks. -Tom
 
In the menu configure->configuration bits, is the little box at the top ticked?

Mike.
 
where the second configure
Code:
__CONFIG    _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_ON & _PWRTE_ON & _WDT_OFF & _HS_OSC 
__CONFIG    _CONFIG2, _IESO_OFF & _FCMEN_OFF

I should there not be a pace between _CONFIG _CONFIG1
 
Last edited:
Hi Mike/be80be,

Thanks for your inputs.

the MCLR is tied high as i usually do (i've read on other threads you shouldn't do this although that's a separate topic)

Using a K150V22 programmer (Tony Nixon Design).

I used be80be's idea and switched both functions off in the Config2 register. this resulted in the circuit doing nothing. I then realised that with my initial problem, the PIC must have switched to an internal clock mode (which default is 31.25k) on account of external clock failure. So I tried different crystals. still no joy. It then occurred to me that I'd put 15nF caps with the crystal, not 15pF... I must have grabbed them by mistake in my haste to get the circuit up and running. Problem was so obvious. I feel very silly! Such a waste of time (although I did learn a great deal about the 88's oscillator options).

Swapped over the caps, circuit now working. Thanks a heap for your help, sorry for the stuff around! -Tom
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top