TSopkow (Customer) asked a question.

Converting a HEX value to a string

I have a device that I am controlling and there is a command to set the light intensity. The command is made up of two parts, &I#, where "&I" is a string and # is a 2-digit hexadecimal value. I have a integer register that is used for the Intensity value. I am able to convert the integer value to a Hex using the Copy Data function and copy the Intensity Value to a 8-bit unsigned register. Now I need to concatenate the "&I" and hex value to create a command that looks like this "&I64", which is an intensity value of 100.

 

Is there a way to do this?


  • ADC Community_02 (Automationdirect.com)

    You can use a Pack String (PKS) instruction to concatenate the two values together into one string.

    pksladder

  • TSopkow (Customer)

    Ok, Thanks for the help. However is is possible to use a 3-digit hexadecimal value as the hex value in the pack string?