Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: paul$@pcserviceselectronics.co.uk (Paul Carpenter)
- Date: Sun, 16 Oct 2005 02:24:21 +0100 (BST)
On Sunday, in article
<43517dee$0$6773$9b4e6d93@xxxxxxxxxxxxxxxxxxxxxxxxxx>
usenet@xxxxxxxxxxxxx "Andreas Schwarz" wrote:
>Chris Hills schrieb:
>> In article <43515ad8$0$6777$9b4e6d93@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
>> Andreas Schwarz <usenet@xxxxxxxxxxxxx> writes
>>>Ian Bell schrieb:
>>>>Andreas Schwarz wrote:
>>>>>Printf was only an example, the same applies to strcmp, puts, and many
>>>>>more, not to mention your own functions that operate on constant arrays.
>>>>>And besides, I don't think there's anything wrong with using printf on 8
>>>>>bit controllers. It makes serial debugging, LCD usage and things like
>>>>>that much more comfortable, and the additional 2-3 kB scarcely matter.
>>>>
>>>>LOL, that 2-3K makes a huge difference in products with 16K ROM or less and
>>>>there are very many of those.
>>>
>>>Optimization (writing a specialized function instead of using one from
>>>the library is nothing but optimization) is done when necessary, and no
>>>sooner. If your program with printf & Co. is 14k large and you target a
>>>16k microcontroller, replacing standard functions with specialized code
>>>will gain you absolutely nothing, but takes time, is error-prone, makes
>>>your code larger and hurts maintainability.
>>
>> This is absolute rubbish. A simple function to put a character or two
>> out to a serial line will only be a few bytes long.
> >
>> As printf has to use this functionality to address the hardware, and you
>> may want to re-direct printf, it is often made available in source form
>> in the library. All you have to do is get the routine. Typically it is
>> only 4-5 lines of C.
>
>Appearantly we have a misunderstanding here. With printf I do not mean a
>put-everything-on-stdout-C89-printf. Most libraries have a printf
>variant that takes a function pointer argument for a putc function, or a
>seperate function to set the printf target. Obviously you have to write
>this one yourself.
Creating a simple putc or put_string is easy.
>The point I was trying to make is that it is useless to assemble a LCD
>output by hand (formatting numbers, concatenating strings, padding with
>spaces) when there is a function like printf that can do it all much
>easiert, but may take a bit more space.
Creating a custom printf is MUCH better than using a library function
many applications do not need
Floats
scientific of exponential notation
pointer printing
long modifiers
escape characters (form feed, line feed, bell)
Mnay only need single character or formatted strings with a byte or short
(signed/unsigned printing).
To create a custom printf is relatively easy and I have used a few, created
and expanded over time to have conditionally compilation for support required
(binary, octal, decimal, hex, pointer). Simple formatting for single
characters or strings as standard. Some of the conditional assembly for
16bit ranging from 400 bytes to 1000 bytes, depending on the target being
developed. Hence code reuse just like using a library, with known overhead.
--
Paul Carpenter | paul@xxxxxxxxxxxxxxxxxxxxxxxxxxx
<http://www.pcserviceselectronics.co.uk/> PC Services
<http://www.gnuh8.org.uk/> GNU H8 & mailing list info
<http://www.badweb.org.uk/> For those web sites you hate
.
- Follow-Ups:
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Paul Keinanen
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- References:
- Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Bill Giovino
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Mochuelo
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Sergio Masci
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Mochuelo
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Mike Harrison
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Andreas Schwarz
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Ian Bell
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Andreas Schwarz
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Ian Bell
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Andreas Schwarz
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Ian Bell
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Andreas Schwarz
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Chris Hills
- Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- From: Andreas Schwarz
- Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- Prev by Date: Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- Next by Date: Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- Previous by thread: Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- Next by thread: Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24
- Index(es):
Relevant Pages
|
|