PIC COM port problems...
Posted: 24 Nov 2010 19:52
Hello fellows!
well.. Im using P12F675 4MHz
and Im trying to make it read my Serial port COM2 RS-232.
my PIC needs to receive a default string, sent by a Delphi application.
this string will be compared with our defaults.
Im trying to use this code:
void main()
{
FILE * fp;
fp = fopen(fp,COM2);
if(strcmp(fgets(fp),"OpnFl")==0)
{
Unlock();
}
else if(strcmp(fgets(fp),"ClsFl")==0)
{
Lock();
}
fclose(fp);
}
My delphi application will send "OpnFl" or "ClsFl" for my COM2 port.
then my pic needs to read those strings. and then, make different blocks according the match.
do I need libraries? whitch ones?
but this is not working properly. What should I do?
thanks!
well.. Im using P12F675 4MHz
and Im trying to make it read my Serial port COM2 RS-232.
my PIC needs to receive a default string, sent by a Delphi application.
this string will be compared with our defaults.
Im trying to use this code:
void main()
{
FILE * fp;
fp = fopen(fp,COM2);
if(strcmp(fgets(fp),"OpnFl")==0)
{
Unlock();
}
else if(strcmp(fgets(fp),"ClsFl")==0)
{
Lock();
}
fclose(fp);
}
My delphi application will send "OpnFl" or "ClsFl" for my COM2 port.
then my pic needs to read those strings. and then, make different blocks according the match.
do I need libraries? whitch ones?
but this is not working properly. What should I do?
thanks!