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

ex17.c error (PPP)

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



Joined: 30 Oct 2010
Posts: 5

View user's profile Send private message

ex17.c error (PPP)
PostPosted: Mon Nov 01, 2010 10:54 am     Reply with quote

Hello,

I have internet development kit that have pic18f6722.

I want to use ppp to make a simple server.
The code compiles with no errors. But when run it on the kit nothing appear on LCD.
I have put printf functions in the main function to determine where is the error. I found that when it call "StackInit();" it does not exit the function so it does not execute the printf functions after the calling.

How can I fix it so I can connect using the dial up modem ?
Below in the main function of ex17.c , the problem is inside comments:

Code:
void main(void) {
   MODEM_RESP resp;
   char x;
   
   MACAddrInit();
   IPAddrInit();

   ISPInit();

   setup_adc_ports(ANALOG_AN0_TO_AN1);
   set_tris_a(3);    //set A0 and A1 to input for ADC
   set_tris_b(0);
   setup_adc(ADC_CLOCK_INTERNAL);

   lcd_init();
   









///////////////////////////////////////////////////////////////////////////////////
//here the problem happens


   StackInit();

// it does not exit from this function call
//////////////////////////////////////////////////////////////////////////////////






   
   while(TRUE) {
      if (!ppp_is_connected() && !ppp_is_connecting()) {
         printf(lcd_putc,"\fDialing");
         resp=ppp_connect(ppp_username, ppp_password, ppp_phonenumber);
         if (resp==MODEM_BUSY) {
            printf(lcd_putc,"\fBusy Signal");
            delay_ms(2000);
         }
         else if (resp==MODEM_NO_DIALTONE) {
            printf(lcd_putc,"\fNo Dialtone");
            delay_ms(2000);
         }
         else if (resp!=MODEM_CONNECTED) {
            printf(lcd_putc,"\fDial Error");
            delay_ms(2000);
         }
         else {
            printf(lcd_putc,"\f%LUbps", connected_baudrate);
            printf(lcd_putc,"\nNegotiating PPP");
         }
      }
      StackTask();
      HTTPTask();
      LCDTask();
   }
}
murad772



Joined: 30 Oct 2010
Posts: 5

View user's profile Send private message

PostPosted: Mon Nov 01, 2010 11:06 am     Reply with quote

The error happens in the file called "Ex17.c" that comes with tcpip files
murad772



Joined: 30 Oct 2010
Posts: 5

View user's profile Send private message

PostPosted: Tue Nov 09, 2010 12:34 pm     Reply with quote

UP ..

Please help.
When trace the code I found that the problem happens in the following loop:

while(kbhit(MODEM)) {fgetc(MODEM);}

it keeps looping. that code in the function "modem_init" in the file modem.c[/code]
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