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.

Hex manipulation
#6
I've tried and this is not the same when I will send to RS485:
Code:
string.char(0x7F,0xF2,0xFA,0xB8,0x43,0xFA,0x00,0x00,0x00,0xFE,0xFD,0x06,0x5B)

and
Code:
'7FF2FAB843FA000000FEFD065B'

Only first way works good second not.

This is my task:
I am preparing:
1) sending commands to somfy rts transmitter without feedback(and it works nice),
2) sending commands to somfy with a feedback message. (to do)

This is a function prepared on this forum:

Code:
function sendSOMFY(command)
  require('serial')
  port = serial.open('/dev/RS485', { baudrate = 4800, parity = 'odd', duplex = 'half', databits = 8, stopbits = 1 })
  port:flush()
  port:write(command)
  port:close()
  sleep(0.1)
end

I must prepare also reading data after sending command GET. But I don't know how many chars will be sended. I've tried this:

Code:
function send_receiveSOMFY(command)
  require('serial')
  port = serial.open('/dev/RS485', { baudrate = 4800, parity = 'odd', duplex = 'half', databits = 8, stopbits = 1 })
  port:flush()
  port:write(command)
  data = port:read(20, 1)
  port:close()
  sleep(0.1)
end



And also in this function is some problem. But this is second thing. When I receive a data from device I must:
1. Delete last 2 bytes which are the checksum.
2. Inverse all bytes.
Reply


Messages In This Thread
Hex manipulation - by buuuudzik - 18.09.2016, 14:35
RE: Hex manipulation - by Erwin van der Zwart - 18.09.2016, 21:31
RE: Hex manipulation - by buuuudzik - 19.09.2016, 12:12
RE: Hex manipulation - by Erwin van der Zwart - 19.09.2016, 12:42
RE: Hex manipulation - by admin - 19.09.2016, 12:44
RE: Hex manipulation - by buuuudzik - 19.09.2016, 13:36
RE: Hex manipulation - by Erwin van der Zwart - 19.09.2016, 15:04
RE: Hex manipulation - by admin - 19.09.2016, 15:07
RE: Hex manipulation - by buuuudzik - 19.09.2016, 16:15

Forum Jump: