stm32f4 USART
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-11-10 9:32 AM
Posted on November 10, 2015 at 18:32
Hello Every one! Can any 1 please help me with USART data transfer..
The problem is i want to transfer 16 bit value which is saved in global variable to computer from USART. i am trying thisvoid usart_send()
{
USART_puts(''S1'');
USART_puts(sensor1val);
}
void USART_puts(volatile char *s){
while(*s){
// wait until data register is empty
while( !(USART3->SR & 0x00000040) );
USART_SendData(USART3, *s);
*s++;
}
Note S1 is received successfully but i need help on how to transfer the value in sensor1val. Thanks for trying to slove my problem :)
#usart #stm32 #stm32f4
Labels:
- Labels:
-
STM32F4 Series
-
UART-USART
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-11-10 10:00 AM
Posted on November 10, 2015 at 19:00
void usart_send()
{
char buf[16];
sprintf(buf, ''S1 %d
'', sensor1val);
USART_puts(buf);
}
void USART_puts(volatile char *s)
{
while(*s)
{
// wait until data register is empty
while( !(USART3->SR & 0x00000040) );
USART_SendData(USART3, *s++);
}
}
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-11-10 10:03 AM
Posted on November 10, 2015 at 19:03
Thanks a lot Clive this was helpful and gave me much knowledge about usart send function, i wrote this and it works cool
USART_puts(''S1''); while( !(USART3->SR & 0x00000040) ); USART_SendData(USART3,(sensor1val >> 8)); while( !(USART3->SR & 0x00000040) ); USART_SendData(USART3,sensor1val);