I am trying to create tag showing abbreviation of products names. Let’s say, on the HMI I type “AAAA” (it is ASCII object). In this case the tag displays decimal values of 71 748 523 458 560, which is 10000010100000101000001010000010000000000000000 in its binary equivalent. Since “A” has ASCII value 65 (1000001), it is clear that the binary figure above presents 4 times “A” (at the end of every 1000001 a zero is added to complete 1 byte). Theoretically, at first the decimal value must be converted to binary, then convert to string and using split and shift functions the first 4 binary values must be separated, then using chr function to be converted to ASCII symbol. Then, all 4 letters must be concatenated. Is that correct, or there is much quicker and elegant way to do that?
Each modbus register is 16 bits–two ascii characters. And there’s an addressing type to do this conversion for you across multiple registers:
Thank you very much, pturmel! It worked from the first trial, using HRSn:m.