Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/15/09 05:53
Modified:
  09/15/09 07:44

Read: times


 
#168889 - why does mov dptr,#0 stop my serial int from triggering
why does my lcdsetup routine: stop my serial int from triggering?.
is there something else i can use here that wont bugger the serial interupt?
other then just manually doing each letter of the welcome screen on lcd?
i have am running this in a simulator with a debugger when i skip my lcdsetup the serial int triggers like it is meant too but wont when i enable the lcd routine.

;;;;;;ports for lcd ;;;;;;;
		EN EQU P1.2 
		RS EQU P1.0 
		RW EQU P1.1 
		LCD_DATA EQU P0
                line equ 00h
                count equ 00h
  


; Program start

; start timer 1 and then start serial rx in mode 1
start:

    CLR	RCLK		; rx uses timer 1
	MOV	TMOD, #020H	; 8-bit auto reload
	MOV 	TH1, #0E5H	; 1.2K baud rate 
	MOV	TL1, #0E5H
	SETB	TR1		; start timer 1
	CLR	SM0		; set serial mode to 1
	SETB	SM1
	CLR	RI
	SETB	REN

	SETB	ES		; enable serial interrupt
	SETB	EA		; enable interrupts in general
   
lcdsetup:
          LCALL INIT_LCD
          LCALL CLEAR_LCD     
          MOV  dptr,#0
          MOV  dptr,#WelcomeText
          MOV count,#11h
          LCALL loop
endloop:

nop
   
endloop2:
	JMP endloop2
    

	LJMP	int_serial

int_serial:
	PUSH	PSW
	PUSH	ACC

	JNB	RI, exit_int 	; check whether RI was set
	; received data on pin RxD
    
        MOV  A,SBUF
	CLR	RI		; reset RI bit in order to receive more data

show_lcd:	; echo data received on RxD through lcd

        LCALL loop2
	MOV	SBUF, A    
	JNB	TI, $
	CLR	TI
    

exit_int:
	POP 	ACC
	POP	PSW
	RETI			; RETurn from interrupt service routine




Loop:
   CLR  a
   MOVc a,@a+dptr
   INC  dptr
   JZ    WriteStringEnd
   LCALL counter
   SJMP loop
ok:
   LCALL WRITE_TEXT
   RET
WriteStringEnd:
   MOV count,#11h
   RET

counter:

 DJNZ count, ok
 JMP lineflip

Loop2:


   LCALL counter
   RET 


stop: SJMP stop
;;;;;;;lcd routines ;;;;;; 
lineflip:
           
DJNZ line,bottomline



topline:
          
           CLR RS
           MOV LCD_DATA,#080h
           SETB EN
           CLR EN
           MOV line,#01h
           MOV count,#11h
           LCALL WAIT_LCD
           LCALL WRITE_TEXT
           LCALL WAIT_LCD
           RET

bottomline:

           CLR RS
           MOV LCD_DATA,#0C0h
           SETB EN
           CLR EN
           MOV line,#00h
           MOV count,#11h
           LCALL WAIT_LCD
           LCALL WRITE_TEXT
           LCALL WAIT_LCD
           RET




    
WAIT_LCD:


		MOV		R1,#01H		; COUNTER USED TO LOOP 20 TIMES, WHICH IS EQUIVALENT TO 1 SEC
SEC_LOOP:
		MOV		TH0,#00H	; CLEAR TIMER 0
		MOV		TL0,#00H
		CLR		TF0			; CLEAR OVERFLOW BIT
		SETB	TR0			; START TIMER 0
		JNB		TF0,$		; WAIT FOR OVERFLOW FLAG
		CLR		TR0			; STOP TIMER 0
		
		
		
		DJNZ	R1,SEC_LOOP

       RET


      

WAIT_LCD2:


		MOV		R1,#0DH		; COUNTER USED TO LOOP 20 TIMES, WHICH IS EQUIVALENT TO 1 SEC
SEC_LOOP2:
		MOV		TH0,#00H	; CLEAR TIMER 0
		MOV		TL0,#00H
		CLR		TF0			; CLEAR OVERFLOW BIT
		SETB	TR0			; START TIMER 0
		JNB		TF0,$		; WAIT FOR OVERFLOW FLAG
		CLR		TR0			; STOP TIMER 0
		
		
		
		DJNZ	R1,SEC_LOOP2

       RET

INIT_LCD:
       LCALL WAIT_LCD2
       SETB EN
       CLR EN
       CLR RS
       CLR RW
       MOV LCD_DATA,#38h
       SETB EN
       CLR EN
       LCALL WAIT_LCD
       CLR RS
       CLR RW
       MOV LCD_DATA,#0Eh
       SETB EN
       CLR EN
       LCALL WAIT_LCD
       CLR RS
       CLR RW
       MOV LCD_DATA,#06h
       SETB EN
       CLR EN
      LCALL WAIT_LCD

       RET


CLEAR_LCD:

       CLR RS
       CLR RW
       MOV LCD_DATA,#01h
       SETB EN
       CLR EN
       LCALL WAIT_LCD
       RET
				
WRITE_TEXT:

       SETB RS
       MOV LCD_DATA,A
       SETB EN
       CLR EN
       LCALL WAIT_LCD
       RET
				
WelcomeText:
db 'hello              again',0
                            	
		





END 


List of 5 messages in thread
TopicAuthorDate
why does mov dptr,#0 stop my serial int from triggering            01/01/70 00:00      
   are You sure?            01/01/70 00:00      
      RE: programm is too long to be easy readable            01/01/70 00:00      
      reply            01/01/70 00:00      
         Thanks Stefan            01/01/70 00:00      

Back to Subject List