How to program COM connection |
Post Reply
|
| Author | |
zli
Newbie
Joined: 2010-February-08 Online Status: Offline Posts: 3 |
Quote Reply
Topic: How to program COM connectionPosted: 2010-February-08 at 21:33 |
|
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\r", then a value wiill be returned. However, the questions are:
1. we can't define string as "00ms\r".
2. What functions can be used for com communication. We used the code below:
Open "com1:", channel\Bin;
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
|
|
![]() |
|
PerSvensson
Pickmaster members
Joined: 2007-January-08 Location: Sweden Online Status: Offline Posts: 282 |
Quote Reply
Posted: 2010-February-09 at 08:26 |
|
Hi
Here is what I usally do
Open "Com1:", equipment\Bin;
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 "\0D\0A" to the send string
|
|
|
Per Svensson
Robotics and Vision Specialist Consat Engineering |
|
![]() |
|
zli
Newbie
Joined: 2010-February-08 Online Status: Offline Posts: 3 |
Quote Reply
Posted: 2010-February-09 at 18:12 |
|
Hi Per Svensson,
Thanks for reply.
My sensor needs CR. I put command as "00ms\0D", 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
|
|
![]() |
|
PerSvensson
Pickmaster members
Joined: 2007-January-08 Location: Sweden Online Status: Offline Posts: 282 |
Quote Reply
Posted: 2010-February-09 at 18:29 |
|
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 ....)
|
|
|
Per Svensson
Robotics and Vision Specialist Consat Engineering |
|
![]() |
|
zli
Newbie
Joined: 2010-February-08 Online Status: Offline Posts: 3 |
Quote Reply
Posted: 2010-February-10 at 15:33 |
|
Hi Per Svensson, We got our sensor working. Cable wiring was not properly set up before. Thanks for your help.
Regards,
Zack
|
|
![]() |
|
Post Reply
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |