The purpose of this group is to foster exchange of information on the Texas Instruments MSP430 family of microcontrollers and related tools. Everyone welcome, all levels of familiarity/expertise.
Small sprintf? - mpbwork - Sep 15 13:22:25 2008
Hi I am hitting the limits of the IAR compiler and it is mostly because
of the use of C runtime library routines.
Namely sprintf!
Like:
static char *BiasArray[] = {"Standard Bias","Hi
Bias "}; //Array of data for lcd
sprintf(lcdArray,"%s ",BiasArray[bias]);
LCDout(lcdArray,2); //data, line#
used to fill a character array so my LCD function "LCDout" can display
it.
Does anyone have a custome mMSP430 version of sprintf that will
compiler smaller?
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )
Re: Small sprintf? - Hugh Molesworth - Sep 15 14:34:54 2008
For plain text strings you don't need sprintf, just use puts() from
stdio.h which in turn uses the single character function putch();
that latter function is specific to your LCD display hardware, of
course, so you have to write it (but it's trivial). The names might
be cputs() and putchar() or putc(), depends on which compiler you
use. I think IAR is puts(), look in the header files under Program
Files/IAR. Or search the web for cputs etc.
Hugh
At 10:22 AM 9/15/2008, you wrote:
Hi I am hitting the limits of the IAR compiler and it is mostly because
of the use of C runtime library routines.
Namely sprintf!
Like:
static char *BiasArray[] = {"Standard Bias","Hi
Bias "}; //Array of data for lcd
sprintf(lcdArray,"%s ",BiasArray[bias]);
LCDout(lcdArray,2); //data, line#
used to fill a character array so my LCD function "LCDout" can display
it.
Does anyone have a custome mMSP430 version of sprintf that will
compiler smaller?
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )
Re: Small sprintf? - Preston Gurd - Sep 15 19:39:01 2008
If all you are doing with sprintf is copying bytes from one place to
another, then why not use strcpy(), strcat(), and/or memcpy() instead?
mpbwork wrote:
> Hi I am hitting the limits of the IAR compiler and it is mostly because
> of the use of C runtime library routines.
> Namely sprintf!
> Like:
> static char *BiasArray[] = {"Standard Bias","Hi
> Bias "}; //Array of data for lcd
>
> sprintf(lcdArray,"%s ",BiasArray[bias]);
> LCDout(lcdArray,2); //data, line#
>
> used to fill a character array so my LCD function "LCDout" can display
> it.
>
> Does anyone have a custome mMSP430 version of sprintf that will
> compiler smaller?
>
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )
Re: Small sprintf? - Kipton Moravec - Sep 22 11:08:18 2008
It is because most software people are trained on bigger computers or on
PCs and they do not worry about execution speed or memory. Going to a
micro-controller is a much bigger learning experience than they thought.
sprintf works on a PC. :)
Kip
On Mon, 2008-09-15 at 19:38 -0400, Preston Gurd wrote:
> If all you are doing with sprintf is copying bytes from one place to
> another, then why not use strcpy(), strcat(), and/or memcpy() instead?
> mpbwork wrote:
> > Hi I am hitting the limits of the IAR compiler and it is mostly because
> > of the use of C runtime library routines.
> > Namely sprintf!
> > Like:
> > static char *BiasArray[] = {"Standard Bias","Hi
> > Bias "}; //Array of data for lcd
> >
> > sprintf(lcdArray,"%s ",BiasArray[bias]);
> > LCDout(lcdArray,2); //data, line#
> >
> > used to fill a character array so my LCD function "LCDout" can display
> > it.
> >
> > Does anyone have a custome mMSP430 version of sprintf that will
> > compiler smaller?
> >
> >
> >
> ------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )
Re: Small sprintf? - Steve Sabram - Sep 22 15:55:11 2008
I agree here. When I used to consult on embedded systems, I often found
out that I was pulled in when the management made the mistake of
throwing software engineers on a project with only desktop software
experience. There was this one contract that I was on where the lead
firmware engineers didn't even know how to read a basic schematic! One
guy in another project was complaining that the 16-bit microcontroller
he was coding on didn't have a Visual Basic compiler on it!
I can go on and on but yes, when you staff up on embedded projects, keep
the "pure software" types away at gun point and go with people that have
at least some hardware experience. THEN, they can work with the JTAG
port and up. I find that those with "EE gone software" backgrounds work
the best in modern embedded systems.
Steve
Kipton Moravec wrote:
>
> It is because most software people are trained on bigger computers or on
> PCs and they do not worry about execution speed or memory. Going to a
> micro-controller is a much bigger learning experience than they thought.
> sprintf works on a PC. :)
>
> Kip
>
> On Mon, 2008-09-15 at 19:38 -0400, Preston Gurd wrote:
> > If all you are doing with sprintf is copying bytes from one place to
> > another, then why not use strcpy(), strcat(), and/or memcpy() instead?
> >
> >
> > mpbwork wrote:
> > > Hi I am hitting the limits of the IAR compiler and it is mostly
> because
> > > of the use of C runtime library routines.
> > > Namely sprintf!
> > > Like:
> > > static char *BiasArray[] = {"Standard Bias","Hi
> > > Bias "}; //Array of data for lcd
> > >
> > > sprintf(lcdArray,"%s ",BiasArray[bias]);
> > > LCDout(lcdArray,2); //data, line#
> > >
> > > used to fill a character array so my LCD function "LCDout" can
> display
> > > it.
> > >
> > > Does anyone have a custome mMSP430 version of sprintf that will
> > > compiler smaller?
> > >
> > >
> > >
> >
> >
> > ------------------------------------
> >
> >
> >
> >

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )