Christian
Joined: 11 Nov 2005 Posts: 6
|
Help Using get_string!! |
Posted: Fri Nov 11, 2005 8:19 pm |
|
|
I'm trying to learn how to use serial coms. At the moment I want to send a string of character to the pic and for the pic to send them back.
The header is:
Code: | #include <16F88.h>
#device adc=8
#use delay(clock=20000000)
#fuses NOWDT,HS, NOPUT, NOMCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG, NOPROTECT, FCMEN, IESO
#use rs232(baud=9600,parity=N,xmit=PIN_B5,rcv=PIN_B2,bits=8,errors) |
And code:
Code: | #include "C:\Documents and Settings\C\Desktop\Test\Test_5.h"
#include "C:\Program Files\PICC\Drivers\input.c"
setup_adc_ports(no_analogs);
//int string;
//string = 5;
void main()
{
int string;
printf("Start \n\r");
while(1);
{
get_string(string,5);
printf("%U \n\r",string);
}
} |
Thanks
-Christian
Last edited by Christian on Fri Nov 11, 2005 9:21 pm; edited 1 time in total |
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Nov 11, 2005 8:28 pm |
|
|
Quote: |
I'm trying to learn how to use serial coms. At the moment I want to send
a string of character to the pic and for the pic to send them back.
int string;
get_string(string,5);
|
Look at the CCS example file, EX_STR.C, which has an example
of how to declare the variable used as the first parameter in get_string().
You need to do it in a similar way. EX_STR.C is in this folder:
c:\Program Files\Picc\Examples |
|