安全系统控制与MAXQ2000-Security Syste

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

文章摘要:Once all four characters are entered, the PIN is checked against a hard-coded value. If the entered value matches the PIN, the appropriate state transition occurs. PIN_VALUE equ 03870h ; Just a random number;; "Closed" state codeML_Closed: move A[10], #00000h ; Re

安全系统控制与MAXQ2000-Security Syste,标签:计算机控制技术,工厂电气控制技术,http://www.88dzw.com
Once all four characters are entered, the PIN is checked against a hard-coded value. If the entered value matches the PIN, the appropriate state transition occurs.
PIN_VALUE        equ 03870h       ; Just a random number

;; "Closed" state code

ML_Closed:
   move    A[10], #00000h         ; Reset PIN value
   move    A[11], #0              ; Reset number of PIN chars entered

   move    LCD3, #LCD_CHAR_C
   move    LCD2, #LCD_CHAR_L
   move    LCD1, #LCD_CHAR_5
   move    LCD0, #LCD_CHAR_D

ML_Closed_L:
   move    Acc, A[11]
   cmp     #4                     ; 4 characters entered?
   jump    NE, ML_Closed_Check

   move    Acc, A[10]
   cmp     #PIN_VALUE             ; PIN matches?
   jump    E, ML_Set

   call    LongBeep               ; Beep on incorrect PIN and reset
   move    A[10], #0000h
   move    A[11], #0
   move    LCD3.7, #0

ML_Closed_Check:
   move    C, PI5.3               ; Check reed switch
   jump    NC, ML_Closed_L        ; Closed, stay in current state

   call    ShortBeep              ; 4 short beeps signal transition
   call    ShortPause
   call    ShortBeep
   call    ShortPause
   call    ShortBeep
   call    ShortPause
   call    ShortBeep
   call    ShortPause
   jump    ML_Open                ; Switch opened, go to OPEN state

Using the Piezoelectric Horn

In our application, a small piezoelectric horn is used to perform two functions: (1) provide audio feedback when keys are pressed or when an incorrect PIN is entered, and (2) sound an alarm when the reed switch opens while the system is armed.

For demonstration purposes, a small piezoelectric horn can be interfaced with the MAXQ2000 by connecting it between two port pins. The port pins are driven differentially to increase the current drive to the piezoelectric horn, and the loop counts used in the driver code determine the frequency of the tone emitted.
ShortBeep:
   move    LC[1], #100       ; Number of cycles
SB_L1:
   move    PO5.6, #0
   move    PO5.7, #1

   move    Acc, #2000        ; Count for forward polarity period
SB_L2:
   sub     #1
   jump    NZ, SB_L2

   move    PO5.6, #1
   move    PO5.7, #0

   move    Acc, #2000        ; Count for reverse polarity period
SB_L3:
   sub     #1
   jump    NZ, SB_L3

   djnz    LC[1], SB_L1
   ret
In an actual alarm system, stronger drive circuitry would be used to run the piezoelectric horn, and the horn would be driven at its resonant frequency to increase the volume.

Conclusion

The MAXQ2000 interfaces easily and directly to LCD displays by means of its dedicated LCD controller peripheral. Multiplexed keypads can be read in a straightforward manner using the flexible port-pin configuration provided by the MAXQ2000. A timer-interrupt-driven state machine allows all keys in the matrix to be scanned and debounced with minimal effect on processor overhead. Finally, a piezoelectric horn and magnetic reed switch can be controlled easily as well, using the general-purpose port pins available on the MAXQ2000.

This article appears in the MER Vol 5.

<-- END: DB HTML -->

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


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

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