This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
Hi all,
In my application I need to send some data from the MSP430FR5969 to the PC via UART. For that purpose, I've written the following code:
#include <msp430fr5969.h> float ToF_buffer[]={1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.10}; float *p=*(&ToF_buffer); void initialize_Serial(); void serial_send(char); void setup() { PM5CTL0 &= ~LOCKLPM5; P1DIR &= ~0x02; P1REN |= 0x02; P1IES |= 0x02; P1IFG &= ~0x02; P1IE |= 0x02; // Output SMCLK in P3.4 P3DIR |= 0x10; P3SEL1 |= 0x10; initialize_Serial(); } void loop(){ nop; } #pragma vector=PORT1_VECTOR __interrupt void PORT1_ISR_HOOK(void){
char ToF_data = '1'; serial_send(ToF_data); P1IFG &= ~0x02; P1IE |= 0x02; } void serial_send (char TX_data){ while(!(UCA0IFG & UCTXIFG)); P4OUT ^= 0x40; UCA0TXBUF = TX_data; while (!(UCA0IFG & UCTXCPTIFG)); UCA0IFG &= ~UCTXCPTIFG; } void initialize_Serial(){ P2SEL1 |= 0b00000011; P2SEL0 &= ~0b00000011; UCA0CTL1 |= UCSSEL_2 | UCSWRST; UCA0BR0 = 0x08; UCA0BR1 = 0x00; UCA0MCTLW = 0x1111011100000001; UCA0CTL1 &= ~UCSWRST; }
The idea is to use the UART without interrupt. Instead, whenever the button P1.1 is pressed, I want a message to be sent via UART to be written on the serial monitor. The baudrate is 115200 for a 16MHz SMCLK.
However, when trying to send the char '1', I can only read a ' in the serial monitor (set to the right baudrate).
Posterior to this, instead of sending a single character, I want to send a float via this interface, for which I need help.
Thanks in advance,
Joaquim
**Attention** This is a public forum