On Tue, 1 Jul 1997 12:09:32 -0700 david@PAPDEV.COM writes: >You may drive your average cheap sensitive gate SCR with a 0.1 uf >capacitor between the PIC output port and the SCR gate, and a 1K or so >resistor between the SCR gate and SCR Cathode. Make sure with this >arrangement that the SCR Cathode is at PIC signal ground. When driving heavy or reactive loads such as this, it is a very good idea to structure your software so as not to require reading back the port. When a port is read, the value returned is the state of the pins, not the value in the output latch. So if an external load is holding an output pin down, it will read as 0 even though it is trying to output 1. The data book touches on this. A common pitfall are the BSF and BCF instructions, these internally read all 8 bits of the port, set or clear one bit, then write all 8 bits back. If you try bsf PORTB,0 ;SCR # 1 on bsf PORTB,1 ;SCR # 2 on with a large capacitor connected to port B0, the second BSF will end up writing a zero back to the bit 0 output latch, and only a very short (one instruction) pulse will appear at B0. A better way to do this is bsf mirrorb,0 ;SCR 1 will be on bsf mirrorb,1 ;SCR 2 will be on movfw mirrorb movwf PORTB ;Write new SCR drive Now the RAM location 'mirrorb' has a reliable copy of the last bits written to port B. In a lot of cases it won't be necessary to read back the outputs anyway, so just use movlw b'00000011' ;SCRs 1 and 2 on (rest of B outputs 0) movwf PORTB instead of the BSFs. > >I've made no mention of any hazards, or otherwise here. So be >careful! >60+ volts can be deadly. For software development, build a low voltage version of your circuit, driving it with 12V or so AC from a transformer and using suitable low-voltage bulbs. You can touch, poke, and prod this circuit with relative impunity. Once the software is done, the PIC should plug right into the live full voltage version and work flawlessly (yeah, right. At least most of the bugs will be out of it).