Hello I want to transfer data from my MSP to my computer, only 3 characters A, B and C, I am using 48 MHz of CLK and a 115200 Baud Rate: #include "msp.h" float num = 14.2068e-3; void MSP432_delay(float time); int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer CS->KEY = 0x695A; // Unlock CS module for register access CS->CTL0 = 0; // Reset tuning parameters CS->CTL0 = CS_CTL0_DCORSEL_5; // Set DCO to 48MHz (nominal, center of 8-16MHz range) // Select ACLK = REFO, SMCLK = MCLK = DCO CS->CTL1 = CS_CTL1_SELA_2 | CS_CTL1_SELS_3 | CS_CTL1_SELM_3; CS->KEY = 0; // Lock CS module from unintended accesses // Configure UART pins P1SEL0 |= BIT2 | BIT3; // set 2-UART pin as second function __enable_interrupt(); NVIC->ISER[0] = 1 << ((EUSCIA0_IRQn) & 31); // Enable eUSCIA0 interrupt in NVIC module // Configure UART UCA0CTLW0 |= UCSWRST; UCA0CTLW0 |= UCSSEL__SMCLK; // Put eUSCI in reset // Baud Rate calculation // 12000000/(16*9600) = 78.125 // Fractional portion = 0.125 // User's Guide Table 21-4: UCBRSx = 0x10 // UCBRFx = int ( (78.125-78)*16) = 2 UCA0BR0 = 26; // 48000000/16/115200 UCA0BR1 = 0x00; UCA0MCTLW = 0x1000 | UCOS16 | 0x0020; UCA0CTLW0 &= ~UCSWRST; // Initialize eUSCI UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt while(1) { UCA0TXBUF = 0x41; UCA0TXBUF = 0x42; UCA0TXBUF = 0x43; } } // UART interrupt service routine void EUSCIA0_IRQHandler(void) { if (UCA0IFG & UCRXIFG) { while(!(UCA0IFG&UCTXIFG)); // asm(" nop"); // UCA0TXBUF = UCA0RXBUF; // __no_operation(); } } void MSP432_delay(float time) { int k_dalay,delay_cycles; k_dalay = (int) (0.0841*time*1e6 - 1.786); for (delay_cycles = 0; delay_cycles < k_dalay; delay_cycles++); // Delay en tiempo } In the Terminal 1 we read the data, but there are multiple A's, B's and C's, but I am sending only one A, one B and one C, why I am getting this information in the terminal ??? Everything is ok when I use the "step into tool".
↧