Logic Machine Forum
ESPA 4.4.4 - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: ESPA 4.4.4 (/showthread.php?tid=2491)



ESPA 4.4.4 - MarcusH - 28.02.2020

Hi

Im wondering if the LM5 supports ESPA 4.4.4 protocol, since it's a RS232/485 protocol.
https://en.bxo.se/ESPA+4+4+4.html

with some quick searches on the forum i can't seem to find any old posts with this question.


RE: ESPA 4.4.4 - admin - 02.03.2020

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:
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)