安全系统控制与MAXQ2000-Security Syste

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

文章摘要:To prevent keys from repeating, once a bit pattern has been static long enough to be accepted, a different bit pattern (which includes the idle state where no keys are depressed) must be accepted before the first bit pattern can be accepted again. Handling Simultaneous KeypressesSimultaneous keypres

安全系统控制与MAXQ2000-Security Syste,标签:计算机控制技术,工厂电气控制技术,http://www.88dzw.com
To prevent keys from repeating, once a bit pattern has been static long enough to be accepted, a different bit pattern (which includes the idle state where no keys are depressed) must be accepted before the first bit pattern can be accepted again.

Handling Simultaneous Keypresses

Simultaneous keypresses are possible when using a keypad input device. The debouncing code ensures that if a second key is pressed right after the first, the debounce interval will start over, but be short enough in practice so that this is not an issue.

Once a bit pattern has been accepted, the action for each depressed-key bit can be taken by rotating all 16 bits into the carry bit individually using the accumulator and checking each in turn. The following code responds only to the first depressed key, but this could be easily changed.

State4_Match:
   djnz    LC[0], State4_End
   move    A[15], Acc       ; Reset last debounced pattern

   rrc
   jump    NC, State4_KeyA
   rrc
   jump    NC, State4_KeyB
   rrc
   jump    NC, State4_KeyC
   rrc
   jump    NC, State4_KeyD

   rrc
   jump    NC, State4_Key3
   rrc
   jump    NC, State4_Key6
   rrc
   jump    NC, State4_Key9
   rrc
   jump    NC, State4_KeyPound

   rrc
   jump    NC, State4_Key2
   rrc
   jump    NC, State4_Key5
   rrc
   jump    NC, State4_Key8
   rrc
   jump    NC, State4_Key0

   rrc
   jump    NC, State4_Key1
   rrc
   jump    NC, State4_Key4
   rrc
   jump    NC, State4_Key7
   rrc
   jump    NC, State4_KeyStar

   jump    State4_End

Interfacing to the LCD Display

The LCD display included with the MAXQ2000 EV kit has segments defined as shown (Figure 5).

Figure 5. The LCD display contains four-and-a-half 7-segment characters.
Figure 5. The LCD display contains four-and-a-half 7-segment characters.

First, the LCD display must be initialized to static drive mode and enabled. Once this has been done, characters can be written to the display by setting segments appropriately.

InitializeLCD:
   move    LCRA, #03E0h      ; xxx0001111100000
                             ;    00            - DUTY : Static
                             ;      0111        - FRM  : Frame freq
                             ;          1       - LCCS : HFClk / 128
                             ;           1      - LRIG : Ground VADJ
                             ;            00000 - LRA  : RADJ = max

   move    LCFG, #0F3h       ; 1111xx11
                             ; 1111     - PCF  : All segments enabled
                             ;       1  - OPM  : Normal operation
                             ;        1 - DPE  : Display enabled

   move    LCD0, #00h        ; Clear all segments
   move    LCD1, #00h
   move    LCD2, #00h
   move    LCD3, #00h
   move    LCD4, #00h
   ret

Entering the PIN

In the CLOSED, SET, and ALERT states, a PIN can be entered to change the alarm controller to another state. As each character is entered, the working value held in A[10] is shifted left and ORed with the new character, and the decimal point on the LCD display moves left to indicate the number of characters entered. For security reasons, the PIN being entered is not shown on the display.
State4_Key0:
   move    Acc, #0000h
   jump    State4_Shift

State4_Key1:
   move    Acc, #0001h
   jump    State4_Shift

State4_Key2:
   move    Acc, #0002h
   jump    State4_Shift

....

State4_Shift:
   move    A[12], Acc

   move    Acc, A[10]
   cmp     #0FFFFh         ; flag indicating no PIN entry allowed
                           ;    in current state
   jump    E, State4_NoKey

   move    Acc, A[11]      ; key count
   cmp     #04             ; if already at 4 (should have been cleared)
   jump    E, State4_NoKey

   add     #1
   move    A[11], Acc

   move    Acc, A[10]
   sla4
   or      A[12]
   move    A[10], Acc

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


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

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