Quantcast
Viewing all articles
Browse latest Browse all 63778

Forum Post: RE: UART example with BREAK input?

Clemens, Thanks for your quick response. I was already doing as you suggested, but I had not enabled the break interrupt. It didn't make any difference, however. When I issue a BREAK from TeraTerm, (with or without the break interrupt enabled, nothing happens until I send another char from TeraTerm. Remember, this is for the MSP432. Here's my UART ISR code (I haven't been able to make it come our with the line-numbered, syntax highlighting like your code snippit);: void EUSCIA0_IRQHandler(void) { uint32_t status = MAP_UART_getEnabledInterruptStatus(EUSCI_A0_BASE); MAP_UART_clearInterruptFlag(EUSCI_A0_BASE, status); //----- UART0 RX interrupt service routine ------------------------------------ if(status & EUSCI_A_UART_RECEIVE_INTERRUPT) { // Check for BREAK here? if(EUSCI_A0->STATW & EUSCI_A_STATW_BRK) { temp = MAP_UART_receiveData(EUSCI_A0_BASE); __no_operation(); // for debugger // handle break flags |= (BRK_flag); } else { temp = MAP_UART_receiveData(EUSCI_A0_BASE); // handle received byte if((temp == 'u') && (i_nxtfree == nxt_cmd)){ // if 'u' is first char flags |= (Hello_flag); // flag to print "Hello..." } else if((temp == 'h') && (i_nxtfree == nxt_cmd)){ // if 'h' is first char flags |= (Help_flag); // flag to print signon msg } else if(temp == 0x1B){ // ESC received? flags |= (ESC_flag); } else if(temp == 0x0D){ // Carriage Return? flags |= (CR_flag); } else if(temp == '!'){ // End-of-command input ('!')? flags |= (CMD_flag); } } } if(flags){ // comes here if any of the flags are set by the received char cur_cmd = nxt_cmd; // cur_cmd is start of completed CMD inbuf[i_nxtfree] = NULL; // ..and put a NULL in start of nxt_cmd __no_operation(); // for debugger nxt_cmd = i_nxtfree; // nxt_cmd start of next (uncompleted) command __low_power_mode_off_on_exit(); }else if((temp > 0x1F) && (temp < 0x7F)){ // if received printable char inbuf[i_nxtfree++] = temp; // put received char into inbuf i_nxtfree &= (INBUFSIZ - 1); // wrap i_nxtfree if necessary inbuf[i_nxtfree] = '\0'; // Mark end of current command uart_putc(temp); // echo the input char // if we overrun inbuf, increment the nxt_cmd index if(i_nxtfree == nxt_cmd) nxt_cmd = (++nxt_cmd & (INBUFSIZ-1)); } // end of if(temp is printable_char) } // End EUSCIA0_IRQHandler

Viewing all articles
Browse latest Browse all 63778

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>