Welcome to the forum!
The easiest way to see if any bit changes is to look at the 16 bits as an integer.
Each bit that turns on or off will change the value of your integer. So, compare the value of your integer this scan, to it's value last scan. If it's different, a bit has changed, so set your "alarm detected" bit and then copy the new value into your "last scan" value for the next check.
Of course, there's a gotcha here - if all of your individual bits are "1=alarm", then it's not enough to just detect that one has changed. To detect that you have a new alarm, you need to detect that a bit has changed from zero to one, but not from one to zero.
One way around this is to detect if your integer is
larger than on the last scan - so you would use the same logic, only use a "greater than" comparator, instead of a "not equal to" comparator.
Of course, there's a gotcha in
that method too, in that if you have one alarm turn on and one alarm turn off in the same scan, this logic will only detect it if the alarm that just turned on is assigned to a more significant bit than the alarm that just turned off. You'll have to decide how likely that is in your application, and whether it's a problem if it does occur.
Alarming is just one of those things - everyone has their own way of doing it, and probably none of them are perfect (except mine, of course
). Search the forum for threads on the topic and you'll find dozens of ideas on how to do it - try them all out and see which one works best for you!