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.