[Next]
[Previous] [Up] [Top] [Contents] [Back]Chapter 3 Programming Considerations
If it is desired to detect changes in the input lines without continuously polling the inputs, the Change of State circuit must be used.
To activate this circuit certain actions are to be performed by the user, in a certain sequence.
There are four channels and they may, independently from each other, be configured to generate interrupts. All actions which are now to be described are related to one of the four channels.
First the contents of the Compare State Register must be initialized with the desired compare pattern. Note: Normally this will be the current state of the inputs read from the Current State Register. Next the contents of the interrupt vector register must be initialized with the desired vector information. Last the contents of the control register of the BIM must be initialized with the desired interrupt level and with the interrupt enable bit SET and the interrupt auto-clear bit SET and the Ex/Int bit RESET.
When a change in the input lines is detected an interrupt is generated on the desired level and an acknowledge will be answered with the desired vector. The interrupt auto-clear bit must be set to automatically remove the interrupt from the bus when it is acknowledged.
The Change of State circuit samples the current state of the input lines into the Change State Register when the first difference is detected between the input lines and the contents of the Compare State Register. The Change State Register may be read after an interrupt has occurred to determine what change did generate the interrupt. Reading this register does not alter its contents, however reading the Current State Register DOES change the contents of the Change State Register. Thus, when an interrupt has occurred first the Change State Register should be examined. Also, no read of the Current State Register should occur while waiting for an interrupt because reading the Current State Register may invalidate the contents of the Change State Register.
[Next]
[Previous] [Up] [Top] [Contents] [Back]