?????????°?????????÷
×÷???????? ?????????? ?ü???±???? 2006?ê01??18??
??????±????÷???é???????????????úAT89C51???????à?????????????·MT8870?????????¨?????°???·???????????à?·?????????÷???????????????????é???à?ù????????±????????ó??×????????é?????°????????????·????????????????÷?ò?????ü???ù???÷???????è±???
???ü???????°????????????±à??????
21???????????±?ú???÷?????????????????????à???÷????????×???1876?ê??Alexander Graham Bell?¨±?????·??÷???°???????????÷?ú?????°????·???·?????????
?????ê???????ú?????¨???°?????????????????????ì?????¤??1997?ê8?????????°?????ú×?????????1??????????????????????????????1999?ê7?????¨???°???§×???????1???§??
???ú???°?????????????ú?????°??????????×é?????ü?????????????????ó??????????????????·???????
???????????¨?????¨????????±??????????????¨?à????????????????·????????????????????????????ì?????????ù?¨??????????????????????????????????????±??????????????à??????????????????????±??????????????¨????????????×??????ì???????????????????????????è????ר?????????????????????????ì?????????ù?¨?????ò???à???ù??????????????·??????????????¨?¨?????????????ù???????°????????·????????¨·??????¨????????????????????·?????????????????±????ù??????±????÷?ù??·??§?????ò?????????à????????????·??§???????ù???????°????????·????????????????°??????×????????è?????????????×??????????×??°?????????ú???????????????à???ù±???????????????·?????????·???×÷???ó??????·?????×÷??????±????±????????????±???????????????
???°????×÷??????????????????????????·????à±????????????¨?????????????è????ר??????????????????????????×?????±??????????????????±?????????°???·?÷??????????????·??????????????°?????ò???????à?????????????????????ú????
???°?????¤?¨?????????ò???????????ó?ó?????????????°???????????ü?ó??????????×÷???????¨???÷???á???????±???????????ó??????????????????????????????×÷?????°???????????????°??????×????????????????????????é???×?????ò???à???????????????????????????ú?????????¨?????à?????????ê???????????°????·????????¤?¨????????±?×÷?·???????????????????????ó???????????????ú?????????????????????á??????????????????×÷???á???°??????·?×?????????·?????????????×÷???????°?±????????·??????????ú?·????????????????????????±?×÷?·???÷???????????÷?????????????á???????°???????????????ú???é??????????±?×÷?·???÷?????÷???????÷??±ê×???????×????ú??????±ê×????????ó???ú?·???á???????????ù????
×÷?·?????????°??????????·??????????????ú?·????·?????????±????????????°×°???????????????????????????????????ù???????????????·?????ü???÷????????????????????????×÷?·???ù??????????????????????·?±?????????:????????????×÷????????·??????á??±?×÷?·?????????¨????????±??¤???????·?????????ù?????????????????????????????????·???÷?????????±??????????????????·????????÷????·?±??????ì???á???????????????÷?·???????????????÷???????????·???ù?ì???à????????×??????????·???¨?±???¤?¨????×????÷???????ú?ò???¨???°???????????¨?±?á???÷??????????±?×÷?·?????????????¤?§?ó????×????????????ì?ò??
??
?????? ×????è??
???°?????????÷???????ú?????÷????·????????÷???????????í????????????×÷?????????÷???????????????ê???????÷?????????????????????·?á???????ú?????°????????????????°ü?¨???÷?ì?????????ú???????????ì??????????DTMF??±????°?????á?????·?????????í?ò??????1.1?ù??
??1.1
?????á?????·????×÷?·????×é????·???????????±?×°?????ì????×÷?·???á???????????ò?ú?ú???????á?????·???????ú???????ú?ú?à?????á?????á???????¨??·??????··????????°??????????????×÷???????÷????×÷???????????????????±???????????????????????·????×????è???±??????????????·??????????????????°?ù???????¨???????????????????????°????±??????????????????????????????????????????ú?·????????????
±????????????????????·?¨?????ì?????????????ú??????·????????????????????????????????????????ú???????é????????????????????±?????????×??ò???????·??×?±????????·???????????ê??????????±??????????í?à?????í?????????????????????????°?°??
±?×°???????????°?ú???????????á?°?ì?????°?ú???????????????§?¨???ì???????°?ú???¨±?×°???ù?????????????°???????¨???????????ú?ò???°?ú·?????????????±?×°???????ì?????????????????????ì???ó????????×??????ú???????????ì???????????·?ó????±????????÷?????ó???????ò?????????????÷???ê???ó·?????
?????? ?????è????????·???
2.1 ×????è??·???
?ù?????°???????????????????????è?????ó??
?? ?¨?????°?????ì???????÷?????????¨??/??????
?? ?????÷????????×????????????ú??
?? ?????÷?è?????????é??
???è????????±??????????????????????é??
?? ?????ì??????????
?? ×????????ú??
?? ???????é??
?? ??????????????
?? ????????????????
?? ????????·?????
?? ???????÷??????
?? ???÷×????é????
?? ?????ì????
?ù?????°?ú???????ú·??????????????????°???°???÷??×????????????ó?????á???????é?????????????????????é×÷???í???ò????????????·??¤????????????
?í?????????ú?ù·??????÷???????????????¨???í??±à??????±??????¨???????ú·????????????????ì?????????????±?????????????????????????????????ê??????????±??????????????????????????ò???á???è????·??????????????????????????????ì?????????ì???????????????????????????é??
×????????ú?????÷??????±??????????????????·????????
?????????????????????????????é????????????????????????·????????÷×????é???????????é?????í??±à??·?????±????????·?ò?????à?????????????×??
×????ù???????è?????????ì????×????????ú?????????÷?????????????????????é???????????·???????????????????????????é????????????????????·????????÷×????é???????????é?????í??±à???ê????
?????????????°?í???????????????··?±?????????·?????
2.2 ???????é
±?×÷?·???????ó???????????·?ê????·????????é??????????????·????????????·?????????????¨?????????????·????±??????????¨????
2.2.1×????????ú
?ò?????????°?????ú?????°???ú???ì???????°?????·???÷????±??ó????30mA?????÷???????ú?ì???????·???÷±??ó?????????°?ú???????ú??×????????ú???·?????¨???????ú?????????????÷?????????????÷?????????????????ó??300??????×è???????°?????????????ê???????????ú??
2.2.2?????????ì??
?±???§±??????±?????°?????ú·??????÷????????????25??3·ü???????¨???????§?????ó??10%?????????§??90??15V????????5????????????1??????4???????ù??????????????±??????????????????????????????????????????????????ó???????????????÷????????????????×????????????????÷???????¨?????±?¨?±?????????¨??????RC???·???????¨??????±ê×???·??¨??·??¨???????????±?????????????ú???????????÷?????????ê?????????????ì????????????????
2.2.3???????÷
????·?±????ò?????¨???????ú?????à?·?????÷?????????????????????·?????????ì??????????????????
2.2.4??????????
????·????????????????ü???ü???¤×÷?é???±?????¨????????????????????·????ó???????××???????·??????????°×¨??????????±à????????????????????????????????????±?????????????·?·¨?????????????·???????§???·?ò??????????????????????ר?????????·????????????×????????????????????????????±??±??????ú????????°??????????°??????±à???????????·??8870??8880??8888????????·??????¤±??????????¨????????????????????MT8870???ê???????????é??????MT8870???ê???é????????±?±¨??????????·???
2.3 ?í?????é
????±??????????¨????AT89C51×÷?????????????ú??????????????AT89C51???é???????????????????ê??×?????????±?±¨??????????·???
2.3.1??????????
±?????????????AT89C51???????????÷??????????·?????????????????????????????
2.3.2?????ì??
±????????????????????????±?ò?????????ú???????????÷????????±????é????·??????????±???§???????????±?ò???????ú°????????????????í???????é?????????ó??????·¨????±?????????·??à???????ù???????????????ì??????????
2.3.3 ????·??????í
±??????????????é±í·??????????????ò???????????????¤????????????????????CASE????????
????·????ó????????×??????????????ó???????????????ê????????·??????????????????°?????????è???ù±?·????????é?????????ê???è???????ù???ó???????ù±??????? ?????? ???????????·?è??
3.1 ?????ì?????·
?????°???·???????÷?°?????°???·?????°?????ú?á???ó??48V???±?÷???????±???§±??????±?????°?????ú·??????÷????????????????25??3·ü???????¨???????§?????ó??10%?????????§??90??15V????????5????????????1??????4??????
??±????·?ì?????÷?????±???????????ì??×??????????????ó???????ú??±????????ú????×??????????ú??
??3.1
???í???÷??
???°?????????¨??????C1???±??D1????????????R1???÷??×è???????????????÷4N25????????1????C1??D1??R1????×é??????????±??????·???ü?????????????????÷???á???ó?????ó?????????????÷??±??¤×÷?????????????÷4N25??????????×÷?????????????÷???????????????????÷?????ü??°?????·??????????????????????????·??????????????????????????????????????????????????·???????????????????????????????????????
?????????÷??????×??????í???????????ü??????????·??????¨?????à?????????????????????¨?????à???????????????????????????????????????????????????????????????????????????????????????????????????ò????
?????????¨??????4N25??4???????????????¨??R2??C2????×é?????¨???·????????????????????T1???ù????±?????·??¨??????????·??ò?÷?????????????????úAT89C51??T0/P3.4????????·?????????????????????5???ú?úT0???????????????÷???????ú???ê?????????ì????
???÷????????
1??C1???±???????ò?????????±?÷????????????????????????????????????±????????ò??????1??F????100V???????????¨??????????????±?????????2??F????60V???????????????à???ú????????
2??D1??????????????????36V??????????????
3??R1??4N25?????÷??×è????33 k????
4??IC1?????????????÷4N25??
5??R2??C2????×é???????????????¨???·???ù?????°????????????±ê??????25Hz???????¨??1???¨??4????????=RC????????0.02??????4?¨S??????????????????????????????·??¨?¨????????3.2?ù?????????ó????R2=10k????C2=100??F????=1s??
??3.2
6??R3??D3????×é??????????????R3=100????D3??????5mm·???????????
7??T1??R4×é?????????????·??T1????9013???ù??·??????í??74LS04???????????§????R4??2.9 k????
8??·??ò?÷??74LS04??????×é·??ò?÷×é?????????÷×÷????
3.2 ?????????ú???·
?è???÷?????·??
?ù???ú??????±ê×????¨?????????????°?ú?????ú×??????±?÷??×è????300???????°R?±?ü????×????°?ú?????ú×????±?÷??×è????350?????????ú×??????????????÷??5??A??
?±???§???ú?±?????°?ú?¨????????????300???????????????????°?????·?÷????30mA?????÷???????ú?ì?????????÷?ó±????????÷·????????????·????±???????·ü???±?÷???ê????????
?ù????????????±ê???????????ú???·?è??????3.3?ù????
?????????ú???·?÷?????????????????????·?????????÷?????????????÷???????????°????????200????×è???????ú???????????ú?¨????TXD/P3.1??±???????????????????????·??ò?÷????·?????????D1???????ú?????±??±???????T1???ù??????????T1???????¨×??????????????????÷J1??J1????×èR3???????°?????????ò??R3????×è??200?????????·???÷±??ó?????????·?ò?????ú·??????????ú?????????????ú?ì?????ú???????ê?????°???·???¨?????????·?ê??×??????????ú??????
??3.3
?ù???è?????í?????÷????????????
1?? ·??ò?÷??74LS04??????×é·??ò?÷??
2?? R1?????ú?????????÷±??¤??×è????220????
3?? D1?????ú??????????5mm????·???????????
4?? R2???????????÷??×è????2k????
5?? T1???????????????????????????÷??×÷??????9013??
6?? D2???????????????÷·??ò±??¤??×÷??????4001??
7?? J1???????÷????????????JRC 4001F(DC5V)??
8?? R3?????ú??×è????200????
3.3 ??????????
???í?ò?é??
?????à??DTMF???????????·??MT8870?¨?ò?é?ê?????????÷????????MT8870??????????3.4?ù?????ü??2??3????????×????°?ú???????à?????????????????à???????????????????????????¨?÷?????????????????????ó???°??·??ó?ó?????????????¨?÷??????????????°???????????????·????????????????????¨?÷??·ù???ì???÷???????????????·????????×??????ó?????????????????¨11~14?????????à??????8421????MT8870????????????Q4 ~ Q1????AT89C51??P1????P1.4 ~ P1.7??CPU??P1????±?4???ú???????°°??ü???à???????¨Q4~Q1????????????????????A??B??C??D 4??°??ü??±??±×÷R/P??REDIAL??HOLD??HANDSFREE????????????×??????è????±????????????????°0?±??????MT8870??????8421????·????°0000?±???????°1010?±???í?????°*?±???°#?±×???????MT8870??????8421??·?±????°1011?±???°1100?±??????????×????á?????í?ó??°ü?¨±????¨???????á???ù???????????é????????????????????×é?????ó????°??????????????????ò?±???????????????úAT89C51???????§??????MT8870??STD???§????·??à?ó??CPU??/INT0???????±MT8870???????§?????à???????ó??
??3.4
STD????????±???????·??à??????CPU?ì???ó??????P1?????????§???????ú?????????§?????????????¨???°???·?????????????????????????????á????MT8870??STD??±???????DTMF?????÷?????§???·????3.4?ù???????????????????????????????????????¨??×÷?????????????????????????ù??????????MT8870?????????????????í?????±??????MT8870??STD????????±?????????°ì·¨??????STD??????·???????????????·??????í???????????????¨??????P???±STD???§?¨????????·????±??P = 1?ò/INT0??????±???P = 0?±?ò/INT0???????í??
±????????÷????±í??
1?? D1??D2??D3??D4????×é?????÷???·??????4001??
2?? R1??R2????????????×è????100K??,C1???±????????0.1??F??
3?? ?????????§??????3.579MHz??
4?? IC1??????????????????????MT8870??
5?? C2????0.1??F??
6?? R3????????????×è??????100K????
7?? ·??ò?÷????74LS04????×é·??ò?÷??
3.4 ???????á?????·
???í???÷??
????·?±?±???????????????±????è???????????á???????·??????3.5???×???????¨????????????·????°????????????
1?? ?ì1?ù????????500Hz??????????????
2?? ?ì2?ù????????500Hz?????????è???????????÷????
3?? ?ì3?ù????????500Hz??????????????/????
4?? ?ì1?ù????????1000Hz???ê????×÷??
5?? ?ì3?ù????????1000Hz???????í?ó??
?????????????ú89C51??RXD/P3.0????????????????×é·??ò?÷???????÷??????????·??ò?÷???????????????¨???±?¨?±????·??¨???á?????????????±????C1??????????·??ó???????·LM386N-1??????????????LM386N-1??·??ó??????????????????C5??±????÷T1???ü??????????ר????????±????÷??????·???×è???????????ó??
±????·±???????????????±????÷T1?????????ò?????°?????±?÷????±????????????????÷?????????????????á?°?ì???????????????????°???????ò??±?×°??????????????±????÷×÷???????÷????????????±????÷??×è?????????????è???????????è???????é??????×???????·??????????????ó?????????????????????°????ר??????±????÷??????????????????????????????????????·????????è?????ò?¨???÷??±????????ò???ú????????
????±????è?????ó????±?×°?????ù±??????????ê??????·????????????????á???é????????????????????????????????????????×???????·??????????????????°×¨??????±????÷??????????2????????????±????÷·??????????????????????????????????????é±í?÷????????????±????÷·???????????±??????????????ó????10mm??10mm??8mm??
????·??ó???????·LM386??????±????ò????±?×°??????????LM386·??ó??????50dB??????·?????
??3.5
???÷????????
1?? ·??ò?÷????74LS04??????×é·??ò?÷??
2?? C1???????????????????±??????×÷?????ù????100??F?????????????????????????????ó??
3?? IC1??R1??R2??C2??C3?? C4??C5????×é??????·??ó???·??IC1????LM386N-1??R1??1k????C2??10??F????????????C3??10??F????????????R2??1k???? C4??10??F????????????C5??100??F????????????
4?? T1??????????ר??±????÷??
3.5 ???÷???????·
???í???÷??
±????????·?÷?????????????????·??·??ò???·??D??·??÷???????÷???????·×é???????·??????3.6?ù????
?×?????????úAT89C51??P1????????????????????????????P1.0??P1.1??P1.2×÷??????????????P1.3×÷????????????????????????3-8???????÷???????????±?????????§?±?????????????????????÷????????°?????????????°???????????°???·??ò?÷???????÷?????????ó????D??·??÷??????????????????D??·??÷?????????????????·?????÷?????????·?????÷?????????·???÷????????????????????????????????????????×÷?????÷?????????????ù???????ê???????ú???à?·???÷??????????????°?P1????°???????×÷???????÷????????????????P2????
??3.6?ù?????????·???÷???????·??????±?×°??????????°??·???÷?????????????ü???÷?????à????
??3.6
???÷????????
1??3-8???????÷????74LS138P??
2??·??ò?÷????????74LS04?¨???????????ù??·??ò?÷??????????·??ò?÷??
3????·??÷????????4013?¨??????????????D??·??÷????
4????????????°???9013??
5??????????±??¤×÷????????°???4001??
6????????????°????ì??5mm·???????????
7???????????÷??×è????°???1k??????×è??
8?????????????÷??×è????°???2k??????×è??
9???????÷????°???JRC-4100F DC5V?????÷??
?????? ?í???è??
±????????í???è???÷??·????????????????????ì?????????????????ú????????????·??????í?????????÷?????????á??????·??????????????é?????????è??????·????????????????úT89C51?¨???í?????ò????????????????????????????????·????????????????????????è?????°???????????????é·?±????????÷??
?????÷??????
4.1 ??????·??ù??·?
±????????é?÷?????ú?ú?????á??????·?±????????????????ù?????¨???ú??·?????????20Hz??20KHz??·??§????CCITT???¨?????°?°????????????·??§??300Hz??3400Hz??????±???????????·??ù?????¨??500Hz??1000Hz??????
?÷??·????????á??????
1?? ??????±í??×°?????????ú??????????????????????????f=500Hz?????±t=0.5??/?ù??
2?????ù??????±í???????????¨?????????????÷??????????????f=500Hz?????±t=0.5??/?ù??
3?????ù??????±í?????÷???????¨?????????¨??/??????????????????f=500Hz?????±t=0.5??/?ù??
4?????ù??????±í???????????í?ó??????????????f=1000Hz?????±t=0.3??/?ù??
5?????ù??????±í???????????ê????????????????f=1000Hz?????±t=0.3??/?ù??
?á????·??ú?????????????·??·??????????ú??RXD????????·?×???????????·??¨?????? ×????ò?ú????
ORG 1100H
RING10:MOV R6??#20 ;input password
RING11:MOV R7??#20 ;800Hz
RING12
CALL DL10 ;sound=1
CPL P3.0 ;delay=0.5s
DJNZ R7??RING12
DJNZ R6??RING11
CLR P3.0
RET
ORG 1150H
RING20:MOV R3??#03
RING21:MOV R6??#20 ;password wrong
RING22:MOV R7??#20 ;1600Hz
RING23
CALL DL20 ;sound=3
CPL P3.0 ;delay=0.25s
DJNZ R7??RING23
DJNZ R6??RING22
CLR P3.0
MOV R7??#200
RING24
CALL DL10
DJNZ R7??RING24
DJNZ R3??RING21
CLR P3.0
RET
ORG 1200H
RING30:MOV R3??#02
RING31:MOV R6??#20 ;select
RING32:MOV R7??#20 ;800Hz
RING33:LCALL DL10 ;sound=2
CPL P3.0 ;delay=0.5s
DJNZ R7??RING33
DJNZ R6??RING32
CLR P3.0
MOV R7??#200
RING34:LCALL DL10
DJNZ R7??RING34
DJNZ R3??RING31
CLR P3.0
RET
ORG 1250H
RING40:MOV R3??#03
RING41:MOV R6??#20 ;control
RING42:MOV R7??#20 ;800Hz
RING43:LCALL DL10 ;sound=3
CPL P3.0 ;delay=0.5s
DJNZ R7??RING43
DJNZ R6??RING42
CLR P3.0
MOV R7??#100
RING44:LCALL DL10
DJNZ R7??RING44
DJNZ R3??RING41
CLR P3.0
RET
ORG 1300H
RING50:MOV R6??#40 ;finish
RING51:MOV R7??#20 ;1600Hz
RING52:LCALL DL20 ;sound=1
CPL P3.0 ;delay=0.15s
DJNZ R7??RING52
DJNZ R6??RING51
CLR P3.0
RET
ORG 1500H
DL10:MOV R5??#25 ;delay1.25ms??f=800HZ??fosc=12MHz??
DL12:MOV R4??#25
DL11
JNZ R4??DL11
DJNZ R5??DL12
RET
ORG 1600H
DL20:MOV R5??#12 ;delay0.625ms??f=1600HZ??fosc=12MHz??
DL22:MOV R4??#25
DL21
JNZ R4??DL21
DJNZ R5??DL22
RET
ORG 1650H
DL30:MOV R5??#50 ;delay20ms
DL32:MOV R4??#200
DL31
JNZ R4??DL31
DJNZ R5??DL32
RET
4.2 ?????ì????·?
±????????????é???ù±????í???????????????????±?ò°????????????????·??30H?????????????????????????????°5?±????R7???±???????ú?±?????ó???????????????ú°??????ó???????¨????????????????????????38H?????????????????????ó?????ú?????????????????·??????????????±??????±???ê???à??????×????????????????????????????ò??×??????í???ò??
×????ò?ú????
ORG 0150H
HOKE: CLR 7DH
SETB P3.1 ;open telephone
CLR TR0 ;close T0
MOV R2??#03H ;password wrong 3
LCALL RING10 ;input password
IN: CLR 7EH ;7EH=0
DTMF: MOV R7??#5H ;PASSWORD:5 R7
MOV R1??#38H ;sign
SETB P1.4
SETB P1.5
SETB P1.6
SETB P1.7
WAIT: JBC 7EH??CC ;wait INT0
LJMP WAIT
CC: MOV R7??#5H ;password 5***
MOV R0??#30H ;password top
MOV R1??#38H ;sign
CMP: MOV A??@R1
MOV R4??A
CLR C
MOV A??@R1
SUBB A??@R0 ;test
INC R0
INC R1
JZ AAA ;OK??pass one
LJMP QQ
AAA: DJNZ R7??CMP ;R7-1!=0
LJMP LL ;pass
QQ: DJNZ R2??IN1 ;password wrong&R2!=0
LCALL RING20
LJMP STOP
IN1:LCALL RING20 ;password wrong??try!
LJMP IN
4.3 ??????????·?
±????????¨??????????????????±????¨?????÷??????????????
???ò?ú????
ORG 1700H
KEYIN: SETB RS1 ;?±?°?¤×÷?????÷?????¤×÷??
CLR RS0
ANL A,#00H ;????A?????÷
MOV B,#05H
LCALL RING10 ;·??á??????????????***
MOV R7,#5H
MOV R1,#38H
WPIN: JBC 7EH,READ ;????INT0????
LJMP WPIN
READ: MOV R1,#38H
MOV R0,#40H
MOV R7,#05H
READ1: MOV A,@R1
MOV @R0,A
INC R0
INC R1
DJNZ R7,READ1 ;??????????????·???5????·???×?READ1
LCALL RING10 ;?ú5????·??á??????????????????
MOV R7,#5H
MOV R1,#38H
WRE: JBC 7EH,KEYCMP ;????????INT1
LJMP WRE
KEYCMP:MOV R6,#05H
MOV R0,#40H
MOV R1,#38H
KEYCP:MOV A,@R0
CLR C
SUBB A,@R1 ;A???¨?¨R1????
INC R1
INC R0
JZ BBB ;A????????????0???ò??×?BBB
LJMP LL
BBB: DJNZ R6,KEYCP ;R6??1????0???ò??×?KEYCP???????·±?????????????
MOV R1,#38H
MOV R0,#30H
MOV R6,#5H
KEYREIN:MOV A,@R1
MOV @R0,A
INC R1
INC R0
DJNZ R6,KEYREIN ;R6??1????0???ò??×????????·±?????????????
LCALL RING50 ;·??á?????????????????è??
LJMP STOP
RET
4.4 ???????÷??·?
±??????×???¨?????§?????????????·???????????¨???????÷???????ù?????????÷?????ó??×?????????×????ò???¨???????ú?òP1??????????·?????????????????????±í?????????????÷??????????????×????????ò??±í?????????????????????÷?°???±??????×????ò?????ü×????ò???à?????ê????????
???ò?ú????
LL: LCALL RING30 ;sound:input control
MOV R7??#1H ;***
MOV R1??#38H
CLR 7EH
WAIT0: JBC 7EH??DD ;wait INT0
LJMP WAIT0
DD: MOV R1??#38H
MOV A??@R1
RR A
RR A
RR A
RR A
MOV R4??A
RL A
ADD A??R4
MOV DPTR??#TAB
JMP @A+DPTR
TAB: LJMP ZERO
LJMP EIGHT ;8
LJMP FOUR ;4
LJMP STOP ;#
LJMP TWO ;2
LJMP ZERO ;0
LJMP SIX ;6
LJMP LL ;**
LJMP ONE ;1
LJMP LL ;9??**
LJMP FIVE ;5
LJMP LL ;A??**
LJMP THREE ;3
LJMP LL ;*??**
LJMP SEVEN ;7
LJMP LL ;C??**
ORG 0250H
ZERO: LJMP LL
ONE: LCALL RING40 ;·??á??????????×÷???÷
OO1: MOV R7??#01H
CLR 7EH
WAIT1: JBC 7EH??WW1 ;wait INT0
LJMP WAIT1
WW1:MOV R1??#38H ;?ì?é?????×??
MOV A??@R1
CJNE A??#50H??BB1 ;?¨38????????0AH?¨0?????ò??×?BB1
LJMP ZZ1 ;?¨38??????0AH?¨0?????ò??×?ZZ1
BB1: CJNE A??#80H??QUIT1 ;?¨38????????01H?¨1?????ò??×?QUIT1
SETB P1.3 ;open 1
CLR P1.2
CLR P1.1
CLR P1.0
LJMP QUIT1
ZZ1: CLR P1.3 ;close all
CLR P1.2
CLR P1.1
CLR P1.0
LCALL RING50 ;finsh
QUIT1: LJMP LL
4.5 ??????????·?
±????????¨???????÷T0??????????·????????????????ò?ú????
ORG 0090H
TT0: SETB 7DH
RETI
?????? ?????÷??
5.1 ?????÷??
?????÷???ù?????????????÷??±í???¤????
1??IBM-PC/XT?????ú???¨???÷????50Hz?????í????25????????????
2??ME-5103?????ú·????ú??????
3??MF116?ò??±í??????
4???????ú5V??????????????
5??SR8??×????¨?÷??
6??Manley In-Circuit Emulator Debugger(MBUG)??·??í????
±?×°?????÷???÷??·????????÷?????í???÷???????ú?÷???????ó??·???
??????????·????è???ó??????×÷???????·?????±???÷???????????????????ù????????????·??????????????á?ì?????????????????????á?ò?????????????????????????·???ì?é???????????????ó?????÷???±?????í??±à???????????×???ê?????????????é???÷???????ó?????????÷?????????????????÷????·?·¨?????à?????ú?÷????×???????????·??????±????±?×°???????????ü?????í?à?????????????????×????????
?÷???????è
5.2 ???????????· 5.2.1 5V????????
±?×°????????5V?????????????????ó???÷??·????????????¨?÷????5V?????????????????????÷??·???????·?-·?????6mV??·???±?×°???????????ó???????????÷???ê±???
5.2.2 ???????ì??
??±????????·??×÷?°???????é???????????????ú????·¨?ú?ú???????????????????ê??????·????????ó?????????ê????????????±?×°???????°???????????????°?ú?????????ú???ò?°190?±?????ó???ú?????????ú?á????????????????????????????????????????????????????????????????????????·ù???????????ù??????????????????????1???¨4?????????????????????????????????±?????????????±?????ò??±í???±?÷???????????????÷4N25?????????????÷???????????????÷?????????????ì?????????ó??????????????·??????????÷ ??5.1?????±??????????????????????????·????????????????ù???????¨????C2??????????°???????1??F??????????100??F????????5.1?ù??????????????????
?ò???????úT0?ù?ì???????????????????????????§???ù????????????????????????????????T1????????????????????????????????????·??ò?÷????????????T1??????×÷????????·??ò?÷??·??ò×÷????????????????????????????????·??ò?÷???????±·?????????????????????·??ò?÷???????????????????÷?????????????¨??????????????·¨?¨??·??ò?÷??·??????ò??????·??ò?÷74LS04??????????????????????????????????????????????????·?????????·????????????±Ve=1.1V?????±·??ò?÷74LS04???????????????±???????????????±?????????????????????ù????????????·¨?¨??·??ò?÷??????·?·¨???ò????°?????????·???????????????×èR4????????20k??????5.1k?????á??????????·???????????
??±????è?????ó???????é?????????????????ú??????????±????????·?ê?????????????ì????·??÷???ê±???
5.2.3 ?????????ú
????·????÷?????????×?????·?????ó????5V?????????????????????????????÷?ü???????????????????????ú?????????ú?±???????ú????????????????·??????ú?±???????????????÷????·??ê????????????·????ú?????±·??????????ú??TXD???????????????????ú??·????????ú??·????????á???????????????????????à·?????????·?·¨??????????????????????????????????·??ò?÷?¨74LS04??????????????×÷????????????·????ú????±í?÷·??ò?÷??×÷?????÷???????????ó???????·?è???±?????????í?à?????????ó?à??????·??ò?÷?????????????????ú??·??÷???ê±???
5.2.4 ???????÷
???????÷????·??????§???????·?????×?????÷???????????????ê????????·????ú?±??????????P2?????????÷?????é?á??±í?÷P2????·¨???????????????÷??·???×???·????????ú89C51??P2????????????????????????±?????????×???????????????·?·¨??°?P2?????????÷????P1?????????????????÷?????????ó?????????????????????????????????????ó????°??·???????????????????????????÷??
????????????·???????°??????????÷?????ó3~4?·?????????????é?????ú???????????????á??±?????×°?????±?????????????¨???é????3-8???????÷74LS138??P1???????????????????????????????????????·?ê???°?????????????????????????÷???????ó??????·????????????????????????÷???????±?????·???°???·?????????÷?????????????±?????????÷?????????·???÷??????
????×???·???????·????????????ò???ù???????????????÷?????í???????¨???é???????????????????÷?????????ù???????????÷???????????÷??????????????????????×???·??ú±?????????????????????000~111????????±í?????????÷??°???×???????????3-8???????÷?????ó??????????°??????÷????????×?????????°?????????±í?ù????
A2 A1 A0 ????D0~D7
0 0 0 0 1 1 1 1 1 1 1
0 0 1 1 0 1 1 1 1 1 1
0 1 0 1 1 0 1 1 1 1 1
0 1 1 1 1 1 0 1 1 1 1
1 0 0 1 1 1 1 0 1 1 1
1 0 1 1 1 1 1 1 0 1 1
1 1 0 1 1 1 1 1 1 0 1
1 1 1 1 1 1 1 1 1 1 0
??????·?·¨????????D??·??÷???????÷±?????????×????????ù??????°??·???÷????????28=256??×?????
5.2.5 ???????ì??
???????ì???????????·????±????????????????ü???÷???÷???§??×??????à??????????8870??????????????·?????×÷???°??????????????????CM8870CPI?????????????·?÷???±?????????·?¤×÷?????????ó?????é?????????ó??????????×ó?????±???????????·?????á???????????í???é????????×????ì?é???·??·????ú?????????????÷?????·?????????·???ó????????CM8870CPI?????????ù??????????·??????¨???????????????????ò???ó?ü????MT8870DE·???±?×°???¤×÷????????????????MT8870DE?¤×÷?????ü???????????????·????·??ú?????????ó???é????MT8870DE??×??ó?????ú?÷????????????????????????????
5.3 ?í?????ò?÷??
5.3.1?í???????è??
????±????????????í?????ò?ù??????????±????à???ù???í?????ò???÷???????à?±??·????????????ò????????±à????????MBUG??±à???÷???ê??????
?×??????????????×??????????ú????MCS-51·????ú???????ú???÷????333MHz?????????????í?à???????????????????????????ù??????MCS-51·????ú??????ME-5103???????????ú??25?????????????????ò?????????????????????ú????25?????????????ì?????ú???ó?????÷°???????????25?????????????????????ò???ú????????????25????????????????????9??????????
??????°?MCS-51·????ú??25??????±???9?????????????????????????ú???ó????????????25??-9????×????????????¨??????MCS-51·????ú???????????ú??????
??????????Manley In-Circuit Emulator Debugger(MBUG)??·??í?????????±·???????????????????????Assemble?¨??±à??????????????????????Load Program???????±?á????divide overflow error???í?ó?????ó????????±à??????????????????·¨????·????ú???????é??
???????é???à×é???§??°??¨?????ú????????????????·????????????ù???????é?á??±í?÷???÷??????233MHz???????ú??????????????MCS-51·????ú?????÷??????100MHz???????ú?¨??25?????????????ù????????·??????é???ó???????é??????????×???????????ME-5103??MCS-51·????ú?????¤×÷??IBM PC/XT/AT 286/386/486???·??????
???????é?????????????ú?¨??????MCS-51·????ú?????????à???ù??????????°??????????¨?????ú??????????×é????±????í???????????????ú×???????????±à???????ò?à??????????±????à?????÷??????????·??±???ù????????×??????????ú???????ò????·¨?í?ó?¨syntax error???????÷???????????ó???????·?????¨org address is less?????í?ó??????????????????×????ò?????????·????×??????÷?????????????????í?????ò?÷???·????????????????
5.3.2?á????????
??±????????÷????????????????????·????á??±????ò?????ò???????????ò???±???÷?????×??Ctrl+F5??????????·???????·???RING1×????ò???????????ü??×????ò???????±??·??ú?????·????°???????×????ò??????????????·???????·?????????????????????????????×????ò±??í???á???????????ó????Ctrl+F8?????????ò?????????¨????????????????±?????F5?±??????×????ò??????????????×????ò????F8???????????ò??????????????°ü?¨×????ò????·???RING2????R5?????÷???????÷???ò????×÷????±ê?????????ò???????????ê???????????????ù?????????????????ò????·¨???????·×????ò???±???????????·??
???ò?ú????
ORG 1150H
RING20:MOV R3??#03
RING21:MOV R6??#20 ;password wrong
RING22:MOV R5??#20 ;1600Hz
RING23:LCALL DL20 ;sound=3
CPL P3.0 ;delay=0.25s
DJNZ R5??RING23
DJNZ R6??RING22
CLR P3.0
MOV R5??#200
RING24:LCALL DL10
DJNZ R5??RING24
DJNZ R3??RING21
CLR P3.0
RET
?ó??????×????ò????R5?????÷????R7?????÷??×????ò??????????
5.3.3?????ì??
±???·????÷??±????è???????????÷???????????????ó???÷?????????????????è?¨R5?????????????è?¨????????×÷?????????×????????????·???????????·¨???????????????ú??38H???·?????????????????ó???????ú???ú????????????????????????????×??????ú???±???ò??????????INT0?????¨???????????·???ò???±?????????????????±????°????°7?±?¨?????è?¨???????????????????ú???????????ì???????????????????·???ò?????????????í???ò???????ú??±???±????????±??×??????í??
?????ò?????????±????×??????ì???????????÷???????÷???????????·??38H????????????????????FFH????????±????????????????????????????????÷A??????×??????¨??±??????ò?????·??38H????????????·????????§?????????????????÷A·?????@30H????@38H???????????????????·?±??????0???ù?????????????ú??????°????????????·??38H????????????
????·????÷??????????·??????????ù??????????±§×?????????·¨??F9???????????????á?????????????ò???????¨???????ì????·?????×???????????????????????????×?????????·??????§°??????ò??
???ò??????????????INT0???????????ó?????????±??°??????°?ú??????°??ü?????ò?????????·???ò?????????????í???ò?????í???????????????????ò??????????????????????????????????????±???????????°??????ú??P1???????????????????????????????·??38H???????????±????????????????P1??????????????????????????P1???????????????±????FFH????F9????????????·????ì???????????????????????ú?????í???????????ú?????????????????????±?????á??????????
???ò????????????·?·¨?????ò?????????ò?????????±??????????INT0?????±????°????°7?±?ü???±????±??¤???±?????????ò?????????????·??38H???????????ó???????????ù???????????·?????????÷???±???????¨???????ì????
???ò?ú????
HOKE1: LJMP HOKE
ORG 0090H
TT0: SETB 7DH
RETI
ORG 0150H
HOKE: CLR 7DH
SETB P3.1 ;open telephone
CLR TR0 ;close T0
MOV R2??#03H ;password wrong 3
LCALL RING10 ;input password
IN: CLR 7EH ;7EH=0
DTMF: MOV R7??#1H ;PASSWORD:5 R7
MOV R1??#38H ;sign
SETB P1.4
SETB P1.5
SETB P1.6
SETB P1.7
WAIT: JBC 7EH??CC ;wait INT0
LJMP WAIT
CC: MOV R7??#1H ;password 5***
MOV R0??#30H ;password top
MOV R1??#38H ;sign
CMP: MOV A??@R1
MOV R4??A
CLR C
MOV A??@R1
SUBB A??@R0 ;test
INC R0
INC R1
JZ AAA ;OK??pass one
LJMP QQ
AAA: DJNZ R7??CMP ;R7-1!=0
LJMP LL ;pass
QQ: DJNZ R2??IN1 ;password wrong&R2!=0
LCALL RING20
LJMP STOP
IN1:LCALL RING20 ;password wrong??try!
LJMP IN
5.4 ???ú?????÷??
?????°???×?????????í????·?±??÷????±?×°??????×÷??????×??ó???????×?????????????ú?????÷????
???ú?????÷???ù???????è±???
1?? MCS-51·????ú???¨??
2?? TC-108H?°?à?·?¨?±???é?????????ú???¨??
3?? HA8188(9)P/T?????à?????°?ú???¨??
4?? HA119(6)P/T?????à?????°?ú???¨??
5?? ?÷????50MHz?????ú???¨??
???????é???????????????????¨?????ú??????×é???????±??·?????????±?×°?????°???÷???¤×÷?????????ê?????????ú???????????????ì?????÷???ù±????????????á?????°???ê?????????????????????í????23?????±?÷???????????è??2??????±??????????????ú???±?ò?÷???ù±??ê±?????
???ú?????÷???????????????????ì???????????????÷??????????·??????¨???à?±?????????????????????±?ò?????±?á·??ú·????ú???????á?????ò???é?????????????????????§??MCS-51·????ú?????????¨???????é??????·??ú?????????????ò°????ò??????×????ó?????á·??ú????
???????????????????ú?????÷?????±?ò??????·??ú???ó????????
×??ó??????·??ú?????ò?????????????í??·????ò??????????????????????±à????×????¨?????ù???±?????????????????????ó???????????ú?????ì????×??????ì????±?????°????°7?±?ü???????ú?á??????°????????°1?±?ü????????·????í??±????ò?????????????ò???????é·??????ò???±?±??????°??????ù???·??±????ì???????????????à???±???±????°????ò????????????×???????????????
?ò???÷?????±?ò?????????????????????????·???÷???ù?????????±???????????????????????????????·?????????????????????????????±????????????×???????±????????ò?ú?????????????ê????
?????ú?÷?????ó??????·????????????????????????é×????????????????????????????????????????????á??×????????·???÷??·¨???????????ü???????????á±??????????ò??±í????·????????????????????????ù???ù±????????¨????
????????????MCS-51·????ú???é??·??????????????¨MCS-51·????ú?????é?á?????ê???à???????????§??????????????????????????±????????????????????§???????????????????±???ì?????±??????·??ú?????????ù??
?????????¨?ü???÷?????ó?ó???????÷?????????????????????????????????????ú?÷????????????????
???ù?? ???????????÷
±?????????????·???·?±????????????????????÷????×??????ò????????·?·¨?é????
??????7.1?ù?????×?????§°?±?×°???????????????????°???????????????????????ò????????????±?×°??×??????????????????¤×÷????
?±???§???ì???ò?????°??±?×°???????????°???????????????????±???°???ù??????????×°??×??????ú???????á?????á????????????
?±???§?????????????????·???????ó?????§????????×°???ù???????÷?????????????ó?ù???è????????????????????
???§???????????°?¨?°?±?????±???????????÷?????????§?????ê±???????°???#???ü??×°??×??????ú???á???°?¨?°?±?????????????????÷??±???????????×??????±???????????°?¨?°?±??????????±???
±?×°???????????ò???×?§?????????????ó??
?????? ????????????
±??????????±????????????±????è???á?????°????×÷????????????????±???±????è?????ó??????????????±?×÷?·?????????????à?????????????????????ú???????÷????????????????·???·????????????ú???§??????????????
??????????±?????????????????????×??????ò?????é????
1??????MT8888??????????????????????????????????±?×°?????????ó?ó??????????????MT8888???????·×÷?????ò?????é????
MT8888??MITEL???????ú?·???????????????????????÷???????????à????·??÷???ü°ü?¨?????????????÷·??ó?÷??DTMF?????÷??????DTMF·????÷???????÷???á???°?¤×÷???í??MT8870?ó?????ì??????????????·??????¨????×??????????????á???????????¨???·?????????????????????????ù?×???????????¨???¨?÷????????????×??????÷???????·?¨??????DTMF???÷??????????????????±ê×?????????????????·????÷????????????D/A±????÷?????????????????????????÷???????????·?????÷??????±??¤???÷????×??·???¨?±·?????MT8888?á????????±ê×????????í?÷×??????????????±????MCS-51???????ú???????ü??????????????????·????¤×÷???¨?????????????¨?÷???ì?????¨?¨???????????????????????í?ú?ò?????÷???··????????·?¨?ì????????????????????????
MT8888???????¤×÷·????????ì??DTMF??????????????????MT8870?ê???????????ì???ó?????????ó??????????????????MT8888???????±??????????stD???±?????????§???÷????±????????à????????????????????±??????????????????÷???±??????×????????÷???????±????±ê????b3?????????±×????????÷?????????????????÷?ú±ê????b2??????CPU???¨???é??????×???±ê????????????????????????????????????·??????±???±????±ê?????????±??IRQ/CP????±????????????òCPU·??????????ó???±CPU?ì??????????????×????????÷?????????ó??IRQ/CP??·?????????×?????
?ù??MT8888?????????????ü?????ì???????°?????????????????????????è???????????????????????????????????×???¤×÷??????·??????????°???·???????ì??×????????ó?ù???????é???????????ú?????ú?óMT8888?¤×÷??????·?????????????????×??????ó??????8870???ù???????ù???????????????·???è????×÷?????????ó?ó????±?×°????????????
2??????138?????÷??STA??STB??STC????????????????????24???????÷????????????·??ò?÷??????????????????32???????÷??
3??????LM567???à?·?????????°????????????????????±????????????ü??·?±????????????á??±?×°???????¨????
?á????
????????±????è??????????×????§???????????÷???é?????????÷??????????????
1???ó?§???ê?à???±?????????§?°?¨???í???ù?????????????????????????????ù?????????????§?ú?????????±?????±?????????????¨???ù??????????????????????????????????±????è???????????????ü?à???±???????????????÷?è±??????÷?????°?à?????????÷?????é??·?????×??????à??×??????????????á?????ù?§?í?????????????????????????????à???è???????ü???????ü???????ü????
2???????????????à??±????ó?????????è???ù±??????????????×????±????è?????????í???è?????¤?????ù?à?á?????????ù?????????à???????????à?á????????×÷??????????×÷?à?á????·??????????à???§?ú????????????????????????????±????è?????ì?¤???????????????????????è???????é???ê???????????????????????????¤×÷???§?°?±?????á?????ó??°??ú??
3???§?á?????ù?é??×??????????¤???é?????±???????ù?§?°???????ó?à±?????????×÷???¨???¤?????§?ú??????ר??????×????ü???????é???±?°??×????¨??×????????????????????????§???????????????ò?????±?????è?????????è?????????????§???????÷?±???????????????????é??×????????ó?????ü???????????á??×??????????????????????????¤×?????????????×?????ר????????
4?????ù?????????????????á???????÷?????????????????????é??
5??±????è???????°?§?????í????????????????×÷??????????????????????????????????
6??±????è???à???????à???????????ó???????§???????????à???????à?????????????°?à???????¤???????????§?????????ê???ú????·?????±????è???±??????????????
?????????????????????????????????????????????í?à??°??ú????????????±????è?????????ù??????????°??ú???????????§??
??????????????????????????±????è??????????????????·????????????????é???·??????????