|
|
View previous topic :: View next topic |
Author |
Message |
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
fprintf misunderstanding? |
Posted: Sun Feb 03, 2008 2:12 pm |
|
|
I am not sure if this is a bug or my misunderstanding. I am using 4.053
I have the following declarations
Code: |
#use rs232(baud=115200,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#use rs232(baud=115200,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8, STREAM=CONSOLE)
#use rs232(baud=2400,parity=N,xmit=PIN_G1,rcv=PIN_G2,bits=8, STREAM=DATA)
|
If I do this..
Code: |
fprintf(DATA,"This is on the DATA port\r\n");
printf("This should be on the CONSOLE port\r\n)"
|
Both lines print on the DATA port. But if I do the following
Code: |
fprintf(DATA,"This is on the DATA port\r\n");
fprintf(CONSOLE,"This is on the Console port\r\n");
printf("This should be on the CONSOLE port\r\n)"
|
Then the data message appears on the data port and the CONSOLE messages both appear on the console port. It appears the printf uses the output routines from the last STREAM.
Is this what is supposed to happen? _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Feb 03, 2008 2:50 pm |
|
|
Yes, I think so. If you use streams, everything should be a stream.
This includes the declarations and the print statements. |
|
|
Ttelmah Guest
|
|
Posted: Sun Feb 03, 2008 3:22 pm |
|
|
Historically, STDIO (which is what is used without a stream declaration), is always the _last_ #USE RS232 declaration the compiler has met. This is still true.
Best Wishes |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Sun Feb 03, 2008 3:27 pm |
|
|
In this case it is now broken. The stdio changes to whatever last fprintf stream was used. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|