|
使用modbus协议,显示屏作为主机。在显示屏上输入:2.01,但是单片机收到的却为0
VacuumDegree_Unit_Word = get_text(2,16)
if VacuumDegree_Unit_Word == "Pa" then
VacuumDegree_Unit = 0
elseif VacuumDegree_Unit_Word == "mbar" then
VacuumDegree_Unit = 1
end
GasValue_Word = get_text(2,9)
if GasValue_Word == "氩气" then
GasValue = 0
--set_variant("GasValue",GasValue)
elseif GasValue_Word == "氮气" then
GasValue = 1
end
Sensitivity_correction_factor = get_value(2,10) --这个数据在显示屏上输入:2.01,理论上单片机收到的应该是201,但是收到的却是0(除了2.01,输入2.03也会出现这种情况)
Sensitivity_correction_factor = Sensitivity_correction_factor*100
local ar = {}
ar[0]=VacuumDegree_Unit
ar[1]=GasValue
ar[2]=ErrorCode
ar[3]=Sensitivity_correction_factor
mb_write_reg_16(1,0x07,ar)
希望大佬能指导一下
|
|