This is a follow-up to my previous article here. When testing the 1 PPS output I found some strange output which needed further investigation. I also decided to make further use of the microcontroller and status LED to indicate the 1 PPS signal to provide a degree of visual confidence that the frequency standard was working.
The fast comparator used in this circuit is an LT1016
When I first tried to implement this I used (or tried to use) the edge trigger interrupt capability which on the face of it should have been the perfect solution. However, no matter what I tried I could not get it to work, the best I managed to achieve was getting it to work some of the time, but it was very random. I suspect this was down to the way in which the PIC12X handles interrupts and context state saving implemented by the compiler, I read somewhere on the microchip forums that this issue *could* be resolved by upgrading to the PRO version of the compiler…..hmmmmmmm. Anyway, I decided to change tact and poll for the 1PPS signal which meant I also had to construct a really simple pulse stretcher circuit to ensure I was able to catch each pulse. Not as elegant as an interrupt-driven solution but it works. I think the more advanced PIC18Fxxx series micro controllers would have worked using interrupts but those are big chips and I was already committed to the PIC12F675.
Here is the firmware source code with the 1PPS implementation added. Its implemented as a simple state machine in run mode, I have tried to keep the code simple to read.
And for those of you that just want to program the chip, here is the compiled HEX file.
Catch you next time….
This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.