Analog Switch -- Unipolar


In this and the next exercise, we'll see how to switch analog signals with the PIC. For our first foray, we'll restrict ourselves to simply switching unipolar voltages, and within the +5V limits of the PIC. The ever-trusty CD4066 is employed.


The demo is simple, but useful in its own way. A TLC555 timer (CMOS version of the 555) is configured in astable mode to produce a sound on a piezo. Then we'll coerce the CD4066 to switch the timing capacitor, yielding a 1 kHz tone with one cap, and a 2 kHz tone with the other. The PIC, under PMP software control, alternates between these choices, give a 5 second burst at the lower frequency, followed by a 5 second burst at the higher.

Thus, the analog switch simply chooses which capacitor should guide the TLC555 through its oscillations. Clearly, all voltage levels are unipolar, riding between 0V and +5V.

And, oh, be sure to note the use of the "delays.pas" library unit which gives access to the delay_sec() command. Not a big deal, but kind of handy.

Click to get the source code.
Click to get the schematic PDF.

Next Project: Analog Switch -- Bipolar

No comments:

Post a Comment