View previous topic :: View next topic |
Author |
Message |
nuqem
Joined: 15 Dec 2009 Posts: 4
|
FX buffer |
Posted: Mon Apr 19, 2010 10:06 am |
|
|
Hi!
I have a project with pic 16f877a, in which I have to use serial port for communicating with device.
My problem is with the printf.... so how can I send more than 50(100) characters with printf() without splitting them. I want to use arrays.
Can somebody show me a simple explanation of using arrays.
Thanks |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Mon Apr 19, 2010 10:48 am |
|
|
I'm afraid the number of characters that your printf() function can handle is limited by the RAM of the part. If you want to print more characters in the same printf() function then you will need to select a part with more RAM. Otherwise, simply do multiple printf() statements in succession. I've had to do that with very long strings that needed to be sent. It doesn't hurt anything, just can be a pain.
Ronald |
|
|
nuqem
Joined: 15 Dec 2009 Posts: 4
|
|
Posted: Wed Apr 21, 2010 11:10 am |
|
|
Thanks for the answer!
Meantime I try some simple program, but not working.. can somebody look at whats wrong:
Code: |
#INCLUDE<16f877a.h>
#USE delay(clock=4000000)
#fuses XT,NOWDT,NOPUT,NOPROTECT,NOBROWNOUT,NOCPD,NOWRT,NOLVP
#use rs232(baud=2400, xmit=PIN_C6, rcv=PIN_C7,BITS=8)
#include <ctype.h>
void main()
{
unsigned char k[3];
int i;
k[0]='c';
k[1]='a';
k[2]='l';
while(1)
{
for (i=0;i<3;i++)
{
putc(k[i]);
}
}
}
|
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Apr 21, 2010 1:47 pm |
|
|
It works for me. I tested it in hardware and I got this on the terminal window:
Quote: | calcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalc
alcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcal
calcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalcalc |
This was tested with compiler vs. 4.106. |
|
|
nuqem
Joined: 15 Dec 2009 Posts: 4
|
|
Posted: Thu Apr 22, 2010 9:23 am |
|
|
O.. yeah.. its really workin... Its my fault... i put a wrong cable.....
Thanks!!!! |
|
|
|