Brian Clewer writes: > Can anyone help me with a vaguely PIC related problem...? > > I have a project in which I need to control the brightness of a 12V lamp > from a PIC. The lamp has to go from maximum brightness to the off state. I > am planning on implementing this using varying mark-space ratios so to > minimise power loss. > > Can anyone advise me on a cct. for doing this? I am close by using a E2POT > digital potentiometer from Xicor and a CA555 timer, but this will only give > me a mark:space ratio of 1:1 at one extreme. i.e. I can only get it half > dimmed, or half bright depending on the polarity of the output. However, > this cct. does have the advantage of only using two pins on the PIC. > > If anyone could advise of a timer circuit with which I can use the E2POT and > still obtain a full range of mark:space ratios (with minimal component > count) I would be very grateful. One additional point is that mains supply > is not available, so this cannot be used as a frequency generator. You can make a PWM signal (fully variable mark-space ratio) using the 555 timer and pot that you have and an additional comparator. The trick is that you ignore the square wave output of the 555 completely. The timing capacitor on the 555 is linearly charged and discharged at the frequency of the 555 so that it has a triangle wave on one side of it. Connect the triangle wave to one comparator input and the pot wiper to the other input. The output of the comparator will be a PWM signal with a duty cycle that is controlled by the pot wiper voltage. The limits of the triangle wave are 1/3 and 2/3 of the supply voltage so to have a full range of duty cycles the pot wiper must also cover this range of voltages. The catch is that the comparator may not have the same 200 mA drive capability as the 555. Comparator could be an LM311 or an emitter-coupled pair of transistors. > Thanks a lot! > Chris Windram No problem. Mal Goris -- http://www.nfra.nl/~mgoris/