?? time-name_005.asm
字號:
;============================================================================
;; Project code:Rtc(Real Time Clock display date on DD20RLCD)
;; MCU: GPL11A/GPL11B/GPL12A/GPL13A
;; Compiler:FortisIDE 1.6.20,Body Version 1.1.8,Sunplus
;; EE information: None
;; Designer:Rick Ding
;----------------------------------------------------------------------------
;; Revise Log:
;; Version Data Folder\Filename Revise By Change Description
;;
;; V005 2008/02/18 E:\ding\lianxi\Time+Name\time-name_005.asm Rick Ding Modify the seconds's show after the modification of the new date,change to start "00"sec
;; V004 2008/02/18 E:\ding\lianxi\Time+Name\time-name_004.asm Rick Ding Clear Timetwodots flash,add cock flash
;; V003 2008/02/18 E:\ding\lianxi\Time+Name\time-name_003.asm Rick Ding Add "SET"@modify the date
;; V002 2008/02/18 E:\ding\lianxi\Time+Name\time-name_002.asm Rick Ding Add Name's code
;; V001 2008/02/16 E:\ding\lianxi\Time+Name\time-name Rick Ding Clear Year,Month,Day etc
;;============================================================================
.SYNTAX 6502
.LINKLIST
.SYMBOLS
.include SPLxx.inc
.include define.inc
.CODE
;-------------------------------
RESET:
sei
ldx #FFH
txs
;***************************************************************************************
lda #0
ldx #80H
L_ClearRam:
sta $00H,x
inx
bne L_ClearRam ;Clear Ram (80H-ffH)
%X32KStrongMode
%S_Show_FullBattery
lda #D_Pump_CLK_8K+D_1_8_Duty+D_1_3_Bias+D_Dots_On ;
sta P_04H_LCD_CTL
lda P_04H_LCD_CTL ;LCD set to normal mode
and #.NOT.D_LCD_Mask
ora #D_LCD_Normal
sta P_04H_LCD_CTL
jsr S_WatchDogClear
;-------------------------------------------------------------------
;; Initialize and display the initialization value
;-------------------------------------------------------------------
lda #rTiming_Initialize_Sec
sta rTimingValue
Name:
jsr S_DisplayNameOnLCD
lda #rHour_Initialize
sta rHourData
jsr F_Display_hour ;;show hour "0":00
; %S_Show_TimeDots
lda #rMinutes_Initialize
sta rMinutesData
jsr F_DisplayResult_minutes ;;show minutes 0:"00"
jsr F_DisplayInitializeSecondes
;========================================================================
; Start
;========================================================================
F_Start:
sei
; %S_Show_FullBattery
jsr S_WatchDogClear
; jsr F_DisplayInitializeSecondes
lda rHourData
sta rBcdBuffer
; jsr F_Display_hour ;;show hour
%S_Show_TimeDots
lda rMinutesData
sta rBcdBuffer
; jsr F_DisplayResult_minutes ;;show minutes
;------------------------------------------------------------------
; Initialize INB&IOA
;------------------------------------------------------------------
lda #sP_A0_Reverse
sta TimeTwoDotsValue
lda #P_ADir_High
STA P_01H_PortA_Dir
lda #P_AAttrib_High ;;Initialize IOA output is high
STA P_02H_PortA_Attrib
lda #P_AData_High
STA P_00H_PortA_Data
lda #P_B_initialize
sta P_10H_IO_Config ;;initislize INB
sta P_03H_PortB_Data
;------------------------------------------------------------------
lda #D_CPU_CLK_HSCK_2 ;set CPU clock to HSCK/2
sta P_05H_CPU_CLK
%X32KStrongMode
;------------------------------------------------------------------
; 0.5s interrupt
;===========*****==========*****==========*****==========*****==========
lda #P_0AH_TimerLow
sta P_0AH_TimerLow_Data
lda #P_0BH_TimerHigh
sta P_0BH_TimerHigh_Data ;;set timer is 0.5s
lda #D_Timer_Source1_VDD+D_Timer_Source2_LSCK+D_Timer_Enable ;enable timer
sta P_09H_Timer_Set
;===========*****==========*****==========*****==========*****==========
LDA #D_2Hz_1Hz_SEL ;Set real-time clock 1Hz
STA P_0DH_Timer_Source2
lda #D_INT_T2HZ+D_INT_KEYC+D_INT_TMO
sta P_0EH_INT_SET ;Set Interrupt source: 1HZ+KeyC+TMO
lda #D_WKU_T2HZ+D_WKU_KEYC+D_WKU_TMO
sta P_07H_WKU_Set ;Set wakeup source: 1HZ+KeyChange+TMO
cli
;===========================================================================
; Start KeyCheck&Time Working
;===================================
LoopStartTest: ;Loop Check Funkey&Modekey
;---------------------------------------------
; Modify Hour
;---------------------------------------------
F_KeyProcess_Hour:
jsr S_WatchDogClear
lda P_03H_PortB_Data
and #P_B0_Value
bne F_KeyProcess_Hour
F_ModeKeyProcess_Hour:
jsr S_WatchDogClear
lda P_03H_PortB_Data
and #P_B0_Value
beq F_ModeKeyProcess_Hour ;;wait hour Modekey putup
F_ModifyHour: ;key press,goto midify Day
%S_ShowSET
jsr S_Inc_Hour
lda #rTiming_Initialize_Sec
sta rTimingValue
; jsr S_DisplaySecondes
;---------------------------------------------
; Modify Minutes
;---------------------------------------------
F_ModifyMinutes: ;key press,goto midify Minutes
jsr S_Inc_Minutes
lda #rTiming_Initialize_Sec
sta rTimingValue
; jsr S_DisplaySecondes
F_OKKeyProcess:
%S_ShutSET
%S_ShowOK
jsr S_500ms_Delay
%S_TurnOffOK
lda #rTiming_Initialize_Sec
sta rTimingValue
jsr S_DisplaySecondes
jmp LoopStartTest
IRQ:
pha
txa
pha
lda P_07H_WKU_Set
tax
jsr S_WatchDogClear
;;---Check IRQ flag
L_IRQ_ChechFlagLSCK:
txa
and #D_WKU_LSCK_INT
beq L_IRQ_ChechFlagT2Hz
lda #D_WKU_LSCK_INT
sta P_08H_WKU_CLR ;;Clear interrupt flag
jmp lExitIRQ
L_IRQ_ChechFlagT2Hz:
txa
and #D_WKU_T2HZ
beq L_IRQ_CheckTMO
lda #D_WKU_T2HZ
sta P_08H_WKU_CLR ;;Clear interrupt flag
jmp Loop1HzProcess
L_IRQ_CheckTMO:
txa
and #D_WKU_TMO
beq L_IRQ_CheckEXT1 ;;Time Overflow
lda #D_WKU_TMO
sta P_08H_WKU_CLR ;;Clear interrupt flag
jmp Loop1_2HzProcess ;0.5s interrupt
L_IRQ_CheckEXT1:
txa
and #D_WKU_EXT1
beq L_IRQ_OtherIRQ ;;EXT INT1-->recevie clock
lda #D_WKU_EXT1
sta P_08H_WKU_CLR ;;Clear interrupt flag
jmp lExitIRQ
L_IRQ_OtherIRQ:
lda #D_WKU_HSCK_N+D_WKU_EXT2+D_WKU_KEYC;;Clear interrupt flag
sta P_08H_WKU_CLR
jmp lExitIRQ
;;-----Check IRQ flag Over
;=*=*=*=*=*=*=*=*==*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
;; 1/2S Process
;=*=*=*=*=*=*=*=*==*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Loop1_2HzProcess:
jsr S_WatchDogClear
lda TimeTwoDotsValue
eor #sP_A0_Reverse
sta TimeTwoDotsValue
; %S_Show_TimeTwoDots ;;TimerTwoDots show per 1/2S
; %S_FlashClock
lda R_KeyMenuLevel
and #FlagLCDFlash
beq L_IRQDoNotFlashLCD
%S_FlashClock ;;When modify the date,the "Clock" will flash
jsr S_LCDFlashOneDigital
L_IRQDoNotFlashLCD:
jmp lExitIRQ
;=*=*=*=*=*=*=*=*==*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
;; 1Hz Process
;=*=*=*=*=*=*=*=*==*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Loop1HzProcess: ;tbd by RickDing
jsr S_WatchDogClear
inc rTimingValue
jsr F_DisplayInitializeSecondes ;;Show secondes
;--*****-------------****-------------****---------****--------------****------**---
L_LoopTimingTest:
lda rTimingValue
cmp #rOneMin
bne lExitIRQ ;;judge one minute(60 second),60s?YES--rMinutesData+1;NO--F_ExitIRQ,Loop Test
lda #rTiming_Initialize_Sec
sta rTimingValue ;;1 minute;clear second to 0S
;--*****-------------****-------------****---------****--------------****------**---
jsr S_DisplaySecondes ;Test 1S
;---****-------------****--------------****--------****--------------****------**---
inc rMinutesData
jsr F_DisplayResult_minutes ;;after 60s,minutesdata+1&show minutes
lda rMinutesData
cmp #rOneHour
bne lExitIRQ ;;judge one hour(60 minutes)
lda #InitializationValue
sta rMinutesData ;60 minutes[one hour] later,set minutes=$00h
sta rTimingValue ;60 minutes[one hour] later,set second=$00h
jsr F_DisplayResult_minutes
jsr S_DisplaySecondes
inc rHourData
jsr F_Display_hour
lda rHourData
cmp #rOneDay
bne lExitIRQ ;;judge one day(24 hours)
lda #rHour_Initialize
sta rHourData
jsr F_Display_hour ;;24 hours later,set hour=$00h&display
lda #rMinutes_Initialize
sta rMinutesData
jsr F_DisplayResult_minutes ;;24 hours later,set minutes=$00h&display
lda #InitializationValue
sta rTimingValue ;;one day[24 hours]later,set Second=$00h
jsr S_DisplaySecondes
lExitIRQ:
pla
tax
pla
rti
NMI:
nop
nop
rti
.include sub.inc
;====================================================================
VECTOR .section
DW NMI ;Nmi
DW RESET
DW IRQ
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -