做了宏數(shù)據(jù)比較輸出數(shù)據(jù)格式是32 bit unsigned 和32 bit BCD,總是不能準(zhǔn)確按對(duì)應(yīng)得進(jìn)行比較數(shù)據(jù)0/1,那位高手幫忙看看,問題出那里了,謝謝
macro_command main()
unsigned int AAR0,AAR2,AAR4,AAR6, RW180,RW182,RW184,RW186,RW20,RW22,RW26
float ss,ss1,RW,RW6
short Alarm[66]
short pv[66] //設(shè)置函數(shù)范圍
bool on=1,off=0 //設(shè)置狀態(tài)函數(shù)形式
bool btt1,btt2 //設(shè)置狀態(tài)函數(shù)形式
GetDataEx(AAR0, "Mitsubishi FX5U ", D, 618, 1) // 32 bit BCD數(shù)據(jù)格式
GetDataEx(AAR2, "Mitsubishi FX5U ", D, 630, 1) // 32 bit BCD數(shù)據(jù)格式
GetDataEx(ss, "Mitsubishi FX5U - Binary Mode (Ethernet)", D, 620, 1) // 32 bit unsigned數(shù)據(jù)格式
GetDataEx(RW180, "Local HMI", RW, 610, 1)
GetDataEx(RW182, "Local HMI", RW, 614, 1)
GetDataEx(RW, "Local HMI", RW, 620, 1)
SetData(AAR0, "Local HMI", LW, 190, 1)
SetData(AAR2, "Local HMI", LW, 192, 1)
SetData(ss, "Local HMI", LW, 194, 1)
//轉(zhuǎn)發(fā)到HMI
AAR6=( AAR0+ RW180)
RW186=( AAR2+ RW182)
RW182=( SS+ RW)
SetData( AAR6, "Local HMI", LW, 610, 1)
SetData( RW186, "Local HMI", LW, 614, 1)
SetData( RW182, "Local HMI", LW, 616, 1)
if (AAR2 < RW20)then
btt2=0
else
SetData(btt2, "Local HMI", LB, 867, 1)
end if
if (AAR2 > RW20)then
btt2=1
else
SetData(btt2, "Local HMI", LB, 867, 1)
end if
if (AAR0 < RW22)then
btt1=0
else
SetData(btt1, "Local HMI", LB, 866, 1)
end if
if (AAR0 > RW22)then
btt1=1
else
SetData(btt1, "Local HMI ", LB, 866, 1)
end if
end macro_command
[ 此帖被dyxlfl在2024-08-19 18:05重新編輯 ]