Power consumption report ST72F324 MCU board - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Power consumption report ST72F324 MCU board

Description:

Key scanning. February, 2004. MCU / Shanghai. 2. Agenda. Key-scan basics. implementation. Key-scan library. 3. Direct port-line or column-row scanning ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 18
Provided by: liaoji
Category:

less

Transcript and Presenter's Notes

Title: Power consumption report ST72F324 MCU board


1
Key scanning
February, 2004
MCU / Shanghai
2
Agenda
  • Key-scan basics
  • implementation
  • Key-scan library

3
Direct port-line or column-row scanning
  • Direct port-line suitable for several keys(lt10),
    1 port line / key
  • column-row scanning suitable for 10100 keys, M
    column N row supports up to MN keys

4
Key-scan tasks
  • Key press/ release probing
  • Ghost-key condition detection
  • Key debouncing
  • Taking appropriate action Output the status

5
Key-scan illustration
  • Column,row same stable logical level(high level
    here)
  • Output to column sequentially

6
Ghost key
  • 3 corners of a rectangle are pressed down
  • Hardware solution to use diodes to avoid the
    ghost condition
  • Software solution to detect ghost-key condition
    and give warning

7
Key debouncing
  • Key bounce is the general characteristic of
    mechanical key/switch
  • solution hardware and software debouncing

8
Agenda
  • Key-scan basics
  • implementation
  • Key-scan library

9
Key-scan block diagram
MCU
Taking Proper actions
Column Port line
Row Port line
Keyboard matrix
10
Software flow chart
Reset entry
Wait for Scan time
Perform key-scan Detecting ghost-key
Key debouncing
Key pressed /released detected?
N
Y
Take actions
11
Scan-key flow chart
Entry
Output low to Column, delay
Read from row Compare and store Output high to
column Column
N
Y
Last column?
Ghost key?
Return ghost key
Return key pressed/released, Or no change
12
Key debouncing state machine-press
13
Key debouncing state machine- release
14
Agenda
  • Key-scan basics
  • implementation
  • Key-scan library

15
Key-scan library
  • Target to ease users work and time
  • Support 188 key-matrix, easy to port to other
    matrix (only several minutes needed) under
    HIWARE C compiler
  • Embedded key-scan function, ghost-key detection,
    debounce function
  • Verified in Bluetooth keyboard

16
Key-scan library interface
Init_KB_Lib
Initialization code
call
Main routine
Exe_KeyScan
Confirm_KeyScan
Output_Column
Wait_10us
Call back
Input_Row
Library
User Program
17
Key-scan library prototype
  • void Init_KB_Lib(void)
  • struct Key_Result
  • unsigned char Code // row-column value
  • // special value code0xfe ghost key code0xff
    no key-state changed
  • unsigned char State // 0 default 1 pressed
    2 released
  • struct Key_Result Exe_KeyScan(void)
  • void Confirm_KeyScan(unsigned char code)
  • // confirm key-scan event(pressed or released)
  • // means proper action succeeded or failed
    code0 succeeded, code1 failed
Write a Comment
User Comments (0)
About PowerShow.com