09-15-2010 06:10 AM
Hi there,
I am trying to send a hex string to my Profibus card. The string represents a serial number that I read from a file serial.txt. The number has 9 digits which i convert to hexadecimal string.
To be able to write to the Profibus device I need to send a command first to let the network know that I am sending the MSB and so on.
Example:
If I want to write serial umber 111111111 to Profibus I need to follow the following procedure:
Convert d111111111 - 0x69F6BC7
To send the MSB in this case 06 I need to send the following hex sting
1306 0000 0000 0000 for the MSB
149F 0000 0000 0000 for the MSB - 1
156B 0000 0000 0000 for the MSB -2
16C7 0000 0000 0000 for the LSB
As a procedure I convert the number to a hex integer and then I use the string subset function to select the first byte and then concatenate the string with the write command 0x13. But the function string subset outputs ascii string. How can I subset and then concatenate an hex string?
Please see the attachment.
Solved! Go to Solution.
09-15-2010 06:21 AM
09-15-2010 07:43 AM
Hi GerdW,
Very kind of you to replay so quick, thank you.
I have implemented your suggested method and I am very impressed works fine for sending the hex stings.
I have selected the first element of the 1D array of string and try to send it to my Master Profibus function but creates a conflict.
As you see in the diagram the cluster sent to the Master vi has the slave address which always will be 1 so I can hard wire a constant plus the hex string of 1306 for example.
How can I convert the 1D string array to the unsigned byte array ?
Thanks again for your time please see the attachment.
Kind Regards
Marken
09-15-2010 07:43 AM
Hi GerdW,
Very kind of you to replay so quick, thank you.
I have implemented your suggested method and I am very impressed works fine for sending the hex stings.
I have selected the first element of the 1D array of string and try to send it to my Master Profibus function but creates a conflict.
As you see in the diagram the cluster sent to the Master vi has the slave address which always will be 1 so I can hard wire a constant plus the hex string of 1306 for example.
How can I convert the 1D string array to the unsigned byte array ?
Thanks again for your time please see the attachment.
Kind Regards
Marken
09-15-2010 07:46 AM