|
|
View previous topic :: View next topic |
Author |
Message |
dave10
Joined: 09 Apr 2013 Posts: 14 Location: UK
|
Alarm logging problem |
Posted: Fri Aug 23, 2013 3:56 am |
|
|
Hi Guys
I have a problem I'm not sure how to solve ?
Basically when an unwanted condition ocurrs it generate an alarm. Which is then displayed upon an lcd display.
If two alarms ocurr it shows each alarm individually scrolling through each in a que until reset.
Above is working well.
But i would like to log these alarms once until cleared and store these element in an array.
So I have a,b,c flashing which goes into my array, which I grab only one.
How can I only take these value once. But still collect Alarm to be grabbed on the next occurance. i.e an alarm 'D' need adding but not updating A,B,C.
1, First alarm is 'A', Update array.
2, 'A' still active. Compare 'A' last and compare 'A' with new occurance no update as this is still the same alarm
3, Then another alarm so now I have 'A','B'. B is added but 'A' is not
4, Compare last with new 'A', 'B', compared with 'A','B'. no update and so on
So at the end of the week I can send these element off and reset my array to 0 and clear all elements.
Does any one have any ideas or am I missing the obvious ??
Thanks for listening! Dave |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Fri Aug 23, 2013 5:28 am |
|
|
one way....
each position in the array is an 'alarm event',say event(1) is your 'a' event, event(2) is you 'b' event, etc....
use the 'bit' functions to set/clear bits within the event array as required.
say bit 0 is 'alarm',bit 1 is 'logged', bit 2 is 'action needed', etc.
Since a byte is 8 bits, you have 8 'options' to code.
you could so the following
bit 0 is set when the alarm first occours..
bit 1 is is set to say 'got it'
bits 7..2 could be a counter to indicate how many times alarm occours or for other 'actions' needed to be done for this alarm event.
another way...
'something happens'..aka 'alarm'...
...check it's array position
...if zero, then put a '1' in that position
while this is simpler, there's only one 'status bit'( yes, we got an alarm).
the first one gives you plenty of options and is how most 'alarm control systems' work.
hth
jay |
|
|
dave10
Joined: 09 Apr 2013 Posts: 14 Location: UK
|
Alarm logging |
Posted: Fri Aug 23, 2013 7:21 am |
|
|
Hi Thanks for reply
I'll have to think about this deeply when I get home tonight ??
Option 2 could be a way forward thanks
Quote: | you could so the following
bit 0 is set when the alarm first occours..
bit 1 is is set to say 'got it'
bits 7..2 could be a counter to indicate how many times alarm occours or for other 'actions' needed to be done for this alarm event.
|
What the final array should replicate is the alarms as they happened in the order that they happen upto 160 charactors.
i.e ABEFGDAAAFFFF
Thanks Dave |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|