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 support@ccsinfo.com

Getting iCHIP parameter value over RS232 using PIC16F877 C

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



Joined: 04 Mar 2004
Posts: 5

View user's profile Send private message

Getting iCHIP parameter value over RS232 using PIC16F877 C
PostPosted: Tue Jul 13, 2004 1:04 pm     Reply with quote

Hi,
I am using a PIC16F877 to connect to an iCHIP.
I can't retrive the value of the parameter "webpage"over RS232
It works ok when I use a terminal program using the command
"AT+iwebpage?" and returns "1" I have set the ichip to 9600 baud

//?????????????????????????????????????????????????????????????????
//Can't retrive value 1 over RS232 get nothing so it stays in loop>
//Sends AT+i command"query webpage value" which is 1 over RS232
printf("AT+iwebpage?\r\n");
while (y!='1'){//Wait for 1
y=getc();
}
delay_ms(10000);
//??????????????????????????????????????????????????????????????????

Maybe flushing the RS232 buffer or something?
here is the whole program
#include <16F877.h>
#device *=16
#fuses HS,NOWDT,NOPROTECT,NOLVP,PUT,NOBROWNOUT
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,stream=ichip) // Jumpers: 8 to 11, 7 to 12
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
long agc,temp,ulpa,dlpa,dlcon,ulcon,dllna,ullna,trigger,control0,webpage;
char alarm[8],ip,x,y,a,b,c,d,e,f,g,h,i,j,k,l,z,m,n,o,p,string[30];
main() {
x=a;
while (true){//#3 wait for alarm
printf("AT+iWWW\r\n");//Sends AT+i command"dial modem" over RS232
while (x!='('){//Wait for char ( in I/(xx.xx.xxx.xx)
x=getc();
}
a=getc();
b=getc();
c=getc();
d=getc();
e=getc();
f=getc();
g=getc();
h=getc();
i=getc();
j=getc();
k=getc();
l=getc();
m=getc();
//****************Sends AT+i command"send e-mail" command over RS232 OK*******************************
printf("AT+iEMA:Go to IP Address (%c%c%c%c%c%c%c%c%c%c%c%c%c \r\n",a,b,c,d,e,f,g,h,i,j,k,l,m);
printf(".\r\n");
delay_ms(10000);
//****************Updates parameter tag "webpage" on website-OK***************************************
printf("AT+iwebpage='1'");
printf("\r\n");
delay_ms(10000);

//?????????????????????????????????????????????????????????????????
//Can't retrive value 1 over RS232
//*************Sends AT+i command"query webpage value" which is 1 over RS232
printf("AT+iwebpage?\r\n");
while (y!='1'){//Wait for 1
y=getc();
}
delay_ms(10000);
//??????????????????????????????????????????????????????????????????

//**************Sends AT+i command"send e-mail" command over RS232**************************
printf("AT+iEMA:webpage= %c \r\n",y);
printf(".\r\n");
delay_ms(10000);

}
}

Thanks for your help
carlosma



Joined: 24 Mar 2004
Posts: 53
Location: Portugal

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Wed Jul 14, 2004 4:48 am     Reply with quote

Hello

I do not know the functioning of iCHIP but he seems interesting. It tries
You have a STREAM
Code:

printf("AT+iwebpage?\r\n");
while (y!='1')
{//Wait for 1
y=fgetc(ichip);
}



OR
use a Interrupt to begin see the example EX_SISR.C

Carlos
fred



Joined: 04 Mar 2004
Posts: 5

View user's profile Send private message

PostPosted: Wed Jul 14, 2004 8:29 am     Reply with quote

Carlos-thanks for the reply-I have tried the code but I am still getting no output yet-I am looking into the interupts.
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