📄 cid.asm
字号:
Demo_CID_2_DTMF_DB .section 'data'
; define the constant values and variables to receive DTMF CID
; ================================================================================================
; ====== define the output valus of the HT9170 data bus ==========================================
; ================================================================================================
DTMFCode_1 equ 001H ;1_697_1209
DTMFCode_4 equ 004H ;4_770_1209
DTMFCode_7 equ 007H ;7_852_1209
DTMFCode_E equ 00EH ;*_941_1209
DTMFCode_2 equ 002H ;2_697_1336
DTMFCode_5 equ 005H ;5_770_1336
DTMFCode_8 equ 008H ;8_852_1336
DTMFCode_0 equ 000H ;0_941_1336
DTMFCode_3 equ 003H ;3_697_1477
DTMFCode_6 equ 006H ;6_770_1477
DTMFCode_9 equ 009H ;9_852_1477
DTMFCode_F equ 00FH ;#_941_1477
DTMFCode_A equ 00AH ;A_697_1633
DTMFCode_B equ 00BH ;B_770_1633
DTMFCode_C equ 00CH ;C_852_1633
DTMFCode_D equ 00DH ;D_941_1633
; ================================================================================================
; ====== define the variables to receive the DTMF CID ============================================
; ================================================================================================
StartReceiveDTMFCode dbit
; 1 ==> the DTMF CID has been received(one DTMF Tone Code has received at least)
Receive_DTMFCID_Ok dbit
; 1 ==> the DTMF CID message is ending
Demo_CID_2_FSK_DB .section 'data'
; ================================================================================================
; ====== define the constant values and variables to receive FSK CID =============================
; ================================================================================================
FSK_Packet_Data equ temp[0]
; this variable is used to store the FSK_packet_data of the FSK decoder
; it shared the same RAM byte with Temp[0]
; the followings are the parameter type of the FSK MSDF CID message
FSK_80H_Date_Type equ 01H
FSK_80H_TEL_Type equ 02H
FSK_80H_TelAbsent_Type equ 04H
FSK_80H_Name_Type equ 07H
FSK_80H_NameAbsent_Type equ 08H
FSK_80H_Visual_Indicator equ 0BH
; the followings are the index of the CID_RAM_Area, which is used to store the received CID
Error_Message_Index equ 1 ; the "Error Message" is stored from this index of the CID_RAM_Area
Parameter_Message_Index equ 1 ; the "Error Message" is stored from this index of the CID_RAM_Area
Date_Time_Index equ 2 ; the "Date and Time" is stored from this index of the CID_RAM_Area
Month_Index equ 2 ; the "Month " is stored from this index of the CID_RAM_Area
Day_Index equ 3 ; the "Day " is stored from this index of the CID_RAM_Area
Hour_Index equ 4 ; the "Hour " is stored from this index of the CID_RAM_Area
Min_Index equ 5 ; the "Min " is stored from this index of the CID_RAM_Area
TEL_Index equ 7 ; the "TEL number " is stored from this index of the CID_RAM_Area
Name_Index equ 16 ; the "Name " is stored from this index of the CID_RAM_Area
; ================================================================================================
; ====== the following are the common declarations for the caller ID function ====================
; ================================================================================================
CIDRAM_TOP_Bank equ 2
; define the first bank of the CID_RAM_Area
CIDRAM_Bottom_Bank equ 10
; define the last bank of the CID_RAM_Area
CIDdataIndex equ temp[4]
; The new received CID message are store to the Received_CID_mp0, which length is 32 bytes, temporarily.
; This variable points the RAM byte of the CIDdataIndex which will store the next received CID data
Read_Unread equ Receive_DTMFCID_Ok
; the new received CID message should be compared with the CIDs of the CID_RAM_Area
; 1 ==> be compared with read CID
; 0 ==> be compared with unread CID
oldest_mp0_bp equ HTK_DTMFCode
; this byte is used to store the BP and MP1 of the CID_RAM_Area, which with the most ancient Date
; high byte: address, low byte: RAM bank
OldestMonth equ temp[5] ; the Month value of the most ancient Date
OldestDay equ temp[6] ; the Day value of the most ancient Date
OldestHour equ temp[7] ; the Hour value of the most ancient Date
OldestMin equ temp[8] ; the Min value of the most ancient Date
CMonth equ temp[9] ; the Month value of the current time
CDay equ temp[10] ; the Day value of the current time
CHour equ temp[11] ; the Hour value of the current time
CMin equ temp[12] ; the Min value of the current time
TempMonth equ temp[13] ; the Month value to be compared
TempDay equ temp[14] ; the Day value to be compared
TempHour equ temp[15] ; the Hour value to be compared
TempMin equ temp[16] ; the Min value to be compared
Too_Long_Digit equ temp[15]
; non zero data ==> the length of the telephone numbers exceed 16(excluding 16)
Received_FSK_Date_No equ temp[16]
; in the data structure of the Received_CID_mp0, no any byte is used to record the length of the Date
; this byte is used to record how many data of the date should be received
MaxRecordMessage equ (CIDRAM_Bottom_Bank - CIDRAM_TOP_Bank + 1)*6
; how many CIDs should be store to the CID_RAM_Area
Temp100 equ StartReceiveDTMFCode
HTK_SoftData .section common 'data'
;================================================================================================
;===== All the byts declared with "db" or "dbit" share some of the RAM address of SoftCID ====
;================================================================================================
NoUse50 db 13 dup (?) ; don't use this area
NoUse51 db 23 dup (?) ; don't use this area
SoftFSKBit_TCounter0 equ Temp[2] ; used to time if the FSK decoder is timeout
SoftFSKBit_TCounter1 equ Temp[1]
SoftFSKBitCount db ?
; To count how many data should be sampled in this FSK Bit data
SoftFSKBitTimeout dbit ; timeout is occurred while the FSK is decoder by software
CIDTimeOut1 db ?
; The Timer1 IRQ of the "Main" program is generated per 10ms.
; This variable is decreased by one in the Timer1 IRQ,
; it could be used as the timer to receive the CID message.
FSK_Total_Length db ?
; how many FSK data should be received, this is the FSK Message Length
FSK_type_Length db ?
; how many FSK type data have been received,
; this data could be date, phone number or name
MaxFSKByte db ?
; after the FSK CID preamble 55H is received,
; the FSK Message Type(04H, 06H, 80H, 82H) should be received within 255 FSK Packet Data
; this byte is used to count the FSK packet data
ReceiveWhyAbsent dbit
; 1 ==> the parameter(why absent) has been received
; 0 ==> the parameter(why absent) has not been received
WaitingMessage dbit ; For FSK_82H and FSK_06H command
; 1 ==> the message is leaving in the SPCS(Stored Program Controlled Switching System)
AbsentReason db ?
; define the reason of the absence
; 1 => the reason of absenceReason is detected
FSK_TooShort equ AbsentReason.7
WhyAbsent equ AbsentReason.6
ErrorMessage equ AbsentReason.4
TEL_OutOfArea equ AbsentReason.3
TEL_Private equ AbsentReason.2
Name_OutOfArea equ AbsentReason.1
Name_Private equ AbsentReason.0
FSKType db ? ; for multiple data message format
; this variable is used to denote which parameter type of the FSK data is receiving
FSK_Date equ 0
FSK_TEL equ 1
FSK_Name equ 2
FSK_TelAbsent equ 3
FSK_NameAbsent equ 4
FSK_Visual_Indicator equ 5
; = 00000001B ==> FSK Date 01H
; = 00000010B ==> FSK TEL 02H
; = 00000100B ==> FSK Name 07H
; = 00001000B ==> FSK TEL Absent 04H
; = 00010000B ==> FSK Name Absent 08H
; = 00100000B ==> FSK Visual_Indicator 0BH
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -