I did something similar to this in the Dove Systems Shoebox series of dimmers (http://www.dovesystems.com/index.php?page=shop.flypage&product_id=26&category_id=2be9fce81c832af4590b8026387e0ec0&option=com_phpshop) . I originally started with a 16C74 a LONG time ago. I used the resistor to AC method of zero cross detect, but I used the secondary of my power transformer. When I moved to an F series chip, the resistor to AC no longer worked. I changed to using a full wave rectifier off the transformer secondary driving the base of a transistor. The collector drove the PIC for zero cross detect. This provided a pulse on all zero crosses. Back when I was using the resistor, I'd change the polarity of the interrupt detect on each zero cross so I could pick up both. I used the Capture Compare register to time out when to turn on each triac in the four dimmer box. Also, I did not pulse the triacs, but, instead, turned them on at the correct time, then turned them all off at zero cross. Incoming analog or DMX control saves four light levels in RAM. At zero cross, the level for the brightest lamp is converted to a timer tick value through a lookup table. This value is stored in the compare register for the CCP. There's a separate table for 60 Hz and another for 50Hz. At zero cross, the timer is also reset. If the stored value is close to the existing timer value (or the timer has already passed it), the corresponding triac is turned on immediately. The next brightest lamp is then run through the lookup table to find the timer tick value, and this is put in the CCP register. Again, if the timer is already close to this value, the corresponding triac is turned on and the next lamp value loaded. The trick of turning on an output before the timer gets to the tick value if we are close to the tick value keeps us from missing interrupts. If, for example, we have one lamp with a tick value of 0x1000 and another with a tick value of 0x1001, by the time we service the interrupt for the one with a value of 0x1000, the timer will have passed 0x1001. During debug, I found that if I had lamp 2 set to 50%, then slowly increased the level of lamp 1, lamp 2 would go out as lamp 1 went through 50%. A little past 50% and lamp 2 would come back on again. With the revised code, you can watch the lamp 2 output on a scope as you adjust the lamp 1 level. As lamp 1 goes through 50%, lamp 2 "follows" lamp 1 for a fraction of a percent, then goes back to its correct level. This is not visible on the lamp itself, only on a scope. The dimmer now uses an 18F452, so it is even less of an issue with the higher clock speed. Harold -- FCC Rules Updated Daily at http://www.hallikainen.com - Advertising opportunities available! -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist