How to program COM connection

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

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

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

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 …)

Hi Per Svensson,

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

Regards,

Zack