Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mihini-dev] problem on modbus

Hi,

I am trying to get data via modbus on mihini.

This is the program upload into Arduino:

This is the program running in the mihini:

local sched  = require 'sched'
local modbus = require 'modbus'

local MODBUS_PORT = "/dev/ttyACM0" -- serial port on RaspPi
local MODBUS_CONF = {baudRate = 9600 }

local LOG_NAME = "MODBUS_APP"

local function main()
  log.setlevel("INFO")
log(LOG_NAME, "INFO", "Application started")
modbus_client = modbus.new(MODBUS_PORT, MODBUS_CONF)
log(LOG_NAME, "INFO", "Modbus      - OK")
while true do
local values = modbus_client:readHoldingRegisters(1,0,9)
print(values)
sched.wait(5)
end
  
end

sched.run(main)
sched.loop()


When I run this lua program, this is the output:

Tue Apr 23 15:37:02 2013 MODBUS_APP-INFO: Application started
Tue Apr 23 15:37:02 2013 MODBUS_APP-INFO: Modbus      - OK
nil
nil
nil
nil
nil
nil
nil
nil
nil
nil
Tue Apr 23 15:38:03 2013 MODBUS-WARNING: Failure while processing a request: timeout



Can anyone give me some idea?

Best Reagrds
Yong-Jie



Attachment: p1.png
Description: Binary data

Attachment: p2.png
Description: Binary data


Back to the top