菜鸟:
小第:做了个200PLC和富士温控表通讯程序。下载后在监控里能看到数据,但和实际值不一样,不知如何是好,望高人指点!
斑竹:
你要看表的通讯协议,可能读取过来的数据需要处理,系数什么的。
菜鸟:
5.MODBUSCOMMUNICATIONPROTOCOL
5.1General
ThecommunicationsystembytheMODBUSprotocolisthatthecommunicationisalwaysstartedfromthemaster
stationandaslavestationrespondstothereceivedmessage。
Transmissionproceduresisasshownbelow。
1)Themasterstationsendsacommandmessagetoaslavestation。
2)TheslavestationchecksthatthestationNo.inthereceivedmessagematcheswiththeownstationNo.or
没有。
3)Ifmatched,theslavestationexecutesthecommandandsendsbacktheresponsemessage。
4)Ifmismatched,theslavestationleavesthecommandmessageandwaitforthenextcommandmessage。
一)IncasewhenthestationNo.inthereceivedcommandmessagematcheswiththeownslavestationNo。
Commandmessage
ResponsemessageSlavetomaster
MastertoslaveDataon
theline
B)IncasewhenthestationNo.inthereceivedcommandmessagemismatcheswiththeownslavestation
号
Commandmessage
(Notrespond)Slavetomaster
MastertoslaveDataon
theline
Themasterstationcanindividuallycommunicatewithanyoneofslavestationsconnectedonthesamelineupon
settingthestationNo.inthecommandmessage。
这是表的通讯你帮我看看要如何处理啊
我用标准的通讯案例读出来的数据是占2个位的,不知咋搞
斑竹:
要搞清数据格式的定义规则再在程序中转换。通迅上的都是16位整数格式。
菜鸟:
能读出数据就成功一半了读取到的数据相差很大吗?还是进接近呢?
斑竹:
如果是整数值应该是一致的,如果是浮点数就完全不一样了。