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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/27/10 20:31
Read: times


 
#176243 - Trouble with interrupt driven comms on 80C320 serial port 1
I'm having trouble with a serial application using the Dallas 80C320. I'm using serial port 1 in mode 1 (8-bit UART) using timer 1 to generate the baud rate. I have an 11.0592 MHz crystal, and am operating at 57,600 baud. The port works fine when I use it without interrupts. I can send and receive characters at 57,600 baud, and everything seems perfect. But when I enable interrupts, nothing happens. I've put an output to a LED in my interrupt handler, and it never gets fired, so I'm pretty sure the interrupt handler is never being reached. What am I doing wrong?

Here's my initialisation code:

start:
	mov SP,#?stack-1
	mov IE,#0 ; Disable all interrupts.
        mov P1,#0 ; Turn off tr_enab and tr1_enab.

        ; This is for serial port 0
	mov t2con,#030h ; Use Timer 2 in auto reload mode for both receive and transmit baud clocks.
	mov RCAP2L,#T2RL96L
	mov RCAP2H,#T2RL96H
	mov TL2,#T2RL96L
        mov TH2,#T2RL96H
	mov SCON,#050h ; Serial port 0 mode 1 (8-bit UART), Receive Enable.
	mov a,#2 ; Stretch value. External RAM access via MOVX uses 4 machine cycles.
	mov CKCON,a ; T1M (CKCON.4) is 0 so timer 1 runs at crystal/12.
	setb TR2 ; Turn on timer 2.

        ; This is for serial port 1
        mov tmod,#020h ; Timer 1 mode 2: 8-bit auto-reload mode.
        mov th1,#255d
        mov tl1,#255d
        mov scon1,#050h ; Serial port 1 settings: mode 1 (async 10-bit), receive enable.
        setb smod ; Set smod_1 to double the baud rate.
        clr RI1 ; If it`s edge triggered, we may never get an interrupt if TI or
        clr TI1 ; RI are already set when interrupts are enabled.
        setb ES1 ; Enable interrupts.
	setb EA ; Global interrupt enable.
        setb tr1 ; Turn on timer 1. Port is now live. 
 


I've included all of it including the stuff for port 0 just in case there's some interaction I've not spotted. This exact code, without the setb ES1 and setb EA, works fine for non-interrrupt IO.

When I add the two setb's though I don't seem to get any interrupts. I have the following interrupt vector:
	ORG 003bh
	ljmp serint1
 


In serint1 I have:
serint1:
	clr ES1
        push ar2
	push psw
	push acc
	push b
	push DPL
	push DPH
	clr RI1
        etc.
 


Then I have my output to a LED which never happens.

What am I doing wrong?

Many thanks - Rowan






List of 38 messages in thread
TopicAuthorDate
Trouble with interrupt driven comms on 80C320 serial port 1            01/01/70 00:00      
   CLR ES1?            01/01/70 00:00      
      Good idea but not the solution            01/01/70 00:00      
         As Erik posted, may be the etc. part            01/01/70 00:00      
   I cant' tell if there is a problem in ...            01/01/70 00:00      
      Which ... are you worrying about?            01/01/70 00:00      
         How about commenting "etc"            01/01/70 00:00      
         please post as is, not all the ...            01/01/70 00:00      
            Again without the conditionals            01/01/70 00:00      
               this is NOT an ISR            01/01/70 00:00      
                  Why will jnb RI,$ screw up?            01/01/70 00:00      
                     stick a state machine in the ISR            01/01/70 00:00      
                        To interrupt or not...            01/01/70 00:00      
                           an example            01/01/70 00:00      
                              Avoid infinite loops like the plague            01/01/70 00:00      
                                 Back to the subject - why won't it interrupt?            01/01/70 00:00      
                                    Serial Port Interrupts            01/01/70 00:00      
                                       Yes, I think I've done this correctly            01/01/70 00:00      
                                          Vector Address...            01/01/70 00:00      
                                             I think I've done this correctly...            01/01/70 00:00      
                                                you had me there            01/01/70 00:00      
                                                   Serial port, not port            01/01/70 00:00      
                                          maybe not            01/01/70 00:00      
                                             ES1 is non-standard            01/01/70 00:00      
                                                probably the most common misumderstanding            01/01/70 00:00      
                                                   Thanks for clarification...            01/01/70 00:00      
                                             It works without interrupts...            01/01/70 00:00      
                                                then ...            01/01/70 00:00      
                                                   Even Better ...            01/01/70 00:00      
                                    maybe it does            01/01/70 00:00      
                                       Two things argue against this...            01/01/70 00:00      
   Dunno, but that's a very useful instruction            01/01/70 00:00      
   Dunno..            01/01/70 00:00      
      I have problem with serial port 1 on ds89c450 (www.maxim-ic            01/01/70 00:00      
         MUCH better description needed            01/01/70 00:00      
            not it is not language            01/01/70 00:00      
               Which register bank are you using?            01/01/70 00:00      
                  yes it works now            01/01/70 00:00      

Back to Subject List