📄 tf9925b.src
字号:
;*************************************************************************
; *
; Application : USA 900MHz Cordless Phone Base Unit Using KB8825 *
; Model No. : CT9925 *
; Client : *
; Control software : Base Control Software *
; Microcontroller : KS57C0504, 4KROM, 512nibbles RAM @4MHz (KS57C70F4) *
; Modified from : VA269B.SRC - 16ACH *
; Start date : 31/Jan/2002 *
; Date: 2002-01-31 *
;*************************************************************************
;------------
; Debug Note
;------------
;01/31
;1. redefine PIN assignment
;2. invert relay logic
;3. rewrite combo control routine
;4. add power down detect routine
;03/18
;1. fix the bug of off tx power after ring stop
;2. append TX_START flag when start sending tx data
;3. disable page during receiving DTMF code
;03/29
;1. switch TXMUTE and T/P switch pin
;2. add combo serial line pull-up resistor
;03/31
;1. change power down pin to talk led
;04/02
;1. invert TALK & PC led
;2. invert tx data polarity
;04/08
;1. restore TALK led status
;2. change flash time for 300ms
;3. change M/B for 33/67
;04/12
;1. restore tx data polarity
;2. change DTMF stop time from 400ms to 500ms
;3. cancel T/P software option
;4. change ring stop time from 8 sec. to 6 sec.
;04/25
;1. add 3 sec. ring detect for DTMF data without stop code
;04/28
;1. change DTMF cid length from 18 to 20 digits
;05/09
;1. change PLL IC from LMX1602 to KB8825B
.list off
.include "c:\skstudio\include\reg\57C0504.REG"
.list off
;********************************
; Dial time constant declaration
;********************************
INTTONE_TIME EQU 100 ; 100ms inter-tone pause @1ms
INTPUL_TIME EQU 8+1 ; 800ms inter-digit pulse time @100ms
PREDIG_TIME EQU 8+1 ; pre-digit pause @100ms
MAKE_TIME1 EQU 40/2 ; 40ms make time ( for 60/40 option )
BREAK_TIME1 EQU 60/2 ; 60ms break time ( for 60/40 option )
MAKE_TIME2 EQU 34/2 ; 33ms make time ( for 33/67 option )
BREAK_TIME2 EQU 66/2 ; 67ms break time ( for 33/67 option )
PAU_TIME EQU 36+1 ; 3.6s pause time @100ms
BUFFERSIZE EQU 64 ; dial buffer size = 64 digits
FLASH_TIME1 EQU 6+1 ; 600ms flash time
FLASH_TIME2 EQU 1+1 ; 100ms flash time
FLASH_TIME3 EQU 3+1 ; 300ms flash time
REDFLH_TIME EQU 20+1 ; 2 sec. flash time before redial
;
;********************
;Keycode declaration
;********************
STAR_KEY EQU 11 ; * / P->T
PALM_KEY EQU 12 ; #
PAUSE_KEY EQU 13 ; pause
REDIAL_KEY EQU 14 ; redial
FLASH_KEY EQU 15 ; flash
MEM_KEY EQU 16 ; memory
CHAN_KEY EQU 17 ; channel
TALK_KEY EQU 18 ; talk
VOL_KEY EQU 19 ; volume
;
;********************************
; RX data width range declaration
;********************************
;--------
; @150us
;--------
BIT1MAX EQU 4 ; tolerance = 33.3%
BIT1NOM EQU 0DDH ; bit1 (nominal:3) = 450us
BIT1MIN EQU 2 ; bit1 (max) = 600us, (min) = 300us
BIT0MAX EQU 7 ; tolerance = 16.7%
BIT0NOM EQU 0ADH ; bit0 (nominal:6) = 900us
BIT0MIN EQU 5 ; bit0 (max) = 1050us, (min) = 750us
;
SYNCMAX EQU 14 ; tolerance = 16.7% tolerance
SYNCNOM EQU 0AAH ; sync (nominal:12) = 1800us
SYNCMIN EQU 10 ; sync (max) = 2100us, (min) = 1500us
;
;************************
; Timer 0 (TC0) constant
;************************
TMR_150US EQU 33 ; 152 us int. interval
TMR_210US EQU 51 ; 210 us int. interval
;
;************************
; Timer 1 (TC1) constant
;************************
TMR_1MS EQU 54 ; 1 ms int. interval
TMR_45MS EQU 44/2 ; 45ms timer reload value
DTMF_100MS EQU 86 ; dtmf 100ms timer value
;
;************************************
; Transmit timing & parameter setting
;************************************
TALKON_TOC EQU 7 ; send "talk on" count = 7 times
;TX_TIMESLOT EQU 6 ; tx packet timeslot (45ms x 6=270ms)
TX_TIMESLOT EQU 3 ; 135ms
TXFRAME_DLY EQU 66 ; send frame delay gap
ACK_TOC EQU 1 ; send "ack" count = 1 time
TX_SETTLE EQU 90/2 ; tx power settle time = 90ms (100ms)
PLL_SETTLE EQU 30/2 ; pll settle time = 55ms (60ms)
;
;*******************
; Other contstant
;*******************
MAX_40CHAN EQU 40 ; max. channel number (40 ch. option)
ND_CHK_TIME EQU 15 ; ND check loop time
DEFAULT_CH EQU 1 ; default channel
CHCODE_CH EQU 21 ; change security code channel
;
;************************
; H/S -> B/U code table
;************************
CMD_CODE EQU 60H ; command format
TALKONT EQU 61H
TALKONP EQU 6CH
TALKOFF EQU 62H
CHGCHAN EQU 63H
HS_CONNECT EQU 64H
FLASH_CMD EQU 65H
;
DIAL_CODE EQU 40H ; dial code = 4xH
PAUSE_CODE EQU 4DH
;
TLK_CHCODE EQU 00H ; talk link channel code = 0xH
;CHG_CHCODE EQU 20H ; channel change code = 2xH (chg_ch + ch #)
CHG_CHCODE EQU 00H ; channel change code = 00xxxxxxB ( chg # )
;ACK EQU 10H ; ack. to B/U if connect command is rcvd.
;
CHGSEC_ACK EQU 10100000B ; change security ACK
CHGSEC_CFM EQU 00100010B ; change security confirm (B/U -> H/S)
;
;************************
; B/U -> H/S code table
;************************
;---------------
; header = (011)
;---------------
RINGON EQU 66H
RINGOFF EQU 67H
PAGE_CMD EQU 68H
PAGEOFF EQU 69H
OUTRNG_CMD EQU 6AH
BS_CONNECT EQU 6BH
BS_CID EQU 6CH
BS_DTMF EQU 6DH ; send DTMF caller id command
RINGSTOP EQU 6EH
;
;---------------
; header = (000)
;---------------
ACK_FORMAT EQU 00H ; ack code format (000)
CH_STATE EQU 00H ; send ch. scan result to h/s (0000SSSS) [00H-0FH]
ACK EQU 10H ; ack. if 1st h/s command is rcvd
TALK_ACK EQU 1FH ; send if ch. no. is rcvd (talk request)
ACK_PULSE EQU ACK+0CH ; ack code with pulse status
ACK_TONE EQU ACK+05 ; ack code with tone status
ACK_FLASH EQU ACK+02H ; flash ack code
;---------------
; header = (001)
;---------------
CH_ACK EQU 3FH ; send if ch. no. is rcvd (change channel)
;
;---------------
; header = (10X)
;---------------
CHANGE_SEC EQU 80H ; change security command (10CCCCCC) [10000001 - 10101000]
;
;************************************
; Constant declaration for CID part
;************************************
;
;------------------------------------
; CID message type / parameter type
;------------------------------------
SDMF EQU 04H ; single data message format
MDMF EQU 80H ; multiple data message format
SMW EQU 06H ; single message waiting (VMWI)
MMW EQU 82H ; multiple message waiting (VMWI)
MDMF_CAN EQU 81H ; MDMF test messages
;
***********************
; I/O port declaration
;**********************
COMBOPORT EQU P0
TONEPULPORT EQU P0
MKBRKPORT EQU P0
COMBO_CLK EQU 0 ; PLL CLOCK
TP_SW EQU 0 ; tone/pulse select (L:pulse,H:tone)
COMBO_DATA EQU 1 ; PLL DATA __
MK_BRK_SEL EQU 1
COMBO_STB EQU 2 ; ENABLE:Rising edge _| |_
;
RINGDETPORT EQU P1
CHGDETPORT EQU P1
RING_DET EQU 0 ; ring detect (/INT0)
CHARGE_DET EQU 1 ; charge detect (L:charge)
;
FSKDOUTPORT EQU P2
PWRDETPORT EQU P2
SIGOUTPORT EQU P2
RXDATAPORT EQU P2
FSK_DOUT EQU 0
POWER_DET EQU 1 ; power fail detect (L:power fail)
SIGOUT EQU 2 ; combo RSSI signal out detect H:busy
RX_DATA EQU 3 ; RX PATH DATA INPUT
;
TXMUTEPORT EQU P3
FLSSELPORT EQU P3
TXDATAPORT EQU P3
TXPWRPORT EQU P3
TXMUTE EQU 0 ; comp. mute control (L:mute)
FLASH_SEL EQU 0
TX_DATA EQU 1 ; KEEP Hi-Z WHILE NO OUTPUT
TX_PWR EQU 2 ; TX POWER CONTROL(L:TX POWER ON)
;
DTMFPORT EQU P4
DTMFBIT0 EQU 0 ; DTMF OUTPUT BIT 0
DTMFBIT1 EQU 1 ; DTMF OUTPUT BIT 1
DTMFBIT2 EQU 2 ; DTMF OUTPUT BIT 2
DTMFBIT3 EQU 3 ; DTMF OUTPUT BIT 3
;
DTMFDATAPORT EQU P4
DT1 EQU 0 ; HT9170 received data input
DT2 EQU 1
DT3 EQU 2
DT4 EQU 3
;
DTMFHPORT EQU P5
RXMUTEPORT EQU P5
TALKLEDPORT EQU P5
PCLEDPORT EQU P5 ; CHARGE LED
DTMFBIT4 EQU 0 ; DTMF OUTPUT BIT 4
DTMFBIT5 EQU 1 ; DTMF OUTPUT BIT 5
RXMUTE EQU 2 ; expander mute control (L:mute)
TALK_LED EQU 3 ; In-Use LED (low:on)
PC_LED EQU 3 ; Charge LED (low:on)
;
PAGEPORT EQU P6
DTMFSTDPORT EQU P6 ; HT9170 STD port
DTMFENPORT EQU P6 ; HT9170 TOE port
RELAYPORT EQU P6
PAGE EQU 0 ; PAGE KEY (L:KEY PRESSED)
HT9170_STD EQU 1 ; H:valid DTMF data received
HT9170_TOE EQU 2 ; H: HT9170 Enable
LINE_SEIZE EQU 3 ; LINE SEIZE CONTROL (H:SEIZE LINE)
;
;***********************
; FLAG declaration
;***********************
;
;BANK0
REGA0 EQU 00H
REGE0 EQU 01H
REGL0 EQU 02H
REGH0 EQU 03H
REGX0 EQU 04H
REGW0 EQU 05H
REGZ0 EQU 06H
REGY0 EQU 07H
;
REGEA1 EQU 08H
REGHL1 EQU 0AH
REGWX1 EQU 0CH
REGYZ1 EQU 0EH
;
REGEA2 EQU 10H
REGHL2 EQU 12H
REGWX2 EQU 14H
REGYZ2 EQU 16H
;
REGEA3 EQU 18H
REGHL3 EQU 1AH
REGWX3 EQU 1CH
REGYZ3 EQU 1EH
;
FLAG1 EQU 20H
F_CPUMP EQU 0 ; PLL CHARGE PUMP FLAG, 1=800uA, 0=400uA
F_TXMUTE EQU 1 ; PLL TX MUTE FLAG, 1=MUTE
F_RXMUTE EQU 2 ; PLL RX MUTE FLAG, 1=MUTE
F_TXRF EQU 3 ; PLL TX RF FLAG, 0=TX ON
FLAG1H EQU 21H
F_RXRF EQU 0 ; PLL RX RF FLAG, 0=RX ON
F_REFOSC EQU 1 ; PLL REF. OSC. FLAG, 0=REF. ON
F_AF EQU 2 ; PLL AUDIO FLAG, 0=AUDIO ON
F_BATT EQU 3 ; PLL BATT DETECTOR FLAG, 1=BS
;
BLK_MSGCNT EQU 26H ; blink message timer
;
;OLD_SECL EQU 24H ; old security code buffer (low byte)
;OLD_SECH EQU 26H ; old security code buffer (high byte)
;
T2MS_BUF EQU 28H ; 2ms timer buffer
;
TIMERFG EQU 2AH ; timer flag
T2MS EQU 0 ; set for every 2ms
KYSCN_EN EQU 1 ; enable keyscan for every 20ms
BLK_TKLED EQU 2 ; to enable blink In-use led
BLK_CHLED EQU 2 ; to enable blink CHARGE led
TIMERFGH EQU 2BH ; timer flag
LPTMR_EN EQU 0 ; set if loop timer expired
T_RECRAD EQU 1 ; set if recradle time is arrived
T1S EQU 2 ; set for every second
;
TMP_BUF EQU 2CH
MUTE_TMR EQU 2EH ; mute timer buffer
;
BLK_TKTIME EQU 30H ; In-use led blink time buffer
BLK_TKCNT EQU 32H ; In-use led blink counter
BLK_CHTIME EQU 34H ; Charge led blink time buffer
BLK_CHCNT EQU 36H ; Charge led blink counter
;
LOOP_CNT EQU 38H ; loop counter
T100MS_BUF EQU 3AH ; 100ms timer buffer
;
KEY_FLAG EQU 3CH ; key flag
LONG_KEY EQU 0 ; set if long key is pressed
;
KEYHOLD_CNT EQU 3EH ; key hold counter
T1S_BUF EQU 40H ; 1 sec. timer buffer ; 1 nibble
;
LINEFG EQU 42H ; line flag
DIALLING EQU 0 ; set if pulse dialing in process
OFF_HOOK EQU 1 ; set if break the line
FLASH_LINE EQU 2 ; set if flash is activated
;
PAGE_CNT EQU 43H
;
TIME_FLAG EQU 44H ; time control flag
PAUSE EQU 1 ; set if pause func. is activated
TIMER2FG EQU 2 ; set if 45ms timer is underflow
BLINKFG EQU 3 ; for testing
TIME_FLAGH EQU 45H ; time control flag
T20MS EQU 0 ; set if 20ms is arrived
TIMER3FG EQU 1 ; set if page timer is expired
T10MS EQU 2 ; set if 10ms is arrived
T4MS EQU 3 ; set if 4ms is arrived
;
COMBO_FG EQU 46H ; control flag
MUTE_REQ EQU 0 ; set if combo muting is requested
MUTED EQU 1 ; set if combo has been muted
EXTEND EQU 2 ; set if extend current channel scan
LED_STATUS EQU 3 ; in use led buffer
;
DIAL_FG EQU 48H ; dial flag
DIAL_OVER EQU 0 ; set if wdial_ptr override rdial_ptr
BUFFERFULL EQU 1 ; set if dial buffer is full
FIRSTKEY EQU 2 ; set if first key has been pressed (for reset dial pointer)
;
RXFG EQU 4AH ; rx status flag
RXD_STATE EQU 0 ; store the rx data state
FIRST_LOW EQU 1 ; 1st low occured flag
SYNC EQU 2 ; set if valid sync bit is detected
PREAMBLE EQU 3 ; set if valid preamble is detected
RXFGH EQU 4BH ; rx status flag
DATA_RCVD EQU 0 ; set if 16 bit ID + 8 bit data rcvd.
VALID_BYTE EQU 1 ; set if 1 valid data byte is rcvd.
;
TXFG EQU 4CH ; tx data flag
S_PREAMBLE EQU 0 ; set if send preamble bits
TXEN EQU 1 ; set if enable transmit data
RETRY EQU 2 ; set if resend data is requested
TX_DISABLE EQU 3 ; set if send cmd. is disabled
TXFGH EQU 4DH ; tx data flag
S_DUMMY EQU 0 ; set if sending dummy stop bits
TX_CONT EQU 1 ; set if send code continously
TX_CID EQU 2 ; set if sending CID data
TX_START EQU 3 ; start sending tx data
;
MODEFG EQU 4EH ; operation mode flag
TALK_MODE EQU 0 ; set if talk on mode
CHGCH_MODE EQU 1 ; set if change channel mode
CHGSEC EQU 2 ; set if change security code
PAGE_MODE EQU 3 ; set for SHORT PAGE mode
MODEFGH EQU 4FH ; operation mode flag
LONG_PAGE EQU 0 ; set for LONG PAGE mode
TEST_MODE EQU 1 ; set if enter test mode
;
LINKFG EQU 50H ; link flag
;LINKREQ EQU 0 ; link up connect is requested
WAIT_CHNUM EQU 1 ; wait for H/S new channel number
CH_SCAN EQU 2 ; set if enable scan channel
CONNECTED EQU 3 ; set if H/S ACK code has been rcvd
LINKFGH EQU 51H ; link flag
FIRST_CONN EQU 0 ; set if 1st ring request connect
CONNECTING EQU 1 ; set if connect command has rcvd
CON_SCAN EQU 2 ; set for connect scan enabled
;
RING_FLAG EQU 52H ; ring flag
CHK_RING EQU 0 ; set for enable ring check routine
RING_VALID EQU 1 ; set for valid ring period
RING_OFF EQU 2 ; set for valid ring off period
RING_STATE EQU 3 ; ring state (H:ring on,L:ring off)
RING_FLAGH EQU 53H ; ring flag
RING_STOP EQU 0 ; set if ring stop is detected
RING_ON EQU 1 ; set for valid ring on period
RNG_START EQU 2 ; set for every ring on cycle starting
RNGON_START EQU 3 ; set for every valid ring on start
;
CHK_FLAG EQU 54H ; check flag
SHORT_PAGE EQU 0 ; set if page key is pressed < 2 sec.
;LONG_PAGE EQU 1 ; set if page key is pressed >= 2 sec.
DEBOUNCE EQU 2 ; set if 20ms debouncing is requested
CRADLE_STS EQU 3 ; set if H/S off cradle
CHK_FLAGH EQU 55H ; check flag
HW_RESET EQU 0 ; set if hardware reset to enable chg. sec. code
FIRST_RING EQU 1 ; set for first ring start
KEY_HOLD EQU 2 ; set if key is hold pressed
;
STSFG1 EQU 56H ; status flag 1
F_TONESOFT EQU 0 ; set - tone mode, clr. - pulse mode
F_TONEMODE EQU 1 ; tone/pause switch status
DTMFOFF EQU 2 ; set if 100ms is expired
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -