$MOD51 ;***************************************************************************** ;***** FICHIER : TRANST11.ASM ;***** DESCRIPTION : Transmetteur téléphonique v1.1 ;***** AUTEUR : G. B ;***** DATE : 15/08/2005 ;***** ;***** Modifications par rapport a la version precedente : ;***** ;***** Bugs connus : ;***** ;***************************************************************************** ;***************************************************************************** ;*********** E/S ;***************************************************************************** E_Appeler_No_1 equ P3.0 E_Appeler_No_2 equ P3.1 E_Appeler_No_3 equ P3.2 E_Appeler_No_4 equ P3.3 S_Active_Relai_Ligne equ P3.7 S_Active_Sonnerie equ P3.6 S_Emet_Chiffre equ P1.7 ;***************************************************************************** ;*********** Variables ;***************************************************************************** ;***************************************************************************** ;*********** Revectorisation ;***************************************************************************** ORG 0000h LJMP Principal ORG 001Bh ; Timer 1 overflow CLR tr1 CLR ie1 RETI ORG 0100h SUB_Attente_50ms: MOV TH1,#3Ch MOV TL1,#0AFh SETB tr1 JB tr1,$ RET ORG 0200h SUB_Alerter_Au_Numero_X: ;Numéro de téléphone à l'adresse DPTR ;====Décroche la ligne SETB S_Active_Relai_Ligne ;====Attente 2s MOV R1,#28h Suite_Attente_1: LCALL SUB_Attente_50ms DJNZ R1,Suite_Attente_1 ;====Composition du N° à 4 chiffres/s ;===================================== Suite_Composition: CLR A MOVC A, @A+DPTR JZ Numerotation_Fin ; Si caractere = 0 : Fin ;==== Transforme le code ASCII en chiffre et sauve le DPTR SUBB A,#30h MOV R2,DPH MOV R3,DPL ;==== Transforme le chiffre en code DTMF MOV DPTR,#CST_Table_Conv MOVC A, @A+DPTR ;==== Emet le chiffre MOV P1,A SETB S_Emet_Chiffre ;==== Attente 200ms MOV R1,#04h Suite_Attente_200ms: LCALL SUB_Attente_50ms DJNZ R1,Suite_Attente_200ms ;==== Arrete émission chiffre et restaure le DPTR CLR S_Emet_Chiffre MOV DPH,R2 MOV DPL,R3 INC DPTR LCALL SUB_Attente_50ms LJMP Suite_Composition Numerotation_Fin: ;===================================== ;====Attente 5s (début sonnerie chez le correspondant) MOV R1,#64h Suite_Attente_2: LCALL SUB_Attente_50ms DJNZ R1,Suite_Attente_2 ;====Alarme 5Hz pendant 20s (Soit chgt etat 2x5x20 = 200 fois = C8h, toutes 100ms) SETB S_Active_Sonnerie MOV R1,#0C8h Suite_Sonnerie_Active: LCALL SUB_Attente_50ms LCALL SUB_Attente_50ms CPL S_Active_Sonnerie DJNZ R1,Suite_Sonnerie_Active CLR S_Active_Sonnerie ;====Raccroche la ligne CLR S_Active_Relai_Ligne ;====Attente 2s MOV R1,#28h Suite_Attente_3: LCALL SUB_Attente_50ms DJNZ R1,Suite_Attente_3 RET ;***************************************************************************** ;*********** Programme principal ;***************************************************************************** ORG 0300h Principal: CLR S_Active_Relai_Ligne CLR S_Active_Sonnerie ;Configure les 2 timers en timer/mode 1 MOV TMOD,#11h CLR tr0 CLR tr1 SETB et1 SETB ea CLR S_Emet_Chiffre PPAL_No_1: JNB E_Appeler_No_1,PPAL_No_2 MOV DPTR,#CST_NumTel_1 LCALL SUB_Alerter_Au_Numero_X PPAL_No_2: JNB E_Appeler_No_2,PPAL_No_3 MOV DPTR,#CST_NumTel_2 LCALL SUB_Alerter_Au_Numero_X PPAL_No_3: JNB E_Appeler_No_3,PPAL_No_4 MOV DPTR,#CST_NumTel_3 LCALL SUB_Alerter_Au_Numero_X PPAL_No_4: JNB E_Appeler_No_4,Boucle_Attente MOV DPTR,#CST_NumTel_4 LCALL SUB_Alerter_Au_Numero_X Boucle_Attente: SJMP Boucle_Attente ;***************************************************************************** ;*********** Constantes ;***************************************************************************** ;15 chiffres maxi CST_NumTel_1: DB '0677777777',0 CST_NumTel_2: DB '0688888888',0 CST_NumTel_3: DB '0166666666',0 CST_NumTel_4: DB '0188888888',0 ;==== Chiffre Rangee Colonne ;==== 0 4 2 ;==== 1 1 1 ;==== 2 1 2 ;==== 3 1 3 ;==== 4 2 1 ;==== 5 2 2 ;==== 6 2 3 ;==== 7 3 1 ;==== 8 3 2 ;==== 9 3 3 CST_Table_Conv: DB 57h,6Eh,5Eh,3Eh,6Dh,5Dh,3Dh,6Bh,5Bh,3Bh,0 ;=== Conversion des chiffres en codes DTMF pour le TCM5089 END