Hi...
I want to do some test with an H-bridge, but I don´t know how to use
the scanf() function for receive characters from the UART.
If anybody have information abuot it, I´ll appreciate any help!!!
Thanks
Somebody emailed:
"I want to do some test with an H-bridge, but I don´t know how to use
the scanf() function for receive characters from the UART.
[..]"
The scanf() function is documented in the book "The C Programming Language"
by Brian W. Kernighan and Dennis M. Ritchie.
Its conversion characters are similar to printf()'s.
An example call with scanf() to take just one character is
char array_to_which_the_character_is_copied[some_length];
scanf("%1c", array_to_which_the_character_is_copied[0]);
> An example call with scanf() to take just one character is
> char array_to_which_the_character_is_copied[some_length];
> scanf("%1c", array_to_which_the_character_is_copied[0]);
Actually, that should be (notice addition of &):
scanf("%1c", &array_to_which_the_character_is_copied[0]);
--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/
Dave Hylands correctly pointed out:
"> An example call with scanf() to take just one character is
> char array_to_which_the_character_is_copied[some_length];
> scanf("%1c", array_to_which_the_character_is_copied[0]);
Actually, that should be (notice addition of &):
scanf("%1c", &array_to_which_the_character_is_copied[0]);
"
Touché.
Maybe he means setting up the standard input
FILE* fdevopen ( int(* put)(char),
int(* get)(void),
int opts __attribute__((unused))
)
I know you need to use fdevopen and pass it a int(* get) function
but I have no idea what that function would look like other than to put
any waiting charactors off the uart.
I would think it would have to have some time functionality built in
also.
Show quoted textHide quoted text
-----Original Message-----
From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On
Behalf Of Colin Paul Gloster
Sent: Thursday, June 23, 2005 3:40 AM
To: AVR-Chat@yahoogroups.com
Subject: RE: [AVR-Chat] use of scanf
Somebody emailed:
"I want to do some test with an H-bridge, but I don´t know how to use
the scanf() function for receive characters from the UART.
[..]"
The scanf() function is documented in the book "The C Programming
Language" by Brian W. Kernighan and Dennis M. Ritchie.
Its conversion characters are similar to printf()'s.
An example call with scanf() to take just one character is
char array_to_which_the_character_is_copied[some_length];
scanf("%1c", array_to_which_the_character_is_copied[0]);
Yahoo! Groups Links