# IO problem

**URL:** <https://tech-community.robotics.abb.com/t/io-problem/4166>\
**Category:** Robot Controller\
**Created:** [May 10, 2011, 2:39am UTC](https://tech-community.robotics.abb.com/t/io-problem/4166 "2011-05-10T02:39:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![djperala](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@djperala](https://tech-community.robotics.abb.com/u/djperala)\
**Post date:** [May 10, 2011, 2:39am UTC](https://tech-community.robotics.abb.com/t/io-problem/4166/1 "2011-05-10T02:39:51Z")

</div>

hello

i am trying to write a quick bit of RAPID.  
i have do1, do2 and do3.

depending on the state of all three i have 8 options.  
do1, do2, do3 off  
do1 on do2 do3 off  
so on so on

does anyone know how to write if statements testing the value of an IO signal?

please any code would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![osku](https://avatars.discourse-cdn.com/v4/letter/o/dfb087/32.png) [@osku](https://tech-community.robotics.abb.com/u/osku)\
**Post date:** [May 10, 2011, 7:43am UTC](https://tech-community.robotics.abb.com/t/io-problem/4166/2 "2011-05-10T07:43:08Z")

</div>

Hi

You can use for example IF-statement. For inputs you can use it like this:

IF di1=1 THEN  
!This will be executed if the signal value is 1  
ENDIF

For output testing you need to use DOutput-function, like this:

IF DOutput(do1)=1 THEN  
!This will be executed if the signal value is 1  
ENDIF

When you wrote about different states of the three output, you might be also interested to find out about group signals. You can define your three digital output signals as one group output and that way you can simplify your RAPID code. Then you can use instruction SetGO to set value for the group output. This way you don’t have to manually set or reset all the digital signals. For example like this:

SetGO go1, 5;

-Osku

---

<div class="post-metadata">

**Author:** ![djperala](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@djperala](https://tech-community.robotics.abb.com/u/djperala)\
**Post date:** [June 9, 2011, 9:55am UTC](https://tech-community.robotics.abb.com/t/io-problem/4166/3 "2011-06-09T09:55:35Z")

</div>

thank you for the help.worked perfectly
