Lora芯片

[{
	"acqid": "acq101",
	"expr": "$float($data)",
	"name": "正向有功电能",
	"parms": "00H 00H",
	"rate": 1,
	"reglen": 2
}, {
	"acqid": "ctrl4",
	"expr": "$int($data)",
	"name": "开",
	"parms": "0DH B8H;11H 11H",
	"rate": 1,
	"reglen": 2
}, {
	"acqid": "ctrl5",
	"expr": "$int($data)",
	"name": "关",
	"parms": "0DH B8H;22H 22H",
	"rate": 1,
	"reglen": 2
}, {
	"acqid": "sta6",
	"expr": "$int($data)",
	"name": "开关状态",
	"parms": "0DH BAH",
	"rate": 1,
	"reglen": 1
}
]
#型号 modbus(crc16)
#modbus协议

def crc16: $crc($1,0x8005,0xffff,0x0000,0)

# $addr $len 都是输入的参数
def send:     [$addr 03H $1  $itom(2,$len) $crc16($group(0,$pos))]
def recv:     [$addr 03H     $ditch(1,$assign(&dl,$0))     $data($ditch($dl)) $ditch(2)]
def indict:   [$addr 10H $1  00H 01H 02H $2 $crc16($group(0,$pos))]
def undict:   [$addr 10H $1  $data($ditch(2)) $ditch(2)]

你可能感兴趣的:(物联网,串口项目)