Carlos Aguilar

Serial communication trouble

Discussion created by Carlos Aguilar on Jun 12, 2010
Latest reply on Jun 13, 2010 by bigmac

Hello, I have trouble on a serial communication subroutine and would like to have some help.

 

I'm using a MC9S12X MCU an after executing a ATD single-channel conversion the following code is executed:

 

                     LDAA ATDDR0
                     JSR SENDATA

 

SENDATA   BRCLR SCISR1,$80,SENDATA
                     STAA SCIDRL
                     RTS

 

The problem is that after the RTS, the program branches to the begging of the code instead of branching to the place of the code where the subroutine was called.

 

I've tried this code on a MC9S12 MCU too and the same thing occurs. I would like to find out why this is happening and any solution. I'll pretty much appreciate any help here.

Outcomes