Mr. Rusian,
Thank you for your reply. Appreciate it very much. If not using 'while' can I use 'for'?
To clarify further, from CANbus to modbus rtu the converter is sending decimal of short (16 bits) to TeslaScada. Therefore I need to convert the integer to 16 bits binary. Meaning from the integer values after converting to binary, each bit represent an alarm.
bit 1 = overvoltage alarm
bit 2 = undervoltage alarm
bit 3 = overfrequency alarm and this continue to bit 16.
In other words, I need to read each bit of the 16 bit binary and activate its respective alarm if it is '1'. In this case I am expecting the values of Y is in 16 bit binary (00000000 00000000 without alarm) and if there is alarm on bit 4 then the value will be 00000000 00000100.
The normal Tag properties cannot be use for 16 bit binary as I have tried. I need to convert the modbus short into binary (16 bit).
How do I write the script for readbit on bit 1, bit 2, bit 3 and so on?
Regards,