cancel
Showing results for 
Search instead for 
Did you mean: 

Usart send more than one character

cyril2399
Associate II
Posted on August 17, 2011 at 10:39

Hello,

I saw that in usart.c there is the function   USART_SendData(USART2, 'a');

but this is for only one character (here 'a').

I want to send more than one character but I can't find how.

I think that USART_SendData(USART2, 'hello'); won't work.

Coud anyone help me please?

Thanks
14 REPLIES 14
mubinicyer
Associate II
Posted on March 25, 2014 at 11:24

Hi clive1,

In your function the parameter u32 x is being changed rather than staying constant. Won't it change the original x as well?

I think it would be better if we write it so:

void USART_SendData_Numeric(USART_TypeDef* USARTx, const u32 x)

{

u32 a = x;

      // ...

  do

  {

    value[i++] = (char)(a % 10) + '0';

    a /= 10;

  } while(a);

//....

//....

}

trevor23
Associate III
Posted on March 25, 2014 at 11:38

No, no, no. x is passed by value (not by reference) and so is local and therefore will not change the origional x.

raissateke
Associate II
Posted on September 29, 2014 at 17:20

Hello ther

SendData (USART, �? AT�?); and i receive OK on my hyperterminal, but when i send 2 commands i only receive 1 OK instead of 2, eventhough my delay is long.

do you know why?

secondly, why do i have to to press the reset button to print the sent data on the hyperterminal? is it not better if it prints automatically?

and lastly, how do i enable the ouput pins of my stm32F4 with Sms?

thank you. Im looking forward to read you

Sorry i didnt managed to create a new thread

Posted on September 29, 2014 at 18:19

Perhaps because the modem expects a CR,LF pair (Carriage Return, Line Feed)?

Yeah, I have no real idea what you're doing or how.

I guess you'd talk to the modem using it's documented command set, extract and parse the SMS message data, and act upon it using functionality you program? This would require a reasonable mastery of C programming.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
megahercas6
Senior
Posted on September 29, 2014 at 23:26

in stm32f4xx.h set correcr hse value, same apply for system_config.c

If in stm32f4xx.h hse is incorrect, you will get bad boud rate