I am trying to create a 1hz pulse to run a clock off.
I have a PIC16F627, and can I program it to oscillate at 1hz?
I do have a 32.768KHz crystal, could I use this with the PIC?
Apparently the PIC has an inbuilt RC oscillator, could I use this, or is it not accurate enough?
I do not have any experience with programing pic's, but I do have a serial port PIC controller with software for writing the programs to the PIC.
Well, at 32.768Khz, the PIC will execute 8,192 instructions per second, so you can just write a program with a sufficient delay. You'll just have to be careful about how many cycles are used by the code.
The 16F627 can produce a very accurate 1Hz signal especially when it has a 32.768kHz crystal. Are you confident you can program the chip? Whatever, if you are willing to put in the effort I'm sure we can easily sort out your 1Hz signal.
It's 2AM here and so time for bed. However, if you post a description of what you are trying to achieve then I'm sure the members here can come up with some helpful suggestions.
I am trying to make a clock. I have tried using lots of different ways to produce a 1hz pulse. They all failed!!
I have got a PIC that I want to use to generate the pulse.
I want one of the PIC's output's to be the clock pulse, and the crystal to be connected to the CLKIN and CLKOUT pins, preferably with no other components!
If someone could maybe have a go at starting to write a program, I would be most grateful!
I want one of the PIC's output's to be the clock pulse, and the crystal to be connected to the CLKIN and CLKOUT pins, preferably with no other components!
The capacitor selection is covered in the datasheet: table 14-2 suggests 68-100 pF for LP oscillator (32 kHz).
The configuration is shown by Figure 14-1.
Bill suggests 12pf caps and the original Microchip Demo boards, that I have, use 22pf caps for the 32.678khz crystal. The datasheet suggests 68 - 100pf though. The datasheet notes that higher values increase stability, but also increase start-up time. You are also advised to consult the crystal manufacturer's datasheet. Go figure.
Anyway, you will need 2 caps for your 16F627. The crystal connects to pins 15 & 16 then the caps are connected, one to each pin and then both to ground.
Which demoboard do you have exactly? Do they use the 32 kHz crystal as the system oscillator? I've noticed that they suggest 33 pF capacitors (this value is nearer to the 22 pF caps you mentioned) if you connect the crystal to the TMR1 oscillator. Thanks
I am trying to create a 1hz pulse to run a clock off.
I have a PIC16F627, and can I program it to oscillate at 1hz?
I do have a 32.768KHz crystal, could I use this with the PIC?
Apparently the PIC has an inbuilt RC oscillator, could I use this, or is it not accurate enough?
I do not have any experience with programing pic's, but I do have a serial port PIC controller with software for writing the programs to the PIC.
Thanks for that code. I will try it and get back to you.
I have already assembled the rest of the clock using CMOS 4510/4511 so would rather use them than rewire the rest of the clock.
Datasheets usually suggest smaller caps when the crystal is driven by the TMR1 module. In your demoboard you should have another crystal that is used for the system clock (20 MHz); so 22 pF caps should be ok with the 32 kHz crystal there. But if you use the 32 kHz crystal for the main clock, 68-100 pF caps look more suitable according to the datasheet of the PIC16F627 (and other PICs) - as we both have suggested earlier. Many people say that those values are not that critical, but I've always done as written in the datasheet, so I can't tell you.
Also, I experienced some problems when specifying the XT oscillator in the configuration word when I was actually using a HS oscillator. That might apply for LP crystals as well? I would use
I only have a 38k crystal and 33pF capacitors and just tried it on a breadboard and it worked fine. I suspect that you will get a more stable and probably more accurate oscillator if you use the recommended 60pF caps. If your just breadboarding it then try it and see. If your soldering them in place I think I'd hold out for the right ones.