RobotStudio event

Sending string to a PLC

Options
Goodmorning,
I'm working on a sort of application in witch i need to send to a PLC a string via Profinet that contain a serial number. For now the string is something similar to this one: "SN12345|123" but in the future it could change format.

My doubt is: how can i convert the single char of my string into bytes? So i can send it with the command "SetGO"? Cause the command StrToByte don't work.

For example:
I would like to have something like this:

 sendString:= "SN12345|123";
 SETGO SendByte0, StrToByte(sendString{1});
 SETGO SendByte1, StrToByte(sendString{2});
 SETGO SendByte2, StrToByte(sendString{3});
 Ecc...

I tried also with:
 SETGO SendByte0, StrToByte(StrPart(sendString, 1, 1);
 SETGO SendByte1, StrToByte(StrPart(sendString, 2, 1);
 Ecc..

What is the correct way to do this?
Thank you all.


Comments

  • lemster68
    Options
    Did you really create another user account to ask the same question as not very long time ago?
    Lee Justice