Hello all,
How do I connect a digital pulse generator to a PIC? The PIC is programmed to count pulses before triggering an event. It is a bit tedious to sit and keep pressing a switch all the time!
The pulse generator has two outputs. The pulse generator circuit was found at **broken link removed**
All comments are appreciated.
Thank you in advance.
Barry.
You would set the pulse generator to whatever frequency you need and the voltage to 0->Vcc. Then you can just directly connect it to your input pin, though I would suggest you connect it through a 1K resistor, just in case your PIC firmware accidentally drives the pin.
You can make a pulse generator with another PIC. A PIC 12F675 for example has an internal clock so your pulse generator could be very simple - the PIC plus the previously mentioned resistor on the output pin.
How cool is that?
-Chris
Without adding more components you wouldn't be able to change the frequency. The pulse generator I spoke of consists of a loop that toggles the state of a pin, calls a delay routine, and then repeats. The delay has a fixed period. (You can use different delays for "signal high" delay, and "signal low" delay to control the shape of the square wave.)
To change the delay period/count externally you could use a potentiometer and one of the pins as an A/D input to get a number you could use to calculate your delay period. Of course that would double the number of components in your circuit to 2.
-Chris