本帖最后由 pcsms_S4Xcr7e6 于 2019-3-27 08:54 编辑
准备读 电压表 保持寄存器 中的 频率数据,在 触摸屏上显示。但是目前始终显示为0。请各位同仁予以指教,谢谢!
macro_command main()
char command[32],response[32], Freq[10]
short address,checksum
short read_no,return_value,read_data[2]
bool success1
FILL(command[0],0,32)
FILL(response[0],0,32)
Command[0] = 0x1
Command[1] = 0x3
address = 30
HIBYTE(address,command[2])
LOBYTE(address,command[3])
read_no = 2
HIBYTE(read_no,command[4])
LOBYTE(read_no,command[5])
CRC(command[0],checksum,6)
LOBYTE(checksum,command[6])
HIBYTE(checksum,command[7])
OUTPORT(command[0],"VotMeter RTU",8)
DELAY(200)
INPORT(response[0], "VotMeter RTU",2,return_value)
//GetData(response[0], "VotMeter RTU", LW, 30, 2)
if return_value > 0 then
//Beep()
read_data[0] = response[4] + (response[3]<<8)
read_data[1] = response[6] + (response[5]<<8)
SetData(read_data[0],"Local HMI",LW,100,2)
end if
end macro_command |