View previous topic :: View next topic |
Author |
Message |
atabac_2000
Joined: 21 Apr 2004 Posts: 10
|
how does the "stream" option of #use rs232 work? |
Posted: Thu Jun 03, 2004 10:07 pm |
|
|
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: 1933 Location: Norman, OK
|
Stream |
Posted: Thu Jun 03, 2004 10:18 pm |
|
|
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
|
Re: Stream |
Posted: Thu Jun 03, 2004 10:19 pm |
|
|
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
|
Re: Stream |
Posted: Thu Jun 03, 2004 11:07 pm |
|
|
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
|
|
Posted: Fri Jun 04, 2004 12:03 am |
|
|
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 |
|
|
|