Tool/software: Code Composer Studio
Hi,
I couldn't observe float values as an UART output so i decided to convert the value to string and then transmit it.
But unfortunately i could not achieve that.
Heres the code snippet and it would be a great help if i know where i went wrong.
float data=10.0;
char data1[20];
int SerialTransmission_UART(char data) { WDTCTL = WDTPW | WDTHOLD; // Stop Watchdog PM5CTL0 &= ~LOCKLPM5; UCA3CTLW0 = UCSWRST; // Put eUSCI in reset UCA3CTLW0 |= UCSSEL__SMCLK; // CLK = SMCLK UCA3BRW = 52; // 8000000/16/9600 UCA3MCTLW |= UCOS16 | UCBRF_1 | 0x4900; UCA3CTLW0 &= ~UCSWRST; // Initialize eUSCI UCA3IE |= UCRXIE; // Enable USCI_A0 RX interrupt sprintf(data1,"%f",data); UCA3TXBUF =data1; //__bis_SR_register(LPM3_bits + GIE); // Enter LPM3, interrupts enabled __no_operation(); // For debugger return 0; }
Best Regards,
Divya