In <19970701.202612.10566.0.mkeitz@juno.com>, on 07/01/97 at 08:21 PM, Mike Keitz said: ->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 That is the beauty of this approach- there is *no* heavy load. I'm sure you've recognized that a capacitor/resistor in this combination is a differentiator. Therefore the only thing that matters here is the *slope* of the PIC output. The SCR is on, until the load drops below the holding current, after which this process may be repeated. Once the PIC has say, written a 1 to its output, a mS or so later there is *NO* load on the PIC pin. Oh, and by the way, this driving technique will not work driving reactive loads. It works for resistive loads only, like a lightbulb which is what I understood the application to be. David ->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). \|||/ o o David Darknell -------+--+--oOO-(_)-OOo--+--+----------------------------------------- |--|__|--|___|--|__|--| david@xia.com david@papdev.com "In a world without need of fences, who needs Gates." Author unknown _______________________________________________________________________