安全系统控制与MAXQ2000-Security Syste

[09-13 17:04:28]   来源:http://www.88dzw.com  控制技术   阅读:8633

文章摘要:STATEP6.0P6.1P6.2P6.3P6.4P6.5P7.0P7.11Input - 1Input - 4Input - 7Input - *lowtri-statetri-statetri-state2Input - 2Input - 5Input - 8Input - 0tri-statelowtri-statetri-state3Input - 3Input - 6Input - 9Input - #tri-statetri-statelowtri-state4Input - AInput - BInput - CInput - Dtri-statetri-statetri-sta

安全系统控制与MAXQ2000-Security Syste,标签:计算机控制技术,工厂电气控制技术,http://www.88dzw.com

STATE P6.0 P6.1 P6.2 P6.3 P6.4 P6.5 P7.0 P7.1
1 Input - 1 Input - 4 Input - 7 Input - * low tri-state tri-state tri-state
2 Input - 2 Input - 5 Input - 8 Input - 0 tri-state low tri-state tri-state
3 Input - 3 Input - 6 Input - 9 Input - # tri-state tri-state low tri-state
4 Input - A Input - B Input - C Input - D tri-state tri-state tri-state low

Figure 3. The MAXQ2000 pulls column 1 low to read the state of the first four keypad switches.
Figure 3. The MAXQ2000 pulls column 1 low to read the state of the first four keypad switches.

An Interrupt-Driven State Machine

The four columns must be strobed quickly so that any keypress has time to be read before it is released. Additionally, to prevent a switch's bouncing contacts from registering multiple presses, a key must be held down for a certain amount of time before it registers. Both of these factors can be done at once by making a timer-driven interrupt routine the heart of the application. This allows the application to scan through each one of the four columns in a periodic manner and to count the length of time a key has been depressed.
RELOAD           equ 0FF00h

StartTimer:
   move    IIR.3, #1         ; Enable interrupts for module 3
   move    IMR.3, #1

   move    T2V0, #RELOAD
   move    T2R0, #0h
   move    T2C0, #0h

   move    Acc, T2CFG0       ; Set timer 0 to run from HFClk/128
   and     #08Fh
   or      #070h
   move    T2CFG0, Acc

   move    T2CNA0.3, #1      ; Start timer 0
   move    T2CNA0.7, #1      ; Enable timer 0 interrupts
   ret
The reload value for the timer controls how often the interrupt will fire. This value must be short enough so that all keypresses are recognized. Additionally, to ensure that key response is not sluggish, the reload value must also be long enough so that it does not occupy an excessive amount of processing time. The value 0FF00h shown above (once about every 2.4ms) was reached through experimentation.

Once the column line for a group of four switches is driven low, some time may be required for the connection operating through a depressed switch to pull its input line low. This time is affected by the switch's on-resistance and by how many column switches are depressed at once. To avoid having to delay the interrupt service routine between pulling the column line low and reading the four switches, the column line for a given state is driven low in the previous state (Figure 4).

Figure 4. In each of the four key-scanning states, the application reads the status of four switches and prepares to read the next four.

上一页  [1] [2] [3] [4] [5] [6]  下一页


Tag:控制技术计算机控制技术,工厂电气控制技术控制技术

《安全系统控制与MAXQ2000-Security Syste》相关文章