CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

FX buffer

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
nuqem



Joined: 15 Dec 2009
Posts: 4

View user's profile Send private message

FX buffer
PostPosted: Mon Apr 19, 2010 10:06 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 19, 2010 10:48 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 21, 2010 11:10 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 21, 2010 1:47 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Apr 22, 2010 9:23 am     Reply with quote

O.. yeah.. its really workin... Its my fault... i put a wrong cable.....
Embarassed

Thanks!!!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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