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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/21/03 14:18
Read: times


 
#39668 - RE: Interrupts on my 8052 are broken! (?)
Responding to: ???'s previous message
1) Where does your MCU start execution?
If the MCU runs from address 0, something is wrong, because you have not defined any instruction at address 0. Maybe you have to add an org 0 and a jmp 0x8000 (BTW why does your main code begin at 0x8000?).


uart_intr:
jnb ri,xmit
mov a,sbuf
clr ri

; Have to add a RETI here, except if
; you want your program to send an echo

xmit:
clr ti
mov sbuf,a
reti

You have to set TI=1 by SW to send the first byte. And then, the micro will keep sending the same byte all the time. When a transmission ends, TI is activated by the UART, the ISR runs, clears TI, sends again and so on.
You need to provide an exit condition. For example, the ISR tests a byte counter and decide not to send more bytes when the counter reaches 10.
In fact, using interrupts to send data via the serial port is specially interesting when you have to send a set of bytes.

Alfredo del Rio.


List of 7 messages in thread
TopicAuthorDate
Interrupts on my 8052 are broken! (?)            01/01/70 00:00      
   RE: Interrupts on my 8052 are broken! (?)            01/01/70 00:00      
   RE: Interrupts on my 8052 are broken! (?)            01/01/70 00:00      
      RE: Interrupts on my 8052 are broken! (?)            01/01/70 00:00      
         RE: Interrupts on my 8052 are broken! (?)            01/01/70 00:00      
   RE: Interrupts on my 8052 are broken! (?)            01/01/70 00:00      
      thanks all            01/01/70 00:00      

Back to Subject List