switching on and off digital output depending on logic of 2 digital inputs

  • I need to switch a digital output on or off depending on the logic of a couple of input signals.


    for example:


    if DI1 and DI2 are both on, DO1 should be set and if DI1 is off, DO1 should be reset. (for the reset of DO1 the state of DI2 does not matter)


    I hope someone can send me a little example on how to make this work.



    thanks for your help.

  • There is a soft PLC function in the controller that can do what you want to do. Once again, look inte the systems manual. Maybe this function is a option or not avalible on older systems.


    You can also set up a backgroud task that connects the IO:s, but then you need the multitasking option.

  • Ztek,


    thanks for your reply.


    I don't think my robot has these options.


    It is also oke if the inputs and outputs are handled every cycle of the program.


    Can you explain to me how that is done?


    thanks

  • Probably your best options are:


    1. Use interrupts to detect any input value change. Once you are inside the interrupt handler check both signals and react in consequence.


    2. Use your plc (if any) to do this output logic.


    Hope this helps!


    Sent from my BlackBerry 9300 using Tapatalk

  • I'm far away from the computer and I don't have any code now to check it... But I would use connect (I think it was the way to start an interruption) to check the state of one of those digital inputs. You should use that interrupt (which at the end is a function that gets executed as if it was multitask) to check the states of those inputs and activate the outputs accordingly...


    Sorry not to be able to give you a better answer but from the phone and without manuals or old code to check... :frowning_face:


    Sent from my BlackBerry 9300 using Tapatalk

Advertising from our partners