;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; dial_init: mov dptr,#BPORT mov a,#0FFh movx @dptr,a ret ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Dial_number: ;display message ;SCAN tillkeypress ;if OK CALL dial ;maintain count of numbers entered ;if cancel deletechar if count != 0 ,else jmp main_menu ;if num store in ram starting from 68h and also writechar ;if ok,store delimiter(ffh) and call dialer ;R0:address where nos. stored ;R7:keycode ;R5:count of characters written ; Between2: MOV DPTR,#menu2_0 ; CALL display_menu ;enter no. to be dialled CALL Initialize_num CALL lcd2_init_curs CALL Getnum ;get number to be dialled CJNE R7,#OK,Goback1 CALL clear_lcd1 MOV B,#00h MOV DPTR,#menu2_1 CALL display_line CALL Dial ;note u need to store this num in exmem CALL lcd_init Goback1: CALL lcd_init JMP Main_menu ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Initialize_num: MOV R0,#NUMBER_START ;where num is stored in exram MOV R5,#00h ;COUNT OF CHARACTERS WRITTEN RET ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Initialize_dial: MOV R0,#NUMBER_START ; R0 contains the address of the internal RAM starting from DEC R0 ; where the number to be dialled is stored in keycode format MOV R1,#18h ; R1 is initialized with 24(decimal) ,the max length of the number to be dialled RET ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Dial: CALL Initialize_dial loopd: INC R0 MOV A, @R0 CJNE A,#0ffh,markd1 ; If the keycode is ffh (i.e delimiter) return JMP markd2 markd1: MOV R4,A call Dialkey ; write dial code onto dialer DJNZ R1,loopd markd2: CALL dial_init RET ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Dialkey: MOV A,R4 ; Writing a keycode(key to be dialled) on MOV dptr,#BPORT ;CPL A MOVX @dptr,A CALL Delay ; delay for approx. 130 ms MOV dptr,#BPORT MOV A,#11111111b MOVX @dptr,A ; No key pressed (keycode=11111111) CALL Delay ; delay for approx. 130 ms RET ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Delay: MOV R3,#0ffh outer: MOV R4,#0ffh inner: DJNZ R4,inner DJNZ R3,outer RET ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; keytoascii: loop: INC R0 INC R1 MOV A, @R0 CJNE A,#0ffh,mark1 ; If the digit is ffh (i.e delimiter) ,then finish and return JMP mark2 mark1: CJNE A,#ONE,flag1 ; If the digit is 1 MOV @R1,#31h JMP flag flag1: CJNE A,#TWO,flag2 ; If the digit is 2 MOV @R1,#32h JMP flag flag2: CJNE A,#THREE,flag3 ; If the digit is 3 MOV @R1,#33h JMP flag flag3: CJNE A,#FOUR,flag4 ; If the digit is 4 MOV @R1,#34h JMP flag flag4: CJNE A,#FIVE,flag5 ; If the digit is 5 MOV @R1,#35h JMP flag flag5: CJNE A,#SIX,flag6 ; If the digit is 6 MOV @R1,#36h JMP flag flag6: CJNE A,#SEVEN,flag7 ; If the digit is 7 MOV @R1,#37h JMP flag flag7: CJNE A,#EIGHT,flag8 ; If the digit is 8 MOV @R1,#38h JMP flag flag8: CJNE A,#NINE,flag9 ; If the digit is 9 MOV @R1,#39h JMP flag flag9: CJNE A,#STAR,flag10 ; If the digit is * MOV @R1,#2Ah JMP flag flag10: CJNE A,#ZERO,flag11 ; If the digit is 0 MOV @R1,#30h JMP flag flag11: CJNE A,#NEXT,mark2 ; If the digit is # MOV @R1,#23h flag: jmp loop ; DJNZ R1,loop mark2: MOV @R1,#0FFh RET ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;