Custom Search

Tuesday, October 12, 2010

USB-Powered PIC Programmer

This simple circuit can be used to program the PIC16F84 and similar "flash memory" type parts. It uses a cheap 555 timer IC to generate the programming voltage from a +5V rail, allowing the circuit to be powered from a computer’s USB port. The 555 timer (IC1) is configured as a free-running oscillator, with a frequency of about 6.5kHz. The output of the timer drives four 100nF capacitors and 1N4148 diodes wir-ed in a Cockroft-Walton voltage multiplier configuration.
The output of the multiplier is switched through to the MCLR/Vpp pin of the PIC during programming via a 4N28 optocoupler. Diodes ZD1 and D5 between the MCLR/Vpp pin and ground clamp the output of the multiplier to about 13.6V, ensuring that the maximum input voltage (Vihh) of the PIC is not exceeded. A 100kΩ resistor pulls the pin down to a valid logic low level (Vil) when the optocoupler is not conducting.

LCD Module in 4-bit Mode

In many projects use is made of alphanumeric LCDs that are driven internally by Hitachi’s industry-standard HD44780 controller. These displays can be driven either in 4-bit or 8-bit mode. In the first case only the high nibble (D4 to D7) of the display’s data bus is used. The four unused connections still deserve some closer attention. The data lines can be used as either inputs or outputs for the display. It is well known that an unloaded output is fine, but that a floating high-impedance input can cause problems. So what should you do with the four unused data lines when the display is used in 4-bit mode? This question arose when a circuit was submitted to us where D0-D3 where tied directly to GND (the same applies if it was to +5 V) to stop the problem of floating inputs.

The LCD module was driven directly by a microcontroller, which was on a development board for testing various programs and I/O functions. There was a switch present for turning off the enable of the display when it wasn’t being used, but this could be forgotten during some experiments. When the R/Wline of the display is permanently tied to GND (data only goes from the microcontroller to the display) then the remaining lines can safely be connected to the supply (+ve or GND). In this application however, the R/Wline was also controlled by the microcontroller. When the display is initialised correctly then nothing much should go wrong. The data sheet for the HD44780 is not very clear as to what happens with the low nibble during initialisation.
After the power-on reset the display will always be in 8-bit mode. A simple experiment (see the accompanying circuit) reveals that it is safer to use pull-down resistors to GND for the four low data lines. The data lines of the display are configured as outputs in this circuit (R/Wis high) and the ‘enable’ is toggled (which can still happen, even though it is not the intention to communicate with the display). Note that in practice the RS line will also be driven by an I/O pin, and in our circuit the R/W line as well. All data lines become high and it’s not certain if (and if so, for how long) the display can survive with four shorted data lines. The moral of the story is: in 4-bit mode you should always tie D0-D3 via resistors to ground or positive.

Long-Interval Pulse Generator

A rectangular-wave pulse generator with an extremely long period can be built using only two components: a National Semiconductor LM3710 supervisor IC and a 100-nF capacitor to eliminate noise spikes. This circuit utilises the watchdog and reset timers in the LM3710. The watchdog timer is reset when an edge appears on the WDI input (pin 4). If WDI is continuously held at ground level, there are not any edges and the watchdog times out. After an interval TB, it triggers a reset pulse with a duration TA and is reloaded with its initial value. The cycle then starts all over again. As a result, pulses with a period of TA + TB are present at the RESET output (pin 10).

As can be seen from the table, periods ranging up to around 30 seconds can be achieved in this manner. The two intervals TA and TB are determined by internal timers in the IC, which is available in various versions with four different ranges for each timer. To obtain the desired period, you must order the appropriate version of the LM3710. The type designation is decoded in the accompanying table. The reset threshold voltage is irrelevant for this particular application of the LM3710. The versions shown in bold face were available at the time of printing. Current information can be found on the manufacturer’s home page ( The numbers in brackets indicate the minimum and maximum values of intervals TA and TB for which the LM3710 is tested. The circuit operates with a supply voltage in the range of 3–5 V.

Pulse Frequency Modulator

The pulse width of the compact pulse cum frequency modulator can be varied by altering the change-over point of comparator IC1 with a control voltage via resistor R1. The hysteresis of the IC is determined by resistors R3 and R4. The control voltage also causes the frequency of the present circuit to be altered. When the input voltage is 0 V, the frequency is a maximum: in the present design this is about 3.8 kHz. The level of the output voltage is ±12–13 V. The more the change-over point has been shifted with the control voltage, the longer it will take before the potential across capacitor C1 has reached the level at which IC1 is enabled.When the control voltage is larger than the zener voltage, the oscillator ceases to work. The maximum period is 25 ms, which may be adapted by altering the value of C1. This will, of course, also alter the maximum frequency. The duty cycle is inversely proportional to the control voltage. The minimum pulse width attainable at the lowest frequency is about 6 µs. The modulator draws a current not exceeding 5 mA.

Frequency Doubler

If you are working at frequencies of the order of 850MHz to 4GHz and find that a frequency multiplier is required, the HMC 187, HMC 188 and HMC 189 (see table) frequency doubler may be just the solution you are looking for. The isolation performance of these devices ensures that the input frequency (fin) and its harmonics 3fin and 4fin are attenuated by 35dB relative to the wanted output frequency 2fin. This excellent isolation specification reduces the need for additional output filtering and is also an advantage where several doublers are connected in series to produce four or eight times the input frequency.The tiny outline of the HMC18x- series device occupies a board area of 3mm by 4.8mm and measures just 1.07 mm high. Internally the device contains balanced to unbalanced transformers (baluns) to match the doubler circuit with the output and input. The doubler circuit itself is passive and comprises a full wave Schottky diode bridge rectifier. The monolithic baluns which are integrated on-chip give the device a relatively high low-frequency roll-off at 850MHz.

Lower frequencies can also be multiplied but the conversion loss factor (given as typically 15 dB) will increase. The input and output are matched for 50 Ohm operation and the input signal level should be of the order of +15dBm which will give a output level of approximately 0dBm. The main characteristics of the three versions of this device are summarized in the table above.

RMS to DC Converter

In order to measure the RMS value of an alternating voltage an accurate converter is required to produce the true RMS value of its alternating input as a DC output. With simple sinewave inputs the RMS voltage can simply be calculated as 0.707 times the peak AC voltage, but with complex waveforms the calculation is not nearly as straightforward. The RMS value is defined as the DC voltage that would give the same heating effect in a resistor as the alternating voltage. The LTC 1966 from Linear Technology ( uses a new form of delta-sigma conversion and is designed for battery operation, drawing only 170µA from the supply. The new technique is accurate to 0.02 % between 50 mV and 350 mV and is highly linear. It can operate from 50 Hz to 1 kHz (with an error of 0.25 %) and up to 6 kHz with a 1 % error.The input voltage range on the differential inputs IN1 and IN2 extends to the supply rails, and so in the non-symmetrical circuit shown here the voltage on IN1 can swing between 0 V and the supply voltage. If the signal to be measured is AC only, then another coupling capacitor will be required. The input impedance is many megohms. The output voltage at the OUT pin can be offset by applying a DC voltage to the OUTRTN pin. This is particularly helpful when using the device with LCD multimeter ICs such as the 7106. A further capacitor is connected to the output which is charged up to the required voltage by the switched-capacitor circuit in the converter. The capacitor required is ten times smaller than that demanded by previous RMS to DC converter designs. The LTC1966 is not temperature sensitive and is available in an 8-pin MSOP package. It allows a tiny RMS to DC converter to be constructed using just four components.