​ ​ ​ ​ Triggered I/O
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 20

Thread: Triggered I/O

  1. #1
    Senior Member
    Join Date
    Feb 2010
    Location
    Don't Mess With My Texas!
    Posts
    2,573
    Blog Entries
    7

    Lightbulb Triggered I/O

    I'm looking for fresh input. I must be fried, because I can't think of a simple way to do this.

    I have a hardware device (function unimportant) that has a TRIG_IN input, a TRIG_OUT output and a SELF_TRIG link (where the IN is directly connected to the OUT.)

    So, the following subs work great for connecting one device to another and getting them to function in sequential order.

    I call the TrigOut routine after the first one is finished functioning, and then the next one is waiting for that pulse in TrigIn and performs its function.

    What I can't seem to figure out is the SELF_TRIG operation with a hardware link where the first device continuously performs its function by triggering itself. I know it can't be done with two separate subroutines, but seems like there should be a simple way.

    There is no separate indicator that self trigger should occur. Its just a link from out back to in.

    Help? (Hoping Hippy has some magic dust to throw on this problem! )

    Code:
    '---------------------------
    '------[ SUBROUTINES ]------
    '---------------------------
    
    TrigOut:
       ' create a timed high level on the TRIG_OUT pin
       pulsout TRIG_OUT,ONESECOND
       return
    
    TrigIn:
       ' wait for a timed high level on the TRIG_IN pin
       do until TRIG_IN = TRUE : loop
       return
    - Tex
    __________________________________________________ _______________________
    These words are my opinion, WYLION. Any resemblance to truth or fiction is accidental at best.
    "Truth lies dormant in our future history." ― Tex Clodhopper LXVI
    "Confidence is ignorance. If you're feeling cocky, it's because there's something you don't know." ― Eoin Colfer, Artemis Fowl

  2. #2
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    24,442

    Default

    Quote Originally Posted by Texasclodhopper View Post
    Hoping Hippy has some magic dust to throw on this problem!
    You might have to explain what you have / want in more detail. You "have a hardware device"; but where does the PICAXE fit into this scheme of things ?

    A block diagram might help explain what you doing or trying to achieve.

  3. #3
    Senior Member
    Join Date
    Feb 2009
    Location
    Cheshire, England
    Posts
    2,496
    Blog Entries
    4

    Default

    If the 'Trig_IN' pin is an input to a PICAXE, and the 'Trig_OUT' is a normal PICAXE output from the same chip, then there will be no problem connecting the pins of one PICAXE to itself.

    But if you then connect the 'Trig_OUT' pin of another PICAXE to this arrangement you will be short-circuiting that output each time one of the other devices sends a trigger.

    Much better to use a diode driver onto a bus.

    With this arrangement, and a requirement that trigger pulse is one second long, it is possible to determine that the in & out are linked by using very short 'test' pulses.

    It's an interesting problem to solve.

    Cheers,

    Buzby

  4. #4
    Senior Member
    Join Date
    Feb 2010
    Location
    Don't Mess With My Texas!
    Posts
    2,573
    Blog Entries
    7

    Default Block Diagram

    Buzby, that is correct, but the object is to allow for "daisy chaining" of function blocks similar to RX/TX in serial comms. The spec would have to be that an output would not "return" to the origin without the link having been removed. Diodes would be the friend here, but I was trying to think in terms of software.

    Here's a simple block diagram, but imagine that this could be several blocks strung out to the right with each performing a sequential function.

    ADDED:

    I'm using a 20X2. I'm always forgetting about the "SRLATCH" stuff with SRQ. It would mean some hardware changes (PCB etc.) Not optimal.

    I guess I'm going to have to poll the timer in order to RESET the pin after TRIG_IN detects the TRIG_OUT level whether using a regular pin or SRQ.
    Attached Images Attached Images
    Last edited by Texasclodhopper; 20-12-2017 at 21:08. Reason: ADDITIONAL
    - Tex
    __________________________________________________ _______________________
    These words are my opinion, WYLION. Any resemblance to truth or fiction is accidental at best.
    "Truth lies dormant in our future history." ― Tex Clodhopper LXVI
    "Confidence is ignorance. If you're feeling cocky, it's because there's something you don't know." ― Eoin Colfer, Artemis Fowl

  5. #5
    Senior Member
    Join Date
    Feb 2009
    Location
    Cheshire, England
    Posts
    2,496
    Blog Entries
    4

    Default

    Looking at your block diagram, it is unclear how further devices would connect.

    Edit :

    If in 'normal' operation you need each device to start when the previous one finishes, then the simplest way is for each node to have it's trig_out connected to the trig_in of the next node, and repeat this for each node.
    Code:
    ------------in-[node1]-out------[1K]-------in-[node2]-out------[1K]------in-[node3]-out---------
                                                 |-short-|
    To determine if a node is shorted just needs a resistor in each link, and a bit of extra code.

    Firstly, use the pullup instruction on the 'in' pins.
    Secondly, use tristate on the 'out' pins such that active=0v, and idle=floating. You can do this by using 'LOW' and 'INPUT' to set the active and idle states.

    Now, if you drive the 'out' LOW, the 'in' will show low if it's shorted, but show high if it's not.

    You can't use simple PULSIN/PULSOUT because of the tristate requirements, so you will have to do the timing in code, but no PCB changes needed.

    Cheers,

    Buzby
    Last edited by Buzby; 21-12-2017 at 00:53.

  6. #6
    Senior Member
    Join Date
    Feb 2010
    Location
    Don't Mess With My Texas!
    Posts
    2,573
    Blog Entries
    7

    Default

    The diagram is shown with only one set. The TRIG_IN would connect to TRIG_OUT on the left and provide TRIG_OUT to another function block on the right ... daisy chain style.

  7. #7
    Senior Member
    Join Date
    Feb 2009
    Location
    Cheshire, England
    Posts
    2,496
    Blog Entries
    4

    Default

    Hi Tex,

    Thats what I 've shown above. Each node triggers the next, left to right.

    Are we singing from the same hymnsheet now ?

    Cheers,

    Buzby

  8. #8
    Senior Member
    Join Date
    Feb 2010
    Location
    Don't Mess With My Texas!
    Posts
    2,573
    Blog Entries
    7

    Default

    I missed your edit when I replied. Yes, I see what you've diagrammed and how to determine proper hardware operation. That might be necessary.

    So, the "problem" is not on how to trigger the sequentially installed function blocks one after another. That works fine.

    The solution I'm trying to come up with is how to use the same circuitry, TRIG_OUT and TRIG_IN within one function block to continuously trigger the function of that block; triggering itself in the same way that it would trigger other blocks.

    Jumpering the TRIG_OUT to the TRIG_IN within a function block is part of the hardware, but I haven't found a simple way to accomplish that in software and maintain the "daisy chain" operation, too.

    You can't just generate a TRIG_OUT pulse, because the pulse is obviously gone before the subroutine has exited.
    - Tex
    __________________________________________________ _______________________
    These words are my opinion, WYLION. Any resemblance to truth or fiction is accidental at best.
    "Truth lies dormant in our future history." ― Tex Clodhopper LXVI
    "Confidence is ignorance. If you're feeling cocky, it's because there's something you don't know." ― Eoin Colfer, Artemis Fowl

  9. #9
    Senior Member
    Join Date
    Feb 2009
    Location
    Cheshire, England
    Posts
    2,496
    Blog Entries
    4

    Default

    Hi Tex,

    It's too late ( 02:16 here ) for me to explain my idea in detail, but so I can start tomorrow, what pins on the 20X2 are you using for trig_in / trig_out ?

    Cheers,

    Buzby

  10. #10
    Senior Member
    Join Date
    Jan 2010
    Location
    34 France
    Posts
    3,920

    Default

    Hi,

    TRIG_OUT :
    1- pulse to next and previous function block
    2- high internal flag

    TRIG_IN :
    read pulse or internal flag
    S'il n'y a pas de solution, c'est qu'il n'y a pas de problème . (Les Shadoks)

Bookmarks

Posting Permissions

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