# Read/Write variable from PLC

**URL:** <https://tech-community.robotics.abb.com/t/read-write-variable-from-plc/6102>\
**Category:** Robot Controller\
**Created:** [May 1, 2014, 5:01pm UTC](https://tech-community.robotics.abb.com/t/read-write-variable-from-plc/6102 "2014-05-01T17:01:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Casius](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@Casius](https://tech-community.robotics.abb.com/u/Casius)\
**Post date:** [May 1, 2014, 5:01pm UTC](https://tech-community.robotics.abb.com/t/read-write-variable-from-plc/6102/1 "2014-05-01T17:01:24Z")

</div>

Hello,  
It’s possible to read a numeric variable (integer) from Rapid using a PLC Siemens? And to send from PLC back to Rapid. I have IRC5 controller.  
Thank you!

---

<div class="post-metadata">

**Author:** ![bwinter714](https://avatars.discourse-cdn.com/v4/letter/b/7993a0/32.png) [@bwinter714](https://tech-community.robotics.abb.com/u/bwinter714)\
**Post date:** [May 2, 2014, 8:03pm UTC](https://tech-community.robotics.abb.com/t/read-write-variable-from-plc/6102/2 "2014-05-02T20:03:54Z")

</div>

Hi, if it is just an integer, I have found that mapping the integer required (both In and Out) to a group input/output on the robot-side works just fine for me. I do this all the time, albeit it is an Allen-Bradley PLC communicating over Ethernet IP, but it’s 6 of one, half-dozen of the other! You should be able to get that to work no problem.

Simple Syntax:

VAR dnum dnIntegerRequired;  
dnIntegerRequired := GInputDnum(gi\_IntegerFromPLCyouWant);  
SetGO SignalGOToPLC, DnumToNum(dnIntegerYouWantToPass);

-Brian

---

<div class="post-metadata">

**Author:** ![Casius](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@Casius](https://tech-community.robotics.abb.com/u/Casius)\
**Post date:** [May 5, 2014, 8:00pm UTC](https://tech-community.robotics.abb.com/t/read-write-variable-from-plc/6102/3 "2014-05-05T20:00:41Z")

</div>

Hello,  
Thank you Brian, this is a helpfully. I did like this and is working.
