PDA

View Full Version : Xternal oscillator signal??



Robotica1
- 10th July 2007, 18:30
Hi there all,
My first post so howdy and all greetings. I tried to put this post in general questions (where I feel it belongs) but was blocked for some reason. I am wishing to use the clock signal from an asynchronous 555 circuit as the oscillator for a Pic16f628a. (This way I am hoping to be able to adjust the speed of the Pics output signals by adjusting the input timing signal). I am wondering how to set this up. I set ICProg to code an 'EXTClk' for the Oscillator and inputted my 55 signal to RA7 on the PIC but no joy. Could someone please tell me how I could set this up(or even whether I could set it up at all). Previously I have only ever used XTAL oscillators and never had any difficulty.

skimask
- 10th July 2007, 18:48
I set ICProg to code an 'EXTClk' for the Oscillator and inputted my 55 signal to RA7 on the PIC but no joy. Could someone please tell me how I could set this up(or even whether I could set it up at all).

How are you sure that ICProg is actually setting the config fuses?

Melanie
- 10th July 2007, 20:03
How do you know your PIC is not working?

Consider the test code below...


LED var PortB.0
TRISB=%00000000
loop:
Pause 1000
Toggle LED
Goto Loop

End

If your 555 is running at 100kHz it would actually take 40 seconds before the LED lit (with PBP set to a 4MHz default - unless you've told it otherwise). What speed is your 555 running at? Is it running? Have you remembered to tie MCLR to Vdd or otherwise set it to internal?

Robotica1
- 11th July 2007, 15:11
I checked my 555 oscillator with a plain LED prior to switching across. As far as setting fuses I assume that when I choose 'EXTClk' as the oscillator fuse setting in ICProg that the correct settings will be applied. Perhaps I just didn't give the PIC time to fire. I will check the frequency of my 555 oscillator and try again. Please just clarify one thing: ?I totally vanish my XTAL setup (ie crystal and caps) and replace with a signal line in to RA7 from whatever oscillator setup I wish to use?

Here is my test code:
device = 16f628a
loop:
high porta
pause 33
low porta
pause 33
goto loop

Robotica1
- 11th July 2007, 15:52
Thanks again Melanie.
Well it seems I've learned something so glaringly obvious I really do feel all gumby and shamed. A clock signal of 5hz will take significantly longer to tick over than one of 4mhz (like somewhere in the vicinity of 3999995 times slower). Long enough to make someone think something isn't clocking!! I can't believe I didn't pick that one up. (Maybe an excuse is coding at 3:00 AM ) Thanks for your help and I'll really try to think things through before asking such silly qu's in the future.

Cheers

skimask
- 11th July 2007, 16:26
As far as setting fuses I assume that when I choose 'EXTClk' as the oscillator fuse setting in ICProg that the correct settings will be applied. Perhaps I just didn't give the PIC time to fire. I will check the frequency of my 555 oscillator and try again. Please just clarify one thing: ?I totally vanish my XTAL setup (ie crystal and caps) and replace with a signal line in to RA7 from whatever oscillator setup I wish to use?


Yep, get rid of it all.
But, a 555 output will only work as an OSC1 input to the '628A if the 555 output swings far enough high and/or low. You might have to put some sort of buffer between the 555 and the PIC.

Melanie
- 11th July 2007, 16:44
OK, I'm now going to kick you where it hurts with my spikey heel just to make you feel doubly bad...

Your example code...

Fault 1.

The 16F628A has ANALOG feature pins on PortA. If you don't switch the ANALOG features OFF first, some of those pins won't work.

Fault 2.

Look at the PBP Manual. HIGH and LOW commands only work on an individual PIN and not on an entire PORT!

Fault 3.

Oh, and the 'device=' statement probably means you're on the wrong forum... so you defiitely deserve that kick! *smiles*

skimask
- 11th July 2007, 17:20
A clock signal of 5hz will take significantly longer to tick over than one of 4mhz (like somewhere in the vicinity of 3999995 times slower).

4,000,000 / 5 = 3,999,995 ?
How about 800,000...

Robotica - does not compute!