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

how does the "stream" option of #use rs232 work?

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



Joined: 21 Apr 2004
Posts: 10

View user's profile Send private message

how does the "stream" option of #use rs232 work?
PostPosted: Thu Jun 03, 2004 10:07 pm     Reply with quote

has anyone tried using "stream" option of #use rs232? can it be used to check stream of headers that you want to test instead of using a ram to store incoming data? how then will u use it in your program?
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

Stream
PostPosted: Thu Jun 03, 2004 10:18 pm     Reply with quote

Look at the readme.txt file in the PICC directory. It explains how stream is used to redirect RS232 input and output to multiple sources/destinations.

Also see this post I found using search on this board:

http://www.ccsinfo.com/forum/viewtopic.php?t=18543&


Last edited by dyeatman on Thu Jun 03, 2004 10:20 pm; edited 1 time in total
atabac_2000



Joined: 21 Apr 2004
Posts: 10

View user's profile Send private message

Re: Stream
PostPosted: Thu Jun 03, 2004 10:19 pm     Reply with quote

dyeatman wrote:
Look at the readme.txt file in the PICC directory. It explains how stream is used to redirect RS232 input and output to multiple sources/destinations


ok
atabac_2000



Joined: 21 Apr 2004
Posts: 10

View user's profile Send private message

Re: Stream
PostPosted: Thu Jun 03, 2004 11:07 pm     Reply with quote

dyeatman wrote:
Look at the readme.txt file in the PICC directory. It explains how stream is used to redirect RS232 input and output to multiple sources/destinations.



i still got some questions
Code:
     

#use rs232(baud=9600,xmit=pin_c6,rcv=pin_c7,stream=HOSTPC)
      #use rs232(baud=1200,xmit=pin_b1,rcv=pin_b0,stream=GPS)
      #use rs232(baud=9600,xmit=pin_b3,stream=DEBUG)
      ...
      while(TRUE) {
         c=fgetc(GPS);
         fputc(c,HOSTPC);
         if(c==13)
           fprintf(DEBUG,"Got a CR\r\n");
      }


what datatype is HOSTPC is it a defined constatnt or another ? also the same with GPS and DEBUG???
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 04, 2004 12:03 am     Reply with quote

Quote:

Has anyone tried using "stream" option of #use rs232? can it be used to
check stream of headers that you want to test instead of using a ram to
store incoming data? how then will u use it in your program ?

A "stream" is a name for a hardware or software USART that you
define on specified pins of your PIC. It's just a name.

Once you define the USART name ("stream"), then you can use
that name in some CCS functions that support it. For example,
referring to the sample code posted earlier in this thread, to get
a character from the USART on pins C6 and C7, you would do:

c = fgetc(HOSTPC);

To get a character from the USART on pins B0 and B1, you would do:

c = fgetc(GPS);

So you can see that "streams" are just a way of giving a USART a name.
Then you can easily specify which USART you want to use at the moment.

I think you were hoping that a "stream" would be some magic way to
parse a stream of GPS data. But it's not. Basically, there are no
magic functions in CCS. They are all fairly low-level functions.
If you want to parse some GPS data, you must write the code to do it.
Sometimes the CCS example files may help. Look in this folder
for examples: c:\Program Files\Picc\Examples
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