Sounds like you might be turning off the outputs one at a time at zero crossing. You could turn off a bank at a time in order to do it faster. Bill ----- Original Message ----- From: "M Graff" To: "Microcontroller discussion list - Public." Sent: Tuesday, November 08, 2005 8:14 AM Subject: Re: [pic] Differences between RA0..RA3, RA4, and RB0..7 on 16f648a? > Gerhard Fiedler wrote: >> There are some subtle differences between the port circuits; see the >> manual. (Except for RA4, but you know that.) But they don't normally >> cause >> such differences. A scope really would help here... >> >> Are you sure that your code treats the pins equally? Can you make them >> wiggle slowly, something like 5 seconds on/5 seconds off, so that you can >> check with a meter? > > So, it turns out I had a think-o. > > Basically, I was getting the interrupt indicating zero-cross and > immediately turning off the triacs and reloading the time-to-turn-on > counters. More or less, this macro, every time I got a zero cross: > > twiddle macro n > movfw initial#v(n) ; triacN > movwf current#v(n) > bz _fzc#v(n)on > bsf triac#v(n) > goto _fzc#v(n)off > _fzc#v(n)on: > bcf triac#v(n) > _fzc#v(n)off: > endm > > It turns out that I forgot that a triac cannot turn OFF at random times; > they only turn off when no (or, it turns out little) current is flowing. > Once I remembered this basic TRIAC knowledge after getting pointers from > other list members, I discovered that I could turn off the first four > triacs "in time" -- before the sine wave was high enough to cause the > TRIAC to insist that it wanted to be on. The others I could not. > > Since I know the frequency of the timer1 interrupt I am using to divide up > the wave, I simply counted them and when "too many" have passed I turn all > the triacs off. This means they will all start out as off on the next > zero-cross, and I can then decide when to turn them on again. As an > optimization, if the TRIAC is full-on, I never turn it off so I don't have > to handle that specially in the high-speed-needed timer1 interrupt > routine. > > Using this, I am able to get approximately 26 (non-equal) brightness > steps. I don't have any sort of calibration yet, other than an eyeball, > but I now have all eight TRIACS doing the "same thing" without any > additional hardware. RA4, even though it is open collector, only has to > sink, not source, so I just don't worry about adding a pull-up there. > > Thanks to everyone for all their help on this. I've actually gradated > college with a computer engineering major about 12 years ago and the most > electronics I've touched since then is to rewire my UPS to use deep cycle > marine batteries. I've decided microcontrollers are "fun" again, and I > wanted to make a cool holiday light display, so they seemed to be a > natural match. I'm just a bit rusty. :) > > --Michael > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist