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

Retriving iCHIP parameter value over RS232 using PIC16F877

 
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

Retriving iCHIP parameter value over RS232 using PIC16F877
PostPosted: Thu Mar 04, 2004 7:54 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);
//??????????????????????????????????????????????????????????????????


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);

}
}
Andre Jr. Richard



Joined: 23 Sep 2003
Posts: 6

View user's profile Send private message

PostPosted: Mon May 31, 2004 8:28 am     Reply with quote

Hello Fred, I'm new with ichip.

In a month I will program them everyday, so I thing it is possible that we can help us if we exchange.

May it possible to ask you some question ?

which ichip do you use ?

thanks !

André
Ttelmah
Guest







PostPosted: Mon May 31, 2004 10:21 am     Reply with quote

I'd suggest that the problem is possibly the 'loss' of the first character in the AT string. Unless you have resistors to pull the line to the 'idle' level (high at the PIC), or program the line high at the start of the code, the line will be sitting as an input, till you start to use it. The falling edge on the first bit of the command string will then be missed, and the unit fail to respond (and hence you don't get the reply). Try adding
output_high(PIN_C6);
delay_ms(2);

at the start of main, and see if it then works.

Best Wishes
fred



Joined: 04 Mar 2004
Posts: 5

View user's profile Send private message

PostPosted: Tue Jul 13, 2004 12:49 pm     Reply with quote

Ttelmah wrote:
I'd suggest that the problem is possibly the 'loss' of the first character in the AT string. Unless you have resistors to pull the line to the 'idle' level (high at the PIC), or program the line high at the start of the code, the line will be sitting as an input, till you start to use it. The falling edge on the first bit of the command string will then be missed, and the unit fail to respond (and hence you don't get the reply). Try adding
output_high(PIN_C6);
delay_ms(2);

at the start of main, and see if it then works.

Best Wishes


Ttelmah thanks for the help....I tried this....no luck yet.

Any other ideas would be appreciated.
fred



Joined: 04 Mar 2004
Posts: 5

View user's profile Send private message

PostPosted: Tue Jul 13, 2004 12:52 pm     Reply with quote

Andre Jr. Richard wrote:
Hello Fred, I'm new with ichip.

In a month I will program them everyday, so I thing it is possible that we can help us if we exchange.

May it possible to ask you some question ?

which ichip do you use ?

thanks !

André


Using the iConnector and the CO561
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