program for pic12f675 it features two AC (50Hz) dimmer circuit drivers dim levels can be set from a PC using a simple serial protocol alternatively dim levels can be set from an analog dial (both dimmers will have the same level) This is the pin usage, pins are named with their function as in the datasheet. pin 1: VDD (5V) pin 2: GP5 -> dimmer1 pin 3: GP4 -> dimmer0 pin 4: GP3 <- PC serial data (input) pin 5: INT <- zero crossing detector, active high pin 6: GP1 <- PC serial clock (input) pin 7: AN0 <- potentiometer 10K from 0V to 5V pin 8: VSS (0V) [PIC16F627 testing] pin 14: VDD (5V) pin 18: RA1 -> dimmer1 pin 17: RA0 -> dimmer0 pin 9: RB3 <- PC serial data (input) pin 6: INT <- zero crossing detector, active high pin 12: RB6 <- PC serial clock (input) pin 5: VSS (0V) program is (after initialisation) completely interrupt driven - timer0 interrupt will occur 100Hz*256 (256 dim levels, zero crossing 100 per second) - INT interrupt will occur at 100Hz (whenever a zero crossing is detected, rising edge) - A/D converter will signal if A/D conversion is ready - GP3 will generate an interrupt on change (timer1 is used for timeout on recv) processor can not be put to sleep, because timer0 will stop when asleep