This document is SM39R series KBI function usage method
This application note describes the KBI (Keyboard Button Input) function of the SyncMOS SM39R series and lists the applicable parts SM39R16A2, SM39R12A2 and SM39R08A2. It explains how four Port 0 I/O pins can be configured as KBI inputs with independent flags and a shared interrupt vector at 0x5B, and notes that the function can be used for a 2x2 matrix keypad scan or other applications.
The note documents the KBLS, KBE, KBF, KBD, IEN1 and IRCON registers, including bit definitions, trigger-level selection, de-bounce settings and interrupt enable/flag handling. It also provides a KBI interrupt vector table and C and assembly reference programs for initializing KBI and handling KBI interrupts. This manual is written in Chinese.
| KBI I/O count | 4 I/O |
|---|---|
| KBI interrupt vector | 0x5B |
| Trigger level | Programmable high or low |
| Default de-bounce time | 320 ms |
| KBLS register address | 93h |
| KBE register address | 94h |
| KBF register address | 95h |
| KBD register address | 96h |
The document states that four I/O pins on Port 0 can be configured for KBI.
Yes, the trigger level can be set by program to low level or high level.
KBI uses the shared interrupt vector address 0x5B.
The KBF flags must be cleared by software.