# Creating a +5V/-4V Clock with a PIC Micro

I'm working on a project to drive a CCD array which needs a particular signal with a high of +5V and a low of -4V, changing fairly rapidly. I'm using a PIC18F4620, which as far as I'm aware, looking at the data sheet, cannot produce a negative signal directly.

Above is the design I did a while ago with the components I had available. The inverter is quite slow, so I used a transistor with a switching signal from the PIC. Another signal is output at 0V/5V from the PIC. The two signals alternate so that at any one point, either the negative signal or the positive signal will be sent to the CCD.

Is this the right kind of idea? I tried using a diode to ensure the signals aren't going the wrong way (instead of going to the CCD), but as one is negative and the other is positive, this doesn't work. I feel like there must be a much simpler way to do this. Any help?

• If you did manage to turn on the NPN transistor it would put a short circuit across the -5V line. Fortunately the collector is more negative than base-emitter junction - in other words this won't work. Apr 26 '16 at 14:51
• Yes, there is a simpler way! Use european/IEC resistor symbols when drawing, then you don't have to draw all those wiggly lines that looks like inductors!
– pipe
Apr 26 '16 at 15:29
• What frequency? Apr 26 '16 at 17:28

Another option to throw into the mix, a simple comparator. In order to do it this way you would need a comparator with a push-pull output that can operate from a supply of at least $5V - (-4V) = 9V$. I've had a quick look and they do indeed exist, for example TLV7211. That one runs up to $15V$ and the SMD package is not much bigger than a surface mount transistor.

You would wire it up as follows:

simulate this circuit – Schematic created using CircuitLab

While the comparator is not actually specifically rated to run from a split supply, the great thing is it doesn't make a difference in this situation. As far as the comparator is concerned it is operating from a 9V supply. By shifting its ground pin down to -4V, the output will be either -4V and 5V depending on whether the input voltage is higher or lower than the reference voltage.

For the reference voltage, we need it to sit at about 2.5V, or half the input logic level. For the reference divider, you can either connect it between the two supplies as shown, or you can connect R2 to GND instead and make R1 and R2 equal in value.

Can't you just use a PNP transistor as an inverter and be done with it? I'm assuming your PIC outputs 5V logic. When PIC goes to 0V, PNP is turned on driving Vout to maybe 4.6V or so. You can use a P-channel MOSFET also.

You really need to qualify exactly what "changing fairly rapidly" means and what the impedance of your load looks like (what capacitance and resistance it looks like) to see if this will be "rapid" enough.

Schematic below.