📄 psocgpioint.lis
字号:
0000 ;-------------------------------------
0000 ; Return Values
0000 ;-------------------------------------
0000 NOERROR: equ 0 ; Successfull completion
FFFFFFFF FAILURE: equ -1 ; Error condition
FFFFFFFE STACKOVERFLOW: equ -2 ; Error Stack Overflow
0000
0000
0000 ; end of E2PROM_1.inc
0000
export calllogger_GPIO_ISR
0000 calllogger_GPIO_ISR:
0000 //push A
0000 //push X
0000 //and reg[INT_MSK0], DFh ;This will be enable the GPIO
0000
0000 5800 mov X,[indexreg]
0002
0002 5D04 mov A,reg[PRT1DR]//Checking Port1_0 if any DTMF is received?
0004 2101 and A,01h
0006 A050 jz no_button_pressed //Probably phone is closed or noise generate an interrupt.
0008
0008 //Button pressed,check if it is the first button.If yes then
0008 //date and time will be recorded for the first button action
0008 3C00FF cmp [tel_status],FFh //If it is not FF,this means this will be the
000B //first button , first button will
000B //make tel_status=FF which means telephone is
000B //in-use.
000B A02B jz continuetorecord //Continue to record the other buttons
000D
000D //First button is now pressed,the date and time will be recorded.
000D //tel_status will be FFh
000D firstbutton:
000D 5800 mov X,[indexreg]
000F
000F 5100 mov A,[month]
0011 5400 mov [x],A
0013 75 inc x
0014
0014 5100 mov A,[day]
0016 5400 mov [x],A
0018 75 inc x
0019
0019 5100 mov A,[hour]
001B 5400 mov [x],A
001D 75 inc x
001E
001E 5100 mov A,[minute]
0020 5400 mov [x],A
0022 75 inc x
0023
0023
0023 5D08 mov A,reg[PRT2DR]
0025 210F and A,0Fh
0027 6A rlc A
0028 6A rlc A
0029 6A rlc A
002A 6A rlc A
002B 5400 mov [X],A
002D 5500FF mov [tel_status],FFh //Telephone is in use.
0030 550001 mov [odd_even],01h //Each byte area in ram will hold two dtmf codes.
0033
0033 9000 call PWM16_2_EnableInt//Time elapsed will be determined in seconds.
0035
0035 //jmp no_button_pressed //Check if a sudden hang up occurs?
0035 80AE jmp end
0037
0037 continuetorecord:
0037 5D08 mov A,reg[PRT2DR] //Capture DTMF
0039 5300 mov [temp],A //Save it temporarily
003B
003B 7600 inc[odd_even]
003D 470001 TST [odd_even],01h //Checking if odd_even value is odd or even
0040 B009 jnz nextbyteloc //It is odd.New DTMF code will be written to next byte location
0042
0042 5100 mov A,[temp] //Load captured DTMF to accumalator A
0044 210F and A,0Fh
0046 0500 add [X],A
0048 809B jmp end
004A //jmp no_button_pressed
004A
004A nextbyteloc:
004A 75 inc x
004B 5100 mov A,[temp] //Load captured DTMF to accumalator A
004D 210F and A,0Fh
004F 6A rlc A
0050 6A rlc A
0051 6A rlc A
0052 6A rlc A
0053 5400 mov [X],A
0055 808E jmp end
0057 //jmp no_button_pressed
0057
0057
0057
0057 no_button_pressed:
0057 //No dtmf tone is pressed
0057 //check if phone is closed
0057 5D00 mov A,reg[PRT0DR] //Checking if phone is closed?
0059
0059 60FA mov reg[ 0xfa], a ;Save data in non-io register
005B 5DFA mov a, reg[ 0xfa] ;Synchronized read back into a.This is for preventing the system from
005D ;invalid memory reference errors
005D
005D 2101 and A,01h
005F B084 jnz end //Phone is still ON
0061
0061 ;Resynchronize data in pod and ICE
0061
0061
0061 phoneisclosed:
0061 3C00FF cmp [tel_status],FFh ;Is the phone was open before?
0064 B07F jnz end //No it was not in use
0066
0066 5800 mov X,[indexreg]
0068 //at least one dtmf is captured
0068 9000 call PWM16_2_DisableInt //Time is calculated.Stop calculating time because phone is closed.
006A 75 inc x
006B 5100 mov A,[te_minute]
006D 5400 mov [x],A
006F
006F 75 inc x
0070 5100 mov A,[te_second]
0072 5400 mov [x],A
0074
0074 75 inc x
0075 50FF mov A,FFh
0077 5400 mov [x],A
0079 75 inc x
007A
007A 550000 mov [tel_status],00h //Telephone is closed.
007D 550000 mov [te_second],00h
0080 550000 mov [te_minute],00h
0083
0083 //If the 64 byte block is filled then it will be transferred to FLASH
0083 5B mov A,X
0084 113F sub A,63
0086 C05D jc end //64 byte block has not filled yet.
0088
0088 initializeflash:
0088 060040 add [address_lsb],40h
008B 3C0000 cmp [address_lsb],00h
008E B00B jnz readytowrite
0090 7600 inc [address_msb]
0092 3C003F cmp [address_msb],3Fh
0095 B004 jnz readytowrite
0097 //Led will be ON showing that there is only 256 byte remain.
0097 620810 mov reg[PRT2DR],10h //port2_4 will be 5V
009A
009A readytowrite:
009A 3C0040 cmp [address_msb],40h
009D B008 jnz write
009F 3C0000 cmp [address_lsb],00h
00A2 B003 jnz write
00A4 8005 jmp writeandresetaddress
00A6 write:
00A6 9000 call writeflash
00A8 8012 jmp transferRAM //Bytes will be transferred to first 64 byte block
00AA writeandresetaddress:
00AA 55003F mov [address_msb],3Fh
00AD 5500C0 mov [address_lsb],C0h
00B0 9000 call writeflash
00B2 55000F mov [address_msb],0Fh
00B5 5500C0 mov [address_lsb],C0h
00B8 620800 mov reg[PRT2DR],00h //port2_4 will be 0V
00BB
00BB transferRAM:
00BB 3C3FFF cmp [63],FFh
00BE B007 jnz transfer
00C0
00C0 no_transfer:
00C0 9000 call clearRAM
00C2 5700 mov X,00h
00C4 801F jmp end
00C6
00C6
00C6 transfer:
00C6 9000 call clearRAM
00C8
00C8 573F mov X,63
00CA 5500FF mov [temp],FFh
00CD .loop:
00CD 7600 inc [temp]
00CF 75 inc x
00D0 5200 mov A,[x]
00D2 10 push x
00D3 5300 mov [temp2],A //temp2 holds the value of higher 64 byte block
00D5 5800 mov X,[temp] //Index register will show the first 64 byte block
00D7 5400 mov [x],A //The value in higher64 byte block is transferred to first block
00D9 20 pop x
00DA 3D00FF cmp [X],FFh
00DD BFEF jnz .loop
00DF
00DF 5800 mov X,[temp]
00E1 75 inc X
00E2 8001 jmp end
00E4
00E4
00E4 end:
00E4 5A00 mov [indexreg],X
00E6 //or reg[INT_MSK0], 20h ;This will be enable the GPIO
00E6 7E reti
00E7
00E7
00E7
00E7
00E7
00E7
00E7
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -