Hi,
I have a problem when i try to reset my uscia. I am doing this between sent packages but the last byte is sent is modified...
I am doing the following in my isr:
#pragma vector = USCIAB0TX_VECTOR__interrupt void USCIAB0TX_ISR(void){
if((IFG2&UCA0TXIFG)&&(IE2&UCA0TXIE)) //INTERRUPCION SERIAL { if ( contador_bytes_out != total_bytes_out) { UCA0TXBUF = mensaje_out[contador_bytes_out]; // TX next character contador_bytes_out++; } else { contador_bytes_out = 0; IE2 &= ~UCA0TXIE; __bic_SR_register_on_exit(LPM3_bits); // Exit LPM0 } }
}
When i get out of the ISR i turn off the USCIA:
UCA0CTL1 |= UCSWRST;
What do you suggest?
I need this to reduce my power consumption on idle state...
When you get out of the ISR, the last byte isn't sent. It's just being sent. TXIFG being set measn that the TXBUF regiseter is empty. The output shift register isn't (double buffering).You'll need to check UCBUSY bit before resettign the USCI.
_____________________________________Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.