# How to program COM connection

**URL:** <https://tech-community.robotics.abb.com/t/how-to-program-com-connection/3342>\
**Category:** Robot Controller\
**Created:** [February 8, 2010, 9:33pm UTC](https://tech-community.robotics.abb.com/t/how-to-program-com-connection/3342 "2010-02-08T21:33:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zli](https://avatars.discourse-cdn.com/v4/letter/z/7c8e57/32.png) [@zli](https://tech-community.robotics.abb.com/u/zli)\
**Post date:** [February 8, 2010, 9:33pm UTC](https://tech-community.robotics.abb.com/t/how-to-program-com-connection/3342/1 "2010-02-08T21:33:23Z")

</div>

Dear ALL,

We have a thermo sensor to be connected with robot controller through COM connection. The process is to send a command from robot to sensor, e.g "00ms ", then a value wiill be returned. However, the questions are:

1. we can’t define string as "00ms ".
2. What functions can be used for com communication. We used the code below:  
Open “com1:”, channelBin;  
Writeanybin channel, rec; rec := ReadStrBin (channel, 10);  
rec := ReadStrBin (channel, 10);  
Close channel;  
but it didn’t work to get any response from sensor.

Can you please help us with this?

Thanks

Zack

---

<div class="post-metadata">

**Author:** ![PerSvensson](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/persvensson/32/1040_2.png) [@PerSvensson](https://tech-community.robotics.abb.com/u/PerSvensson)\
**Post date:** [February 9, 2010, 8:26am UTC](https://tech-community.robotics.abb.com/t/how-to-program-com-connection/3342/2 "2010-02-09T08:26:03Z")

</div>

Hi  
Here is what I usally do

Open “Com1:”, equipmentBin;  
ClearIOBuff equipment;  
WriteStrBin equipment,command;  
stReadValue:=ReadStrBin(equipment,Characters,Time:=WaitT);

haven’t added the declarations of the variables but I guess you will understand anyway

Also do your sensor need CR/LF ? in that case I also would add “DA” to the send string

---

<div class="post-metadata">

**Author:** ![zli](https://avatars.discourse-cdn.com/v4/letter/z/7c8e57/32.png) [@zli](https://tech-community.robotics.abb.com/u/zli)\
**Post date:** [February 9, 2010, 6:12pm UTC](https://tech-community.robotics.abb.com/t/how-to-program-com-connection/3342/3 "2010-02-09T18:12:32Z")

</div>

Hi Per Svensson,

Thanks for reply.  
My sensor needs CR. I put command as “00msD”, and use your code. Still no response.  
I connected sensor with PC. Program with c# to test sensor. Everything works fine to get data from sensor. I am confused about rapid code. How can I check what is wrong.

Regards,

Zack

---

<div class="post-metadata">

**Author:** ![PerSvensson](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/persvensson/32/1040_2.png) [@PerSvensson](https://tech-community.robotics.abb.com/u/PerSvensson)\
**Post date:** [February 9, 2010, 6:29pm UTC](https://tech-community.robotics.abb.com/t/how-to-program-com-connection/3342/4 "2010-02-09T18:29:17Z")

</div>

What you can do is to connect your PC to the robot controller to see if you get anything from the controller when you execute the robot program.

Could be

- Communications settings (but I guess you have check thoose a couple of times allready)
- Cable wiring (RTS,CTS …)

---

<div class="post-metadata">

**Author:** ![zli](https://avatars.discourse-cdn.com/v4/letter/z/7c8e57/32.png) [@zli](https://tech-community.robotics.abb.com/u/zli)\
**Post date:** [February 10, 2010, 3:33pm UTC](https://tech-community.robotics.abb.com/t/how-to-program-com-connection/3342/5 "2010-02-10T15:33:28Z")

</div>

Hi Per Svensson,

We got our sensor working. Cable wiring was not properly set up before. Thanks for your help.

Regards,

Zack
