??? 06/03/06 07:08 Read: times |
#117681 - writing firmware Responding to: ???'s previous message |
Hi Yogesh,
First, stop thinking in terms of armed or disarmed. Instead, think about states. The panel will always monitor the condition of the various circuits or zones, but it will respond to changes in the condition of a given zone based on the current system state. For example, you might have a circuit that has a contact switch on the front door. If the panel detects that the front door is opened, it will illuminate an led on a panel (to indicate that the door is opened) and then check the current system state. If the system is disarmed, it will do nothing else. If it finds that the system is in perimeter monitoring mode it might ring a soft alert chime. If it finds that the system is in the full armed delay mode, it will start a 60 second timer to give you a chance to come in and disarm the system, and if you haven't disarmed the system in the alloted time it will then initiate a full alarm. If it finds that the system is in full armed instant mode it will simply initiate a full alarm immediately. You will need to allocate a register, or a memory location, to a set of status bits. Arming the system is then just a matter of setting the appropriate bit to indicate which mode the system is set to. Likewise, disarming the system is just a matter of clearing the appropriate bits. Suppose you have a disarmed state, a perimiter monitoring state, a perimeter only armed with delay state, a perimiter only armed without delay state, and a full armed state. That's five possible system states, which means you would need 3 bits to represent each possible state. 000 = disarmed 001 = perimeter monitoring 010 = perimeter armed w/delay 011 = perimeter armed w/o delay 100 = system fully armed Since every byte has 5 more bits, you could use them to represent the state of any special circuits you might have (like a special store room or a gun cabinet) that you want to leave armed all the time, unless you specifically disarm that zone/circuit specially. Whatever arming/disarming technology you use, be it a keypad or a fingerprint scanner or a simple dry contact key switch, when the system receives the signal from the arming device it responds by setting or clearing the appropriate bits in your state byte or register. Good luck, Joe |