Managing multiple channels driving triacs


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263

    Unhappy Managing multiple channels driving triacs

    Using: 16F88 at 8 MHz and Darrel's interrupts (INT_INT).

    Overview: I'm reading 5 different analog values and attempting to drive 5 corresponding triacs with outputs proportional to the analog voltages (forward phase-cutting). INT_INT provides the AC zero-crossing signal.

    Successes so far: All blinkies have worked. I can get any one channel to do what I want, but I can't manage all five.

    What I've been doing: I read the analog channel(s) in MAIN (looped), then let the interrupt handler turn on the channel(s).

    One problem seems to be manipulating the analog values. If I do this in MAIN, even for a single channel, the output result is screwy, so I do it in the handler, which begins to bog it down time-wise. In the handler, I've tried loops counting up, loops counting down, and in either case it seems the killer is the conditional testing to determine when to fire the triac(s).

    I'm not asking anyone to write the code for me; I've got working fragments from here to hell and back.

    I'm looking for a strategy. Suggestions, please?
    Last edited by RussMartin; - 4th February 2010 at 02:33.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Russ,

    I don't know how you are doing things, but a couple come to mind:

    #1. Use an 18F chip. They are generally more efficient, and their A/Ds are faster.

    #2. Don't use ADCIN - You can "interleave" the converter. Write the
    A/D registers directly.

    A. Change to a channel
    B. Go off and do something for 10uSecs or so (acquisition time)
    C. Start the converter
    D. Go off and do something else for 15uSecs or so (conversion time)
    E. Read the converter (test the ADC DONE bit).
    F.Go back to step "A"

    By doing things this way, your A/D conversion time is close to zero, and you have plenty time to do whatever else you need. I did 4 simultaneous channels of 60Hz RMS conversion this way. The square root routine takes a lot of time, so I had to make every uSec count. I was using an '8723 at 40Mhz, though.
    Charles Linquist

  3. #3
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Thanks, Charles.

    But for the nonce, I'm stuck with the 16F88.

    The A/D conversion time isn't hurting me (at least I don't think so); that's in the MAIN loop.

    The difficulty is manipulating five outputs in the interrupt handler during the 8.33 ms AC phase.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  4. #4
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    The only problem I see is the number of bits of resolution you need. I assume you are doing lights, so the phase-angle vs. brightness is not linear. I also assume you have a zero-crossing detector somewhere. If you can deal with 20 "steps" or so, I would:

    Sit in a loop until you get a zero cross
    Start a 410uSec interrupt
    In the ISR decide which of the 5 channels you want to turn on
    After 20 interrupts, go back to the main loop and wait until you get another
    zero cross.
    Charles Linquist

Similar Threads

  1. Replies: 3
    Last Post: - 17th April 2007, 14:45
  2. Reading multiple ADC channels FAST
    By lwindridge in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 21st April 2004, 22:37

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts