- can i read data Exam port P0 and convert to floating point format ?
- if i receive data form rs232 Ex "-0.1234" and save data to ram address 30H-35H can i convert this data to floating point format ?
thank
strtod / strtod517
Summary: #include <stdlib.h>
unsigned long strtod (
const char *string, /* string to convert */
char **ptr); /* ptr to subsequent characters */
Description: The strtod function converts string into a floating-point
value. The input string is a sequence of characters that can
be interpreted as a floating-point number. Whitespace
characters at the beginning of string are skipped.
The strtod517 function is identical to atof, but uses the
arithmetic unit of the Infineon 80C517 to provide faster
execution. For using this function include the header file
80C517.H. Do not use this routine with a CPU that does not
support this feature.
The strtod function requires string to have the following
format:
{+ | -} digits . digits {e | E} {+ | -} digits
where:
digits may be one or more decimal digits.
The value of ptr is set to point to the first character in
string immediately following the converted part of the
string. If ptr is NULL no value is assigned to ptr. If no
conversion is possible, ptr is set to the value of string and
the value 0 is returned by strtoul.
Return Value: The strtod function returns the floating-point value that is
produced by interpreting the characters in string as a
number.
See Also: atof, atoi, atol, strtol, strtoul
C51 is passing the adress of your string in R1 -> R3 to the atof routine and afterwards is passing the result in R4 -> R7 into ram locations 0x0a -> 0x0d.