This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Error in script
#5
(10.09.2025, 11:48)Daniel Wrote: Where did you get this function from? crc16(data)

sorry i forget to attached a part...... here for you 
Code:
--funzione calcolo CRC16 function crc16(data)   log('valore passato = ',data)   local crc = 0xFFFF for i = 1, #data do     crc = bit.bxor(crc, data:byte(i))     for j = 1, 8 do       local k = bit.band(crc, 1)       crc = bit.rshift(crc, 1)       if k ~= 0 then         crc = bit.bxor(crc, 0x8408)         end       end     end     --return bit.bxor(crc, 0xFFFF)   result = string.format("%04X",bit.bxor(crc, 0xFFFF))   result_low = string.sub(result, 3 , 4)   result_high = string.sub(result, 1 , 2)   crc_calc = (',0x'..result_low..',0x'..result_high)   return crc_calc end
Reply


Messages In This Thread
Error in script - by CristianAgata - 10.09.2025, 11:13
RE: Error in script - by hocine - 10.09.2025, 11:27
RE: Error in script - by CristianAgata - 10.09.2025, 11:34
RE: Error in script - by Daniel - 10.09.2025, 11:48
RE: Error in script - by CristianAgata - 10.09.2025, 12:00
RE: Error in script - by Daniel - 10.09.2025, 13:32
RE: Error in script - by CristianAgata - 10.09.2025, 15:22

Forum Jump: