Hi there,

On the page http://simplepic.atspace.com you'll find a "poorman's 
printf" in source code that you could adapt for your needs (without 
varargs).

Daniel

[EMAIL PROTECTED] wrote:

>Hi
>
>Thanx for the reply. I will try your suggestions as soon as I get home.
>
>As I said, printing strings works fine. So the setup should be fine too.
>I've set sdout to use the UART.
>
>Maybe I should be more careful with types and stuff. With gcc and my computer
>this works fine. But of course there is quite a difference between a PIC
>and a Mac?
>
>BTW Maybe it is relevant that I use a resent sdcc snapshot for Mac OS X PPC.
>I could try the same on Linux/i386 if necessary.
>
>Anyway. I'm pretty impressed of the work that has been done to make sdcc
>work for PICs. Although I'm not sure yet whether or not libraries like stdio
>are an overkill for the PIC or at least for my needs.
>
>I will post my results soon,
>
>Cheers,
>Ezra.
>
>  
>
>>----------------------------------------------------------------------
>>
>>Message: 1
>>Date: Mon, 28 Aug 2006 00:45:32 +0200
>>From: Raphael Neider <[EMAIL PROTECTED]>
>>Subject: Re: [Sdcc-user] PIC 18F2550 vs. printf/sprintf
>>To: sdcc-user@lists.sourceforge.net
>>Message-ID: <[EMAIL PROTECTED]>
>>Content-Type: text/plain; charset=iso-8859-15
>>
>>Hi,
>>
>>    
>>
>>>For example this works:
>>>printf("%s", "Hello");
>>>But this doesn't:
>>>printf("%d", 7);
>>>
>>>In some case the program seems to hang, other times I only get garbage.
>>>      
>>>
>>printf (varargs in general) are pretty easily confused by type mismatches:
>>Passing a 2-byte int via stack where a 1-byte char is expected can easily
>>break printf's output, though the remainder should remain unaffected (unless
>>some vararg pointer is used to write to memory, in which case a size mismatch
>>in any of the preceeding arguments will cause... say "interesting" results
>>:-(
>>
>>Printf has been reported to work fine; I have been using it myself 
>>successfully.
>>* You may try to use
>>
>>PUTCHAR(char c)
>>{
>> /* output c somehow */
>>}
>>
>>volatile int i;
>>i=7;
>>stdout=STREAM_USER;
>>printf("%s", i);
>>
>>to make sure that a two-byte int is passed to printf.
>>* Also make sure you have selected a proper stdout: AFAIK, stdout is left
>>undefined
>>by default, which causes an undefined putchar routine to be used.
>>* You might also need to define a proper putchar routine (using the PUTCHAR
>>prototype macro,
>>see device/pic16/stdio.h) for use with STREAM_USER.
>>
>>    
>>
>>>Of course I can do this conversion by hand. But I want to check out  
>>>the functions in the library. Am I doing something wrong? Is there a 
>>>      
>>>
>
>  
>
>>>way to make this work?
>>>      
>>>
>>Please try the hints above or report more detailed what you already did;
>>how you want to output your chars;
>>whether you defined PUTCHAR or not;
>>any other possibly helpful info ;-)
>>
>>Regards,
>>Raphael
>>
>>    
>>
>
>Neu: Das erste ADSL-Abo ohne Monatsgebühr! Steigen Sie jetzt auf sunrise
>ADSL free um.
>http://www.sunrise.ch/privatkunden/iminternetsurfen/adsl/adsl_abosundpreise/adsl_gelegenheitssurfer/adsl_free.htm
>
>
>
>
>-------------------------------------------------------------------------
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>_______________________________________________
>Sdcc-user mailing list
>Sdcc-user@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/sdcc-user
>  
>


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to