⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jb8-psu.asm

📁 MC68HC608JB8的固件例程源程序.zip
💻 ASM
📖 第 1 页 / 共 2 页
字号:
*****************************************************************************
*                                         Copyright (c) Motorola 2002		*
*  File Name:	JB8-PSU.ASM													*
*                        													*
*  Description:	USB PS/2 keyboard demo program for HC908JB8					*
*																			*
*                                                                          	*
*  Assembler:	CASM08Z	(P&E Microcomputer Systems Inc)						*
*  Version:		3.16							                        	*
*																			*
*  Current Revision:	1.0													*
*  Current Revision Release Date: 2002.08.10 by Derek Lau					*
*																			*
*  Updated History															*
*   Rev		YYYY.MM.DD  Author			Description of Change				*
*	---		----------- ------			---------------------				*
*	0.0		1999.10.30	Derek Lau		orginal release						*
*   0.1		2000.03.20	Derek Lau		changed key matrix for new PCB		*
*                                   	ACPI report ID = 1 to pass Winkey	*
*   0.2		2000.05.02	Derek Lau		fixed PS2 command problems			*
*										extend PS2/USB detection to 10s		*
*										changed USB suspend time from 3->8ms*
*   0.3		2000.05.16	Derek Lau		support Hot key function			*
*	0.4		2002.02.19	Derek Lau		fixed keyboard remote wakeup 		*
*										problem in some machines			*
*	1.0		2002.08.10	Derek Lau		general release					 	*
*****************************************************************************
* This Program is a freeware to demonstrate the operation of Motorola		*
* Microcontroller. Motorola reserves the right to make changes without		*
* further notice to any product herein to improve reliability, function, or *
* design. Motorola does	not assume any liability arising out of the 		*
* application or use of any product, circuit, or software described herein; *
* neither does it convey any license under its patent rights nor the rights *
* of others. Motorola products are not designed, intended, or authorized 	*
* for use as components	in systems intended for surgical implant into the	*
* body, or other applications intended to support life, or for any other	*
* application in which the failure of the Motorola product could create a	*
* situation where personal injury or death may occur. Should Buyer purchase	*
* or use Motorola products for any such intended or unauthorized 			*
* application, Buyer shall indemnify and hold Motorola and its officers,	*
* employees, subsidiaries, affiliates, and distributors harmless against	*
* all claims, costs, damages, and expenses, and reasonable attorney fees	*
* arising out of, directly or indirectly, any claim of personal injury or	*
* death associated with such unintended or unauthorized use, even if such	*
* claim alleges that Motorola was negligent regarding the design or 		*
* manufacture of the part. Motorola	and the Motorola logo* are registered	*
* trademarks of Motorola Inc												*
*****************************************************************************
* To be Done List:
*
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Notes:
* - abbreviation
*     i/p - input, o/p - output, i/o - input/output, o/d - open-drain o/p
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* ====== Compile Options =================================================
.CYCLE_ADDER_OFF
$BASE !10


* ------ Image of CONFIG Register ----------------------------------------

K_CONFIG   equ %00010011
*                 |||||+---------- 1-disable COP
*                 ||||+----------- 1-enable STOP inst.
*                 |||+------------ 0-COP timeout period - 8k OSC cycle
*                 ||+------------- 0-Stop mode recovery - 4096 OSC cycle
*		  		  |+-------------- 0-enable LVI
*		  		  +--------------- 	; 0-USB Reset to generate reset signal


.PAGE
* ====== Include Files ===================================================
$INCLUDE    "JB8-EQS.H"                 ; JB8 Reg. Equates & Variables



* ====== MACRO Defination ================================================
$INCLUDE    "MACRO8.ASM"

.PAGE
* ====== New I/O Definations =============================================

* --- Port A -------------------------------------------------------------
* Key Matrix - Scan Row 0-7
*
*
* --- Port E -------------------------------------------------------------
b_COL16      equ 0              ; Key Matrix - Scan Column 16       [o/d]
b_COL17      equ 2              ; Key Matrix - Scan Column 17       [o/d]
KBD_CLK      equ 3              ; PS/2 serial clock (USB D-)        [o/d]
KBD_DTA      equ 4              ; PS/2 serial data (USB D+)         [o/d]
*
*
*
*
* --- Port B -------------------------------------------------------------
* Key Matrix - Scan Column 0-7
*
*
* --- Port C -------------------------------------------------------------
* Key Matrix - Scan Column 8-15




.PAGE
* ====== Variable Definations ============================================

        ORG     RAM_BEG
* ====== Begin of System RAM area ========================================
SRAM_Beg    equ     *

* --- PORT E -------------------------------------------------------------
V_PTE           ds      1                 ; store value of PORTE

* --- OC/IC Timer --------------------------------------------------------
K_Fcpu          equ     3000              ; CPU clock freq.       [KHz]
K_Ftim          equ     {K_Fcpu/4}        ; Timer clock rate      [KHz]
*
* Tmr CH0 periodic interrupt - for USB suspend timeout
* USB suspend time changed to 8ms 2 May 2000 *
K_Tch0          equ     8                 ; CH0 OCMP period       [ms]
K_Nch0          equ     {K_Tch0*K_Ftim}   ;                       [cnts]
*
* Tmr CH1 periodic interrupt - for keyboard idle timeout, 40ms time tick
K_Tch1          equ     4                 ; CH1 OCMP period       [ms]
K_Nch1          equ     {K_Tch1*K_Ftim}   ;                       [cnts]
*
V_TmrH          ds      1       ; Temp storage of TACNT_H
*
* (dec. by timer Ch1 interrupt - every 4ms)
VC_Kidle        ds      1       ; Counter for Kbd. Report Idle Timeout
                                ; (dec. for every 4ms time tick)
*
* (dec. by timer Ch1 interrupt - every 4ms)
KC_40ms         equ     10      ; init. value for VC_40ms
VC_40ms         ds      1       ; counter for 40ms time tick
*
KC_10s          equ     200
KC_400ms        equ     8       ; for POR delay
KC_350ms        equ     7       ; for BAT test delay
KC_150ms        equ     3
VC_Xms          ds      1       ; counter for 350ms,400ms,3s delay
*
VS_TIMER        ds      1       ; Timer Status Byte
b_T4MS          equ 0           ;  -1  4ms time tick
b_T40MS         equ 1           ;  -1  40ms time tick
b_Tsus          equ 2           ;  -1  suspend timeout

K_N50ms         equ     {50*K_Ftim}       ; timer counts for 50ms  [cnt]

*

;* (bit definition follow LED pins of port D)
;V_LED           ds      1       ; LEDs status byte (PS2 report)
;b_SCRL          equ 2           ;  =1    SCROLL lock enable
;b_CAPS          equ 3           ;  =1    CAPS lock enable
;b_NUM           equ 4           ;  =1    NUM lock enable
*
*
V_USBPS2    ds      1           ;
b_PS2Sys    equ 0
b_BatOKSent equ 1


* ====== Begin of PS2/USB RAM area ==========================================
URAM_BEG    equ     *
*
*
* --- Scan Keyboard ------------------------------------------------------
K_RowMax    Equ     8           ; 8 rows
K_ColMax    Equ     18          ; 18 columns
*
V_ScnStat   ds      1           ; Keyboard Scan Status
b_PKPress    equ 0              ;  =1    key press detected(on prev. scan)
b_CKPress    equ 1              ;  =1    key press detected(on curr. scan)
b_BrkKey     equ 2              ;  =1    BREAK key
b_Kghost     equ 3              ;  =1    ghost key detected
b_NewScan    equ 4              ;  =1    signal SCAN_HDLR to handle new scan
b_FOorun     equ 5              ;  =1    FIFO overrun
b_ScanEn     equ 6              ;  =1    enable scan kbd. matrix
*
V_KbdStat   ds      1           ; keyboard status byte
b_LSFT       equ 0              ;  =1    <L-SHIFT> key pressed
b_RSFT       equ 1              ;  =1    <R-SHIFT> key pressed
b_LALT       equ 2              ;  =1    <L-ALT> key pressed
b_LCTL       equ 3              ;  =1    <L-CTRL> key pressed
b_RCTL       equ 4              ;  =1    <R-CTRL> key pressed
b_CTRL       equ 5              ;  =1    <L-CTRL> or/and <R-CTRL> key pressed
b_RALT       equ 6              ;  =1    <R-ALT> key pressed
b_SHIFT      equ 7              ;  =1    <L-SFT> or/and <R-SFT> key pressed
*
V_KeyNum    ds      1           ; key number
*
Q_CScan     ds      K_ColMax    ; queue to store curr. scan result
Q_PScan     ds      K_ColMax    ; queue to store prev. scan result
*
V_ColVal    ds      1           ; row values of curr. column

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -