Posted 12 Jan 2022 Hi all! This maybe a simple question but my brain is not allowing me to do it. I have an array variable of INT I use for alarms. I want to compare the values in the array variable to make sure they are all zero. If they are not zero I want to turn on an alarm. I have messed with the Arrary Compare value instructions (AryCmpGTV, AryCmpLEV Etc.) The goal is to monitor all the values in the array and if one becomes greater than zero, I know that an alarm has occurred. In CX, I use 2 in-line compare statements; a greater than Zero and less than or EQ to 'some value' depending on how i split up the alarms. How can this be done in Sysmac? Nate Share this post Link to post Share on other sites
Posted 12 Jan 2022 alarm_found:=false; for n=0 to 20 if alarm_array[n]<>0 then alarm_found:=true; exit; endi_if next Share this post Link to post Share on other sites
Posted 12 Jan 2022 Thanks for the advice, I found a way to do this in ladder, its just a couple more steps. To review: I have a FB that places an integer into an array that indicates which alarm is active. This is called "Cyl_Alarm". To do what I was asking about, I used a AryCmpGTV(Cyl_Alarm[0], Int#16, Uint#0, Cyl_Alarm_Active[0]) The Cyl_Alarm_Active is a new array of bools produced by the array compare. I then do an ArySearch after the compare using the new array: ArySearch(Cyl_Alarm_Active[0], UINT#16, Bool#True, Active_Alarm_Pos, Active_Alarms_1). The Active_Alarms_1 variable is the count of active alarms within the Array Search. This can easily be compared against to then turn on my Alarm On Bit. I have 60+ Alarms each with different statuses with the alarm. I break them up into 16 arrays for HMI Indicators and pages. Appreciate the Help! Nate Share this post Link to post Share on other sites