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 CCS Technical Support

Get a word using pic16f877a

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



Joined: 15 Feb 2012
Posts: 39
Location: italia

View user's profile Send private message AIM Address MSN Messenger ICQ Number

Get a word using pic16f877a
PostPosted: Mon Mar 05, 2012 1:52 pm     Reply with quote

Hello everyone! Can anyone please tell me how to obtain a word for example 'Heeey' from the rx of the pic using rs232 and depending on this word make a specific function. I programmed a pic using a single character with the specific job,but how can i do that using a word or more than one letter!!?!??!!?
in other words how to read a string not a character.
Thanks 4 reading
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Mon Mar 05, 2012 2:17 pm     Reply with quote

you get more than one character the same way you put on your pants.

One leg at a time. Or one character byte at a time if it is serial data .....

ideally with a character array, advancing a pointer to thr next place to PUT a receiver character as you go.

There are MANY examples of how to do this including using interrupts on
RX data ready - to help speed the plow for you.
karimpain



Joined: 15 Feb 2012
Posts: 39
Location: italia

View user's profile Send private message AIM Address MSN Messenger ICQ Number

PostPosted: Mon Mar 05, 2012 2:36 pm     Reply with quote

Thanks but can you give me a link of a code or anything else!!
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Mon Mar 05, 2012 2:46 pm     Reply with quote

there is a wonderful buffered example for getting LOTS of characters into a buffer string called EX_SISR.C , found
in your CCS examples folder

plenty of guidance there on your exact problem.
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Mar 05, 2012 2:59 pm     Reply with quote

press F11 when your project is open
karimpain



Joined: 15 Feb 2012
Posts: 39
Location: italia

View user's profile Send private message AIM Address MSN Messenger ICQ Number

PostPosted: Mon Mar 05, 2012 6:34 pm     Reply with quote

thanks, i m going to take a look.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 05, 2012 7:34 pm     Reply with quote

Look at the get_long() function in the input.c file:
Quote:

c:\program files\picc\drivers\input.c


Here are two CCS example files that show how to use get_long():
Quote:

c:\program files\picc\examples\ex_pll.c
chan_num = get_long();

c:\program files\picc\examples\ex_malloc.c
num = get_long();


To use get_long(), you should connect your PIC board to your PC with
an RS-232 cable. Then open a terminal window on your PC, by using
a program such as TeraTerm. You can type in any number in the
range from -32768 to 32767. You must press the Enter key when done
typing the number. The get_long() function will get the number and
convert it to a 'signed int16' value and you can save it in a variable
in your PIC program.
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