Forum Home Forum Home > General > General Discussion
  New Posts New Posts
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

How to program COM connection

 Post Reply Post Reply
Author
Message
  Topic Search Topic Search  Topic Options Topic Options
zli View Drop Down
Newbie
Newbie


Joined: 2010-February-08
Online Status: Offline
Posts: 3
  Quote zli Quote  Post ReplyReply Direct Link To This Post Topic: How to program COM connection
    Posted: 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
Back to Top
PerSvensson View Drop Down
Pickmaster members
Pickmaster members
Avatar

Joined: 2007-January-08
Location: Sweden
Online Status: Offline
Posts: 282
  Quote PerSvensson Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zli View Drop Down
Newbie
Newbie


Joined: 2010-February-08
Online Status: Offline
Posts: 3
  Quote zli Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
PerSvensson View Drop Down
Pickmaster members
Pickmaster members
Avatar

Joined: 2007-January-08
Location: Sweden
Online Status: Offline
Posts: 282
  Quote PerSvensson Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zli View Drop Down
Newbie
Newbie


Joined: 2010-February-08
Online Status: Offline
Posts: 3
  Quote zli Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.53
Copyright ©2001-2008 Web Wiz