I am trying to convert 128-bit data to a string in a PLC, but the PLC has max. 32-bit data. I store 128-bit data as a byte array and bit array. Now I need to convert this value to a string, but the PLC does not have such a variable. I did some research, but I couldn't find the answers I wanted.
Basically I need to add the remaining numbers after multiplying their multiples in the binary system to convert a bit array to decimal. But since the number has grown so much, I can't do such a process on the PLC.
My thought is that basically the whole system is processed in binary, and it should split my 128-bit array and convert it to decimal numbers in chunks. Am I thinking wrong?
A 128-bit number has 39 characters. When you convert this number to a byte array, 16 bytes are obtained, so 16*8=128 bits. I need to expand this byte array or bit array to 39 characters again, and I have to do this without using 64-bit or 128-bit variables. I can use max. 32-bit variables.
Does anyone have any information or ideas on the subject?
I haven't had time to try the methods, but the threads may be useful for other friends.
@benmiller >> https://stackoverflow.com/questions/57845464/fastest-algorithm-to-convert-hexadecimal-numbers-into-decimal-form-without-using
@davetweed >> https://en.wikipedia.org/wiki/Double_dabble
https://en.wikipedia.org/wiki/Base64
https://en.wikipedia.org/wiki/Ascii85
@greybeard >> "chunk-wise two-step"
Thank you for your support. special thanks:@benmiller , @davetweed , @greybeard