Monday, March 17, 2008

Re: [oopic] oSerialL and oLCDSE

At 01:05 PM 3/17/2008, Brian Lloyd wrote:
>Now, does anyone have some routines that will convert various numeric
>data types into their ASCII string representations? And a string is a
>null-terminated array of char. That should be possible to implement
>even if it isn't treated properly within the language itself.

Sounds like you want an itoa() clone. Byte or word data in, ASCII digits out.


> I can
>clock that out to the serial LCD one character at a time without too
>much trouble. After all, I am not trying to build a full-on terminal,
>just a way to display some simple information.

Rather than build a string that you're just going to send to the LCD
and then throw away, you should go with itol() - integer to LCD. I
suspect you'll want to specify a field width: itol(value, width)

One function can handle bytes, signed words and unsigned words with
values less than 0x8000. If you need to handle all unsigned values,
there is a bit more work to do. The trick is to do this quickly
(you're using a 0.0003 MIPS processor) without using a lot of
variables - you don't want your formatting function eating up a
quarter of your data space.

Which way did you want to go? itoa or itol? Or the poor man's
substitute - Str$?


...Andy

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:

http://groups.yahoo.com/group/oopic/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:

http://groups.yahoo.com/group/oopic/join

(Yahoo! ID required)

<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

http://docs.yahoo.com/info/terms/

No comments:

Post a Comment