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.

ESPA 4.4.4
#2
Here's a short example script that can be used to poll slave nr 2. It does not send ack/nack and does not parse the message but can be used a starting point to check the communication. Change serial port name and parameters as needed.
Code:
123456789101112131415161718192021222324252627282930
EOT = string.char(4) ENQ = string.char(5) function poll(addr)   port:flush()   port:write(addr .. ENQ)   local buf = {}   while true do     local ch, err = port:read(1, 1)     if ch then       if ch == EOT then         break       else         buf[ #buf + 1 ] = ch       end     else       return nil, err     end   end   return table.concat(buf) end port = require('serial').open('/dev/RS232', { baudrate = 9600 }) res, err = poll(2) loghex(res, err)
Reply


Messages In This Thread
ESPA 4.4.4 - by MarcusH - 28.02.2020, 09:51
RE: ESPA 4.4.4 - by admin - 02.03.2020, 16:00

Forum Jump: