Yes, you will have to sync to the AC zero crossings to run a triac for dimming control, and some sort of ZC detect is usually used for on/off control. You don't need to PWM the gate, unless your load is inductive (ST Micro has some docs on that). As I recall, you said that your AC was 4khz? At that rate, that is 8hz in half cycles (you turn on triac once each half cycle, it turns off at end of 1/2 cycle), and you'll only have about 125us between the start and end of each half cycle. That's 125 instructions at 1mhz code speed (4mhz chip). If your able to have a pretty close AC sync, and you have a timer automatically turning on a port (read hardware), you'll have a granularity of 125 "possible" turn on points in each 1/2 cycle, probably less. If using an interrupt, you'll have some code overhead, and some loss or gain in timing each half cycle. Not exactly conducive for dimming control. The way most triacs work, you have to hold the gate on for at least 10 to 15us, depending on how many Ma your feeding it (until it "latches"), and it must be off again before the end of the 1/2 cycle (or the triac will be full on for the next 1/2 cycle). For on/off control, I could see using a PWM to run a 15us pulse at the beginning of each 1/2 cycle, if you can sync it with ZC's. I'm not sure if you'd burn up the gate if you just left it on all the time or not. Of course, you could for-go the ZC detector for the PIC, and just use a ZC triac opto instead. Leaving the gate on shouldn't be a problem then, and the ZC circuit in the triac optocoupler should keep you from getting that nasty transient noise. Also, at that high of a frequency (4khz), especially on a non-sinusoidal waveform (like a square or sawtooth), you need to watch that you don't exceed the triac's dv/dt ratings, or you'll get false triggerings (read "snubber"). For on/off control triacs could work, but I don't know how well it would work for dimming at that frequency.... -----Original Message----- From: Jesse Lackey To: PICLIST@MITVMA.MIT.EDU Date: Saturday, April 13, 2002 3:18 AM Subject: Re: [EE] Triacs and AC power >Ok I should do more homework before asking ... I got the datasheet from >On Semiconductor (I had just a single summary page from motorola), and >they have MT1 connected to ground in their "quadrant definitions" >picture ... oops ... I moved my ground to MT1 and its working ... even >the PWM dimming code, tho not completely correctly (I tested it using >LEDs and I think I need to lengthen the cycles - or sync to AC - below >about 70% on the triac doesn't turn on at all). > >Well. I feel about 20% less like a loser now. I was mostly on the >right track. Just needed more of a clue. > >Thanks everyone for your help!!! > >Jesse >-- >Bill Gates is a crook and millions of tax dollars have been spent >prosecuting and convicting Microsoft of illegal business practices. Do >not give them another dime until they have repaid the US government >these costs. > >-- >http://www.piclist.com hint: The list server can filter out subtopics >(like ads or off topics) for you. See http://www.piclist.com/#topics > > > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics