Thanks, I like the thinking in the last post..
If you reconsider what I posted to begin with, I need to send a set of byte codes in hex to a printer, they are a command sequence. Each command has a specific sequence, followed by the data the printer has to print. The 8th byte of hex must be the length of the data in hex, which varies with each message content.
That's why I was converting the length of the message data text into hex, then trying to add that length onto the end of the existing string of command bytes (also already in hex, $EB$04$00$01$00$00$00$??), followed by the actual data.
I've written a lot of software in machine automation but not required to do a lot of PLC string handling, which is easy as pie in C# world but clunky it seems in ControlLogix world. Normally all PLC strings are alarm messages or HMI stuff, nothing difficult, until this task came along.
Here's where we came in - trying to add a 2 digit hex string on the end of the command string, but unable to CONCAT the string with a 8th '$' and the hex value of the length.
I assumed it was clear what I was trying to do, and the previous solution was going to handle hex as a string to BCD but of course I now realise it doesn't when the hex contains non numeric chars - which of course hex does.
I have tried every possible method of creating a string char in a SINT array, of the correct value in hex and preceded by a $ sign but jeez it is not letting me do any of it. This is why I turned to asking on here to see if anyone had a better idea how to make that seemingly simple task work.
Thanks, sorry for the long winded post.
If you reconsider what I posted to begin with, I need to send a set of byte codes in hex to a printer, they are a command sequence. Each command has a specific sequence, followed by the data the printer has to print. The 8th byte of hex must be the length of the data in hex, which varies with each message content.
That's why I was converting the length of the message data text into hex, then trying to add that length onto the end of the existing string of command bytes (also already in hex, $EB$04$00$01$00$00$00$??), followed by the actual data.
I've written a lot of software in machine automation but not required to do a lot of PLC string handling, which is easy as pie in C# world but clunky it seems in ControlLogix world. Normally all PLC strings are alarm messages or HMI stuff, nothing difficult, until this task came along.
Here's where we came in - trying to add a 2 digit hex string on the end of the command string, but unable to CONCAT the string with a 8th '$' and the hex value of the length.
I assumed it was clear what I was trying to do, and the previous solution was going to handle hex as a string to BCD but of course I now realise it doesn't when the hex contains non numeric chars - which of course hex does.
I have tried every possible method of creating a string char in a SINT array, of the correct value in hex and preceded by a $ sign but jeez it is not letting me do any of it. This is why I turned to asking on here to see if anyone had a better idea how to make that seemingly simple task work.
Thanks, sorry for the long winded post.