|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Printf
For some reason none of my attempts to send data back with the printf function seem to be working. Regular text seems to be working just fine but when I try to output variables it all just goes downhill.
Is there a simple explanation as to how to get printf working correctly? Thanks |
|
#2
|
||||
|
||||
|
Re: Printf
Seems like the printf header file with the handy usage instructions has disappeared along with the function's C code, into FRC_library.lib I would think.
Anyway, if the the syntax from last year's code still applies it should be something like: Code:
printf("Myvariable = %d\r", (int)myvariable);
|
|
#3
|
|||
|
|||
|
Re: Printf
Quote:
|
|
#4
|
|||
|
|||
|
Re: Printf
There's a copy of printf in the C library supplied by Microchip. In fact you can look at the source code in the src directory in the mcc18 install.
It implements most of the standard printf features except floating point. And does support longs and some of the other data types. Be sure that the abridged version of printf that was supplied in the past is not part of your project, otherwise the linker will give you that one instead of the Microchip version. The documentation for printf is in section 4.7 of the MPLab C18 Libraries PDF document. Kevin Watson has been making that easily available to teams on his web site that you can download. |
|
#5
|
|||
|
|||
|
Re: Printf
Quote:
|
|
#6
|
|||
|
|||
|
Re: Printf
Finally got it working, I don't know why I was having so much trouble before...
Thanks a lot for all your help. On a somewhat related note - When I connect via the program port to download code I get the window IFI> and any of my printf's are displayed. Is there anyway to read this from the dashboard port or by method other than downloading code? Thanks |
|
#7
|
|||
|
|||
|
Re: Printf
We are getting spurious newlines in code used last year to print the new values of digital and analog inputs when values change. Is anyone seeing spurious linebreaks from printf?
|
|
#8
|
|||
|
|||
|
Re: Printf
Quote:
|
|
#9
|
|||
|
|||
|
Re: Printf
Quote:
|
|
#10
|
|||||
|
|||||
|
Re: Printf
Quote:
Good luck! JBotAlan |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| printf could not find definition | Alex829 | Programming | 7 | 27-06-2005 10:04 |
| Printf Oddity : Programming Challange | DarkAlex | Programming | 7 | 21-03-2005 08:12 |
| printf statements do not display in autonomous mode | PVC Pirates | Programming | 3 | 22-02-2005 15:41 |
| Default Code and printf | WilsonDJ00 | Programming | 2 | 22-01-2005 16:39 |
| Anyone with a replacement Printf? | Larry Barello | Programming | 5 | 19-03-2004 02:20 |