Aprus 适配器 Lua 示范

Aprus 适配器终端的 Lua 程序有两个,分别是主运行程序 aprus.lua 和配置程序 config.lua。

这两个程序的语法规则,适合所有类型的适配器终端。

aprus.lua 示范程序

package.cpath="./?.so"
package.path="./?.lua"
cjson = require "cjson"
config = require "config"

function act_control(m, json)

    for k,v in pairs(json) do
        if k ~= "Act" then
            modbus.write(mb1, k, v)
        end
    end
end

function mqttdata_handle(m, topic, data)

    local json = cjson.decode(data)

    if json.Act == "Control" then
        act_control(m, json)
    end    
end

function mqttsys_handle(m, code)

    if code == 0 then
        modbus.stop(mb1)
    elseif code == 1 then
        modbus.run(mb1)
    end    
end


function modbusevent_handle(session, code, style_L, val_L, style_E, val_E, z)

    if code == 15 then
        local json = cjson.encode(mbbuf[session])
        mqtt.publish(m1, mbstr[session], "r", json)    
        mbbuf[session] = {}        
    elseif code > 10 then
        mbbuf[session][style_L] = val_L
        mbbuf[session][style_E] = val_E        
    else 
        local json = cjson.encode({[style_L] = val_L, [style_E] = val_E, ["Z"] = z})
        mqtt.publish(m1, mbstr[session], "r", json)        
    end
end


function modbus_load_collectnodes(session, nodes)

    for k,v in pairs(nodes)
    do
        modbus.add_collectnode(session, v.ID, v.reg, v.addr, v.cnt, v.delay)
    end    
end

function modbus_load_varnodes(session, nodes)

    for k,v in pairs(nodes)
    do
        modbus.add_varnode(session, v.ID, v.reg, v.addr, v.dtype, v.dBit, v.format, v.len, v.pMode, v.dStyle, v.dOffset, v.dExt)
    end    
end

function init()

    m1 = mqtt.new() 

    user.setluaver(config.AprusX.luaver)
    user.setdevinfo(config.AprusX.devinfo)
    user.ipconfig(config.AprusX.ipmode, config.AprusX.inet_addr, config.AprusX.netmask)

--    user.reset_eth0()    --if you want to set eth0  use this interface
--    user.ipconfig_eth0("manual", "10.100.1.123", "255.255.255.0", "10.100.1.1", "114.114.114.114")

end

function start()

    init()

----------ModbusRtu Config----------
    MBCfg = config.Modbus

--Init Object
    mb1 = nil
    mbbuf = { mb1 }
    mbstr = { mb1 }

--Config Object
    mb1 = modbus.new(MBCfg.device.type)
    mbbuf[mb1] = {}
    mbstr[mb1] = "mb1"
--    modbus.select_rs485(mb1, "2")    --you can select "1" or "2", default is "1"
    modbus.config(mb1, MBCfg.device.rate, MBCfg.device.databit, MBCfg.device.stopbit, MBCfg.device.parity)
    modbus_load_collectnodes(mb1, MBCfg.node.collect)
    modbus_load_varnodes(mb1, MBCfg.node.variable)
----------------------------------

    mqtt.run(m1)

    while true do
        local r = user.waitmsg()

        if r.from == "mqtt-sys" then
            mqttsys_handle(r.session, r.code)

        elseif r.from == "mqtt-msg" then
            mqttdata_handle(r.session, r.topic, r.payload)

        elseif r.from == "modbus" then
            modbusevent_handle(r.session, r.code, r.style_L, r.val_L, r.style_E, r.val_E, r.z)

        end
    end
end

start()

config.lua 示范程序

return 
{
    AprusX={
        ipmode="none",                    --auto/manual/none
        inet_addr="192.168.1.234",
        netmask="255.255.255.0",
        luaver="V00.R",
        devinfo="ModbusRtuDev",        
    },

    Modbus={
        device={
            type="rtu",        --"rtu"/"ascii"
            rate=38400,
            databit=8,
            stopbit=1,
            parity="None",        -- None/Odd/Even
        },
        node={
            collect={
                {ID=1, reg="1", addr=0, cnt=50},
                {ID=1, reg="2", addr=0, cnt=50},
                {ID=1, reg="3", addr=0, cnt=50},
                {ID=1, reg="4", addr=0, cnt=50},
            },
            variable={
                {ID=1,reg="1",addr=0,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_1_0"}},
                {ID=1,reg="1",addr=1,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_1_1"}},
                {ID=1,reg="1",addr=2,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_1_2"}},
                {ID=1,reg="1",addr=3,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_1_3"}},
                {ID=1,reg="1",addr=4,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_1_4"}},
                {ID=1,reg="1",addr=5,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_1_5"}},
                {ID=1,reg="1",addr=6,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_1_6"}},
                {ID=1,reg="1",addr=7,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_1_7"}},
                {ID=1,reg="1",addr=8,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_1_8"}},
                {ID=1,reg="1",addr=9,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_1_9"}},
                {ID=1,reg="1",addr=10,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_1_10"}},
                {ID=1,reg="1",addr=11,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_1_11"}},
                {ID=1,reg="1",addr=12,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_1_12"}},

                {ID=1,reg="1",addr=12,dtype="bit",dBit=0,pMode={2,0},dStyle={"L1_1_12_C"}},

                {ID=1,reg="2",addr=0,dtype="bit",dBit=0,pMode={1,6},dStyle={"L1_2_0"}},
                {ID=1,reg="2",addr=1,dtype="bit",dBit=0,pMode={1,6},dStyle={"L1_2_1"}},
                {ID=1,reg="2",addr=2,dtype="bit",dBit=0,pMode={1,6},dStyle={"L1_2_2"}},
                {ID=1,reg="2",addr=3,dtype="bit",dBit=0,pMode={1,6},dStyle={"L1_2_3"}},
                {ID=1,reg="2",addr=4,dtype="bit",dBit=0,pMode={1,6},dStyle={"L1_2_4"}},
                {ID=1,reg="2",addr=5,dtype="bit",dBit=0,pMode={1,6},dStyle={"L1_2_5"}},
                {ID=1,reg="2",addr=6,dtype="bit",dBit=0,pMode={1,6},dStyle={"L1_2_6"}},
                {ID=1,reg="2",addr=7,dtype="bit",dBit=0,pMode={1,6},dStyle={"L1_2_7"}},
                {ID=1,reg="2",addr=8,dtype="bit",dBit=0,pMode={1,6},dStyle={"L1_2_8"}},
                {ID=1,reg="2",addr=9,dtype="bit",dBit=0,pMode={1,6},dStyle={"L1_2_9"}},
                {ID=1,reg="2",addr=10,dtype="bit",dBit=0,pMode={1,6},dStyle={"L1_2_10"}},
                {ID=1,reg="2",addr=11,dtype="bit",dBit=0,pMode={1,6},dStyle={"L1_2_11"}},
                {ID=1,reg="2",addr=12,dtype="bit",dBit=0,pMode={1,6},dStyle={"L1_2_12"}},

                {ID=1,reg="2",addr=12,dtype="bit",dBit=0,pMode={2,0},dStyle={"L1_2_12_C"}},


                {ID=1,reg="3",addr=0,dtype="bit",dBit=0,pMode={1,7},dStyle={"L1_3_0_0"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=1,pMode={1,7},dStyle={"L1_3_0_1"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=2,pMode={1,7},dStyle={"L1_3_0_2"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=3,pMode={1,7},dStyle={"L1_3_0_3"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=4,pMode={1,7},dStyle={"L1_3_0_4"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=5,pMode={1,7},dStyle={"L1_3_0_5"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=6,pMode={1,7},dStyle={"L1_3_0_6"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=7,pMode={1,7},dStyle={"L1_3_0_7"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=8,pMode={1,7},dStyle={"L1_3_0_8"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=9,pMode={1,7},dStyle={"L1_3_0_9"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=10,pMode={1,7},dStyle={"L1_3_0_10"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=11,pMode={1,7},dStyle={"L1_3_0_11"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=12,pMode={1,7},dStyle={"L1_3_0_12"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=13,pMode={1,7},dStyle={"L1_3_0_13"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=14,pMode={1,7},dStyle={"L1_3_0_14"}},
                {ID=1,reg="3",addr=0,dtype="bit",dBit=15,pMode={1,7},dStyle={"L1_3_0_15"}},

                {ID=1,reg="3",addr=0,dtype="bit",dBit=15,pMode={2,0},dStyle={"L1_3_0_15_C"}},

                {ID=1,reg="3",addr=1,dtype="byte", dBit=0, pMode={1,8},dStyle={"L1_3_1_0"}},
                {ID=1,reg="3",addr=1,dtype="byte", dBit=1, pMode={1,8},dStyle={"L1_3_1_1"}},
                {ID=1,reg="3",addr=1,dtype="byte", dBit=1, pMode={2,0},dStyle={"L1_3_1_1_C"}},
                {ID=1,reg="3",addr=1,dtype="byte", pMode={2,0},dStyle={"L1_3_1_C"}},
                {ID=1,reg="3",addr=1,dtype="byte", pMode={1,8},dStyle={"L1_3_1_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="3",addr=1,dtype="byte", pMode={1,8},dStyle={"L1_3_1_O2"}, dOffset={{"/",3}, {"+", 10}}},

                {ID=1,reg="3",addr=2,dtype="ubyte", pMode={1,8},dStyle={"L1_3_2"}},
                {ID=1,reg="3",addr=2,dtype="ubyte", pMode={2,0},dStyle={"L1_3_2_C"}},                
                {ID=1,reg="3",addr=2,dtype="ubyte", pMode={1,8},dStyle={"L1_3_2_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="3",addr=2,dtype="ubyte", pMode={1,8},dStyle={"L1_3_2_O2"}, dOffset={{"*",2.123}, {".", 1}}},

                {ID=1,reg="3",addr=3,dtype="short", pMode={1,8},dStyle={"L1_3_3"}},
                {ID=1,reg="3",addr=3,dtype="short", pMode={2,0},dStyle={"L1_3_3_C"}},                
                {ID=1,reg="3",addr=3,dtype="short", pMode={1,8},dStyle={"L1_3_3_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="3",addr=3,dtype="short", pMode={1,8},dStyle={"L1_3_3_O2"}, dOffset={{"*",2}, {"+", 10}}},

                {ID=1,reg="3",addr=4,dtype="ushort", pMode={1,8},dStyle={"L1_3_4"}},
                {ID=1,reg="3",addr=4,dtype="ushort", pMode={2,0},dStyle={"L1_3_4_C"}},                
                {ID=1,reg="3",addr=4,dtype="ushort", pMode={1,8},dStyle={"L1_3_4_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="3",addr=4,dtype="ushort", pMode={1,8},dStyle={"L1_3_4_O2"}, dOffset={{"*",2}, {"+", 10}}},

                {ID=1,reg="3",addr=5,dtype="int", pMode={1,8},dStyle={"L1_3_5"}},
                {ID=1,reg="3",addr=5,dtype="int", format="ABCD", pMode={1,8},dStyle={"L1_3_5_ABCD"}},                
                {ID=1,reg="3",addr=5,dtype="int", pMode={2,0},dStyle={"L1_3_5_C"}},
                {ID=1,reg="3",addr=5,dtype="int", pMode={1,8},dStyle={"L1_3_5_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="3",addr=5,dtype="int", pMode={1,8},dStyle={"L1_3_5_O2"}, dOffset={{"*",2}, {"+", 10}}},

                {ID=1,reg="3",addr=7,dtype="uint", pMode={1,8},dStyle={"L1_3_7"}},
                {ID=1,reg="3",addr=7,dtype="uint", format="ABCD", pMode={1,8},dStyle={"L1_3_7_ABCD"}},                
                {ID=1,reg="3",addr=7,dtype="uint", pMode={2,0},dStyle={"L1_3_7_C"}},
                {ID=1,reg="3",addr=7,dtype="uint", pMode={1,8},dStyle={"L1_3_7_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="3",addr=7,dtype="uint", pMode={1,8},dStyle={"L1_3_7_O2"}, dOffset={{"*",2}, {"+", 10}}},

                {ID=1,reg="3",addr=9,dtype="float", pMode={1,8},dStyle={"L1_3_9"}},
                {ID=1,reg="3",addr=9,dtype="float", format="ABCD", pMode={1,8},dStyle={"L1_3_9_ABCD"}},                
                {ID=1,reg="3",addr=9,dtype="float", pMode={2,0},dStyle={"L1_3_9_C"}},
                {ID=1,reg="3",addr=9,dtype="float", pMode={1,8},dStyle={"L1_3_9_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="3",addr=9,dtype="float", pMode={1,8},dStyle={"L1_3_9_O2"}, dOffset={{"*",1.5}, {"+", 10}}},
                {ID=1,reg="3",addr=9,dtype="float", pMode={1,8},dStyle={"L1_3_9_O3"}, dOffset={{"*",1.125}, {".", 0}}},
                {ID=1,reg="3",addr=9,dtype="float", pMode={1,8},dStyle={"L1_3_9_O4"}, dOffset={{"*",1.125}, {".", 1}}},
                {ID=1,reg="3",addr=9,dtype="float", pMode={1,8},dStyle={"L1_3_9_O5"}, dOffset={{"*",1.125}, {".", 2}}},                
                {ID=1,reg="3",addr=9,dtype="float", pMode={1,8},dStyle={"L1_3_9_O6"}, dOffset={{"*",1.125}, {".", 3}}},
                {ID=1,reg="3",addr=9,dtype="float", pMode={1,8},dStyle={"L1_3_9_O7"}, dOffset={{".",3}}},

                {ID=1,reg="3",addr=11,dtype="bytes", len=20, pMode={1,8},dStyle={"L1_3_11"}},
                {ID=1,reg="3",addr=11,dtype="bytes", len=20, pMode={2,0},dStyle={"L1_3_11_C"}},                

                {ID=1,reg="4",addr=0,dtype="bit",dBit=0,pMode={1,9},dStyle={"L1_4_0_0"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=1,pMode={1,9},dStyle={"L1_4_0_1"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=2,pMode={1,9},dStyle={"L1_4_0_2"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=3,pMode={1,9},dStyle={"L1_4_0_3"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=4,pMode={1,9},dStyle={"L1_4_0_4"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=5,pMode={1,9},dStyle={"L1_4_0_5"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=6,pMode={1,9},dStyle={"L1_4_0_6"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=7,pMode={1,9},dStyle={"L1_4_0_7"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=8,pMode={1,9},dStyle={"L1_4_0_8"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=9,pMode={1,9},dStyle={"L1_4_0_9"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=10,pMode={1,9},dStyle={"L1_4_0_10"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=11,pMode={1,9},dStyle={"L1_4_0_11"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=12,pMode={1,9},dStyle={"L1_4_0_12"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=13,pMode={1,9},dStyle={"L1_4_0_13"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=14,pMode={1,9},dStyle={"L1_4_0_14"}},
                {ID=1,reg="4",addr=0,dtype="bit",dBit=15,pMode={1,9},dStyle={"L1_4_0_15"}},

                {ID=1,reg="4",addr=0,dtype="bit",dBit=15,pMode={2,0},dStyle={"L1_4_0_15"}},

                {ID=1,reg="4",addr=1,dtype="byte", pMode={1,8},dStyle={"L1_4_1"}},
                {ID=1,reg="4",addr=1,dtype="byte", pMode={2,0},dStyle={"L1_4_1_C"}},
                {ID=1,reg="4",addr=1,dtype="byte", pMode={1,8},dStyle={"L1_4_1_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="4",addr=1,dtype="byte", pMode={1,8},dStyle={"L1_4_1_O2"}, dOffset={{"*",2}, {"+", 10}}},

                {ID=1,reg="4",addr=2,dtype="ubyte", pMode={1,8},dStyle={"L1_4_2"}},
                {ID=1,reg="4",addr=2,dtype="ubyte", pMode={2,0},dStyle={"L1_4_2_C"}},                
                {ID=1,reg="4",addr=2,dtype="ubyte", pMode={1,8},dStyle={"L1_4_2_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="4",addr=2,dtype="ubyte", pMode={1,8},dStyle={"L1_4_2_O2"}, dOffset={{"*",2}, {"+", 10}}},

                {ID=1,reg="4",addr=3,dtype="short", pMode={1,8},dStyle={"L1_4_3"}},
                {ID=1,reg="4",addr=3,dtype="short", pMode={2,0},dStyle={"L1_4_3_C"}},                
                {ID=1,reg="4",addr=3,dtype="short", pMode={1,8},dStyle={"L1_4_3_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="4",addr=3,dtype="short", pMode={1,8},dStyle={"L1_4_3_O2"}, dOffset={{"*",2}, {"+", 10}}},

                {ID=1,reg="4",addr=4,dtype="ushort", pMode={1,8},dStyle={"L1_4_4"}},
                {ID=1,reg="4",addr=4,dtype="ushort", pMode={2,0},dStyle={"L1_4_4_C"}},                
                {ID=1,reg="4",addr=4,dtype="ushort", pMode={1,8},dStyle={"L1_4_4_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="4",addr=4,dtype="ushort", pMode={1,8},dStyle={"L1_4_4_O2"}, dOffset={{"*",2}, {"+", 10}}},

                {ID=1,reg="4",addr=5,dtype="int", pMode={1,8},dStyle={"L1_4_5"}},
                {ID=1,reg="4",addr=5,dtype="int", format="ABCD", pMode={1,8},dStyle={"L1_4_5_ABCD"}},                
                {ID=1,reg="4",addr=5,dtype="int", pMode={2,0},dStyle={"L1_4_5_C"}},
                {ID=1,reg="4",addr=5,dtype="int", pMode={1,8},dStyle={"L1_4_5_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="4",addr=5,dtype="int", pMode={1,8},dStyle={"L1_4_5_O2"}, dOffset={{"*",2}, {"+", 10}}},

                {ID=1,reg="4",addr=7,dtype="uint", pMode={1,8},dStyle={"L1_4_7"}},
                {ID=1,reg="4",addr=7,dtype="uint", format="ABCD", pMode={1,8},dStyle={"L1_3_7_ABCD"}},                
                {ID=1,reg="4",addr=7,dtype="uint", pMode={2,0},dStyle={"L1_4_7_C"}},
                {ID=1,reg="4",addr=7,dtype="uint", pMode={1,8},dStyle={"L1_4_7_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="4",addr=7,dtype="uint", pMode={1,8},dStyle={"L1_4_7_O2"}, dOffset={{"*",2}, {"+", 10}}},

                {ID=1,reg="4",addr=9,dtype="float", pMode={1,8},dStyle={"L1_4_9"}},
                {ID=1,reg="4",addr=9,dtype="float", format="ABCD", pMode={1,8},dStyle={"L1_4_9_ABCD"}},                
                {ID=1,reg="4",addr=9,dtype="float", pMode={2,0},dStyle={"L1_4_9_C"}},
                {ID=1,reg="4",addr=9,dtype="float", pMode={1,8},dStyle={"L1_4_9_O1"}, dOffset={{"+",10}}},
                {ID=1,reg="4",addr=9,dtype="float", pMode={1,8},dStyle={"L1_4_9_O2"}, dOffset={{"*",1.5}, {"+", 10}}},
                {ID=1,reg="4",addr=9,dtype="float", pMode={1,8},dStyle={"L1_4_9_O3"}, dOffset={{"*",1.125}, {".", 0}}},
                {ID=1,reg="4",addr=9,dtype="float", pMode={1,8},dStyle={"L1_4_9_O4"}, dOffset={{"*",1.125}, {".", 1}}},
                {ID=1,reg="4",addr=9,dtype="float", pMode={1,8},dStyle={"L1_4_9_O5"}, dOffset={{"*",1.125}, {".", 2}}},                
                {ID=1,reg="4",addr=9,dtype="float", pMode={1,8},dStyle={"L1_4_9_O6"}, dOffset={{"*",1.125}, {".", 3}}},

                {ID=1,reg="4",addr=11,dtype="bytes", len=20, pMode={1,8},dStyle={"L1_4_11"}},
                {ID=1,reg="4",addr=11,dtype="bytes", len=20, pMode={2,0},dStyle={"L1_4_11_C"}},


                {ID=1,reg="5",addr=0,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_5_0"}},
                {ID=1,reg="5",addr=1,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_5_1"}},
                {ID=1,reg="5",addr=2,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_5_2"}},
                {ID=1,reg="5",addr=3,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_5_3"}},
                {ID=1,reg="5",addr=4,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_5_4"}},
                {ID=1,reg="5",addr=5,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_5_5"}},
                {ID=1,reg="5",addr=6,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_5_6"}},
                {ID=1,reg="5",addr=7,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_5_7"}},
                {ID=1,reg="5",addr=8,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_5_8"}},
                {ID=1,reg="5",addr=9,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_5_9"}},
                {ID=1,reg="5",addr=10,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_5_10"}},
                {ID=1,reg="5",addr=11,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_5_11"}},
                {ID=1,reg="5",addr=12,dtype="bit",dBit=0,pMode={1,5},dStyle={"L1_5_12"}},                

                {ID=1,reg="6",addr=0,dtype="byte", pMode={2,0},dStyle={"L1_6_0"}},
                {ID=1,reg="6",addr=1,dtype="short", pMode={2,0},dStyle={"L1_6_1"}},

                {ID=1,reg="16",addr=0,dtype="byte", pMode={2,0},dStyle={"L1_16_0"}},
                {ID=1,reg="16",addr=0,dtype="byte", pMode={2,0},dStyle={"L1_16_0_O1"}, dOffset={{"+", 5}}},                

                {ID=1,reg="16",addr=1,dtype="short", pMode={2,0},dStyle={"L1_16_1"}},
                {ID=1,reg="16",addr=1,dtype="short", pMode={2,0},dStyle={"L1_16_1_O1"}, dOffset={{"+", 5}}},                

                {ID=1,reg="16",addr=2,dtype="int", pMode={2,0},dStyle={"L1_16_2"}},
                {ID=1,reg="16",addr=2,dtype="int", pMode={2,0},dStyle={"L1_16_2_O1"}, dOffset={{"+", 5}}},                

                {ID=1,reg="16",addr=9,dtype="float", pMode={2,0},dStyle={"L1_16_9"}},
                {ID=1,reg="16",addr=9,dtype="float", pMode={2,0},dStyle={"L1_16_9_O1"}, dOffset={{"+", 5}}},                                
            },

        },
    },
}

文档更新时间: 2024-07-11 21:07   作者:Mixiot