Re: OOPic input over serial

Translate This Thread From English to


You'll have to do this yourself.  Take each ASCII digit and convert it to
a number by subtracting 48 (I believe).  Multiply that number by the
position it holds, IOW, 123: 1 is x100, 2 is X10 and 3 is X1.

A Byte variable is good to a max of 255, a Word variable is good to
65535.

DLC

: With a Pic processor and the PCW compiler, I know how to get a string
: input over serial, get_char(), and I know how to convert that string
: (ex. "23") into an integer. Is there anyway to do the same thing with a
: OOPic?

: Basically, I am looking for a way to read in a string from
: hyperterminal (the string will end when enter is hit) and convert that
: string into an integer for use within the OOPic. The $Str() function
: will convert an integer into a string, is an easy way to do the
: opposite?

: I have an OOPic B.2.2+.

: Thanks,
: Tim


--
============================================================================
* Dennis Clark         dlc@frii.com                www.techtoystoday.com   *
* "Programming and Customizing the OOPic Microcontroller" Mcgraw-Hill 2003 *    
============================================================================

Site Timeline