| ??? 10/31/99 05:33 Read: times |
#914 - code problem with at89c52 |
I have a dtmf tranciever chip attched to int 1
howeever whenever it is called it displays the tone and grabs a macro that displays the string on the lcd and runs that routine. PLEASE if someone can look at the attached code and help me solve this. Regards Mark $Title( this program runs dtmf, keypad and lcd display ) $Date(22/10/99) lcd_cnt equ 0c000h lcd_busy equ 0c002h lcd_dat equ 0c001h keypad equ 8000h lcd_com macro dat1 lcd_busy mov a,dat1 ;CLEARS DISPLAY movx @dptr,a endm send_message macro str1 lcd_busy mov dptr,str1 call message ;MOV DPTR,#LCD_CNT ;MOV A,#0c0h ;MOVX @DPTR,a call delaylong call clear endm lcd_busy macro push acc push dpl push dph mov dptr,#lcd_busy busylop:movx a,@dptr jb acc.7,busylop pop dph pop dpl pop acc ret ;---------------------------------VECTOR ADRESSING--------------------------- $MOD652 ORG 0000h JMP START ORG 0003H JMP KEY ORG 0013H JMP DTMF ;----------------------------------MAIN PROGRAM------------------------------- START: CALL SETUP send_message #string1 ;call dialler LOOP: JMP LOOP ;------------------------------------SETUP------------------------------------ SETUP: mov ie,#81H ;enable interupts (int1 disabled) setb it0 call lcdstart ;reset lcd and display title ;call dtmfstart ;dtmf setup ret ;-----------------------------------dtmf setup------------------------------- dtmfstart: mov dptr,#0a001h ;adress of control or status registers mov a,#00h movx @dptr,a ;clearing dtmf chip mov a,#04h movx @dptr,a mov a,#00h movx @dptr,a movx @dptr,a movx a,@dptr mov a,#0dh ;setup dtmf chip for operation movx @dptr,a mov a,#00h movx @dptr,a ret ;---------------------------------lcd display start-------------------------- lcdstart: lcd_busy mov dptr,#lcd_cnt lcd_com #3fh ;lcd_com #01h ;CLEARS DISPLAY ; lcd_com #02h ;CURSOR FIRST DIGIT ; lcd_com #3fh ;sets to 8 bit 2 line display ; lcd_com #01h ;clears display lcd_busy lcd_com #0eH ;turns diplay on with cursor ;lcd_com #06h ;sets to auto increment lcd display adress ret message:lcd_busy clr a movc a,@a+dptr ;get char jz finish ;test for end of string inc dptr push dph push dpl mov dptr,#lcd_dat movx @dptr,a pop dpl pop dph ;call delayLONG jmp message finish: ;LCD_COM #0C0H ret dialler:MOV DPTR,#0c001H mov a,#44H ;WRITE D TO LCD movx @dptr,a acall delay mov a,#49H ;WRITE I TO LCD movx @dptr,a acall delay mov a,#41H ;WRITE A TO LCD movx @dptr,a acall delay mov a,#4CH ;WRITE L TO LCD movx @dptr,a acall delay mov a,#4CH ;WRITE L TO LCD movx @dptr,a acall delay mov a,#45H ;WRITE E TO LCD movx @dptr,a acall delay mov a,#52H ;WRITE R TO LCD movx @dptr,a acall delay mov dptr,#0c000h mov a,#0c0h ;move to 2nd line movx @dptr,a acall delay MOV DPTR,#0c001H mov a,#44H ;WRITE D TO LCD movx @dptr,a acall delay mov a,#49H ;WRITE I TO LCD movx @dptr,a acall delay mov a,#41H ;WRITE A TO LCD movx @dptr,a acall delay mov a,#4CH ;WRITE L TO LCD movx @dptr,a acall delay mov a,#4CH ;WRITE L TO LCD movx @dptr,a acall delay mov a,#45H ;WRITE E TO LCD movx @dptr,a acall delay mov a,#52H ;WRITE R TO LCD movx @dptr,a acall delay ret ;-------------------------------keypad----------------------------------------- KEY: mov dptr,#keypad ;MOVES ADRESS OF KEYPAD TO LCD movx a,@dptr ;MOVES DATA FROM KEYPAD TO ACC inc r0 ;increment for line placement anl a,#0fh ;gets rid of invalid bits mov dptr,#table ;LOOKUP TABLE FOR CONVERSION movc a,@a+dptr ;FINDS CORRECT CHAR IN TABLE ;CALL NEXTLINE acall lcd ;CALLS LCD PROGRAM reti ;-----------------------------lcd--------------------------------------------- LCD: line2: cjne r0,#41h,line2 ; mov r0,#00h call clear line1: cjne r0,#12h,display call nextline display: mov dptr,#0c001h ;ADDRESS LCD TO WRITE TO DISLPAY movx @dptr,a ;MOVES CHAR TO LCD acall delay ;DELAY BETWEEN CHARACTERS RET NEXTLINE: PUSH DPH PUSH DPL PUSH ACC MOV DPTR,#lcd_cnt ;MOV A,#40 OR 80H mov a,0c0h MOVX @DPTR,A POP ACC POP DPL POP DPH RET clear: push dpl push dph push acc mov dptr#lcd_cnt mov a,#01h movx @dptr,a pop acc mov dptr,#lcd_dat movx @dptr,a call lcd_busy pop dph pop dpl ret ;------------------------------DTMF------------------------------------------ DTMF: RETI ;------------------------------DELAY----------------------------------------- DELAY: MOV R0,#0FFH DEL1: DJNZ R0,DEL1 RET delaylong: mov R1,0ffH DELAY2: CALL DELAY call delay DJNZ R1,DELAY2 RET table: db '1','2','3','4','5','6','7','8','9','#','*' ;table of ascii string1: db 'Dialler ',0 end |
| Topic | Author | Date |
| code problem with at89c52 | 01/01/70 00:00 | |
RE: code problem with at89c52 | 01/01/70 00:00 |



