dyxlfl
級別: VIP會員
|
做了宏數據比較輸出數據格式是32 bit unsigned 和32 bit BCD,總是不能準確按對應得進行比較數據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] //設置函數范圍 bool on=1,off=0 //設置狀態函數形式 bool btt1,btt2 //設置狀態函數形式 GetDataEx(AAR0, "Mitsubishi FX5U ", D, 618, 1) // 32 bit BCD數據格式 GetDataEx(AAR2, "Mitsubishi FX5U ", D, 630, 1) // 32 bit BCD數據格式 GetDataEx(ss, "Mitsubishi FX5U - Binary Mode (Ethernet)", D, 620, 1) // 32 bit unsigned數據格式 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) //轉發到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重新編輯 ] |
---|---|
|