Subject:
|
Re: Reading floating point numbers
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Thu, 15 May 1997 14:42:51 GMT
|
Original-From:
|
Richard F. Drushel <drushel@cwbiol2.biol.=ihatespam=cwru.edu>
|
Viewed:
|
1885 times
|
| |
| |
Baggerman, Clinton D. spake unto the ether:
> My problem is that I need to read in a floating point number through the
> serial port. I tried using the serial_getchar function to read in the
> number
> as an int, then convert it to a float, but that was unsuccessful. I
> also
> tried altering the serial_getchar funtion to read in the number as a
> char and
> then convert it, but that also did not work. Does anyone know of
> another
> function or a way to alter the serial_getchar function to read in
> floats?
> Thanks.
Clint, I already have the converse of this problem (i.e.,
printing floats (and ints) to a remote console via serial_putchar())
solved. I'm currently working with Fred Martin to make these routines
part of an improved standard IC library. I hadn't thought (yet) about
your problem, reading floats (or ints, for that matter) via
serial_getchar(), but it's clearly doable.
Fred, should I put out my existing cprintf.c library now
and let others start to write the input routines based on my code?
It sounds like the logical long-term solution would be
serialio.c ;low-level serial I/O
conio.c ;my cprintf.c functions, and the converse
;formatted input stuff that Clint is
;asking about
What do you think, Fred?
*Rich*
--
Richard F. Drushel, Ph.D. | "Aplysia californica" is your taxonomic
Department of Biology, Slug Division | nomenclature. / A slug, by any other
Case Western Reserve University | name, is still a slug by nature.
Cleveland, Ohio 44106-7080 U.S.A. | -- apologies to Data, "Ode to Spot"
|
|
Message has 1 Reply:
Message is in Reply To:
| | Reading floating point numbers
|
| My problem is that I need to read in a floating point number through the serial port. I tried using the serial_getchar function to read in the number as an int, then convert it to a float, but that was unsuccessful. I also tried altering the (...) (28 years ago, 15-May-97, to lugnet.robotics.handyboard)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|