Translations:Modbus RTU в виде custom protocol/17/en
Материал из WebHMI Wiki
function GetDataAsTable(value, datatype)
local highWord, lowWord, tmpTable = 0, 0, {} if (datatype ~= 3) then DEBUG("getdataastable - going to process value "..value) tmpTable[1] = GetHiByte(value) ; DEBUG(tmpTable[1]) tmpTable[2] = GetLoByte(value) ; DEBUG(tmpTable[2]) else highWord = bit.rshift(value,16) lowWord = bit.band(c,0xFFFF) tmpTable[1] = GetHiByte(highWord) tmpTable[2] = GetLoByte(highWord) tmpTable[3] = GetHiByte(lowWord) tmpTable[4] = GetLoByte(lowWord) end return tmpTable
end