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

[SOLVED] Function used but not defined: get_int_usb

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



Joined: 18 Jul 2007
Posts: 427
Location: Montreal,Quebec

View user's profile Send private message

[SOLVED] Function used but not defined: get_int_usb
PostPosted: Tue Sep 25, 2007 9:27 am     Reply with quote

Hi again Smile ,,

after trying to compile my code using the get_int_usb function ,,, it return an error:

Code:

>>> Warning 203 "C:\Program Files\PICC\drivers\pic18_usb.h" Line 504(1,1): Condition always TRUE
>>> Warning 203 "main.c" Line 56(1,1): Condition always TRUE
>>> Warning 203 "main.c" Line 66(1,1): Condition always TRUE
>>> Warning 203 "main.c" Line 160(1,1): Condition always TRUE
>>> Warning 203 "main.c" Line 182(1,1): Condition always TRUE
>>> Warning 202 "C:\Program Files\PICC\drivers\usb_desc_cdc.h" Line 154(16,37): Variable never used:   USB_CLASS_DESCRIPTORS
*** Error 112 "main.c" Line 164(1,1): Function used but not defined:  ... get_int_usb  SCR=6161
      1 Errors,  6 Warnings.


it's not the first time i had this error with get_int_usb ... last time i have avoided it using get_string_usb instead ,,, but now i cant !

Here's my code ... and there's a disclaimer coming with:
The code is not complete NOR near finished ,, lot of debugging still remain ... provided for example Wink


Code:

#include <18F2550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL3,CPUDIV1,VREGEN
#use delay(clock=48000000)
#use  standard_io(A)

#include <usb_cdc.h>
#include <241025.c>

char string[4];
int8 choice;
char streeprom[101];
int32 address;

void receive()
   {
   Output_High(PIN_A5);
   Delay_ms(200);
   Output_Low(PIN_A5);
   }
   
void read_eeprom_string(char * array, int32 address, int32 max_size)
{
   int32 i=0;

   *array=0;

   while (i<max_size)
   {
      *array=read_eeprom(address+i);
      if (*array == 0) {i=max_size;}
      else {
         array++;
         *array=0;
      }
      i++;
   }
}

void write_eeprom_string(char * array, int32 address, int32 max_size)
{
   int32 i=0;

   while (i<max_size) {
      write_eeprom(address+i,*array);
      if (*array == 0) {i=max_size;}
      array++;
      i++;
   }
}

void writecmd()
   {
   printf(usb_cdc_putc,"\r\nADDRESS:");
   while (1)
    {
    if (usb_cdc_kbhit())
      {
      receive();
      address = get_int_usb();
      break;
      }   
   }
   printf(usb_cdc_putc,"\r\nSTRING:");
   while (1)
    {
    if (usb_cdc_kbhit())
      {
      receive();
      get_string_usb(streeprom,101);
      break;
      }   
   }
   write_eeprom_string(streeprom, address, 101);
   
   }

void readcmd()
   {

//add code

   }

void rmodem()
   {

      Output_High(PIN_A0);
      delay_ms(15000);
      output_low(PIN_A0);

   }

void rrouter()
   {
   
   if (!input(PIN_A2))
   {
   Output_High(PIN_A1); //Soft-Off 5Sec
   delay_ms(5000);
   Output_Low(PIN_A1);
   delay_ms(5000);
   Output_High(PIN_A1); //Press power 300ms
   delay_ms(300);
   Output_Low(PIN_A1);
   }
   else
   {
   Output_High(PIN_A1); //Press power 300ms
   delay_ms(300);
   Output_Low(PIN_A1);
   }
   
   }

void main(void) {

delay_ms(5000);
//set_tris_a(0x04); not working :(
Output_High(PIN_A3);
init_ext_eeprom();
usb_cdc_init();
usb_init();


while (TRUE)
   {
   usb_task();

           if (usb_cdc_connected())
           {
           printf(usb_cdc_putc,"\r\n******************");
           printf(usb_cdc_putc,"\r\n**FIRMWARE VERS.**");
           printf(usb_cdc_putc,"\r\n***25/09/07 B00***");
           printf(usb_cdc_putc,"\r\n******************\r\n");
           break;
           }
           if (usb_cdc_kbhit())
               {
                  receive();
                  get_string_usb(string,3);
                 
                  if ((string[0] == '0') && (string[1] == '0')) //Reset Pic
                     {
                     usb_detach();
                     reset_cpu();
                     }
                     
                  if ((string[0] == '*')) //TEST
                     {
                     printf(usb_cdc_putc,"\r\n******************");
                     printf(usb_cdc_putc,"\r\n****DEBUG MODE****");
                     printf(usb_cdc_putc,"\r\n******************");
                     printf(usb_cdc_putc,"\r\n*PRESS 1 TO WRITE*");
                     printf(usb_cdc_putc,"\r\n*PRESS 2 TO READ**");
                     printf(usb_cdc_putc,"\r\n******************\r\n");
                     while (1)
                        {
                        if (usb_cdc_kbhit())
                           {
                           receive();
                           choice = get_int_usb();
                           Switch (choice)
                              {
                              Case 1:
                              writecmd();
                              break;
                              Case 2:
                              readcmd();
                              break;
                              }
                           }
                        }
                     }                     
                     
                  if (string[0] == '0' ) //Freeze Device(Shutdown)
                     {
                     while (1)
                   
                        {
                        Output_Low(PIN_A3);
                        Delay_ms(500);
                        Output_High(PIN_A3);
                        Delay_ms(500);
                        }
                     }
                     
                  if (string[0] == 'L' ) //Clear Reset LED
                     {
                     Output_Low(PIN_A4);
                     }
                     
                  if (string[0] == 'M' ) //reboot the cable modem
                     {
                     Output_High(PIN_A4);
                     rmodem();
                     }
                     
                  if ((string[0] == 'D') && (string[1] == 'M')) //Shutdown Modem
                     {
                     Output_High(PIN_A4);
                     Output_High(PIN_A0);
                     }
                     
                  if ((string[0] == 'D') && (string[1] == 'M')) //Power Modem
                     {
                     Output_High(PIN_A4);
                     Output_Low(PIN_A0);
                     }
                     
                 if (string[0] == 'R' ) //reboot the router
                     {
                     Output_High(PIN_A4);
                     rrouter();
                     }
                 
                 if (string[0] == '9' ) //Reboot both Modem + Router
                     {
                     Output_High(PIN_A4);
                     rmodem();
                     rrouter();
                     }
                     
                     
               }
   }
}


Project Specs:
PIC18F2550 @ 12mhz XTAL
24AA1025 EEPROM
USB to RS232 CCS DEMO Driver
Vers. 4.049

i would just to resolve the get_int_usb problem please Smile

Thank you!


Last edited by ELCouz on Tue Sep 25, 2007 9:39 am; edited 1 time in total
ELCouz



Joined: 18 Jul 2007
Posts: 427
Location: Montreal,Quebec

View user's profile Send private message

PostPosted: Tue Sep 25, 2007 9:37 am     Reply with quote

Quote:
BabYDarK says:
// stdlib.h is required for the ato_ conversions
// in the following functions
#ifdef _STDLIB

BabYDarK says:
add
#include <stdlib.h>
before
#include <usb_cdc.h>


thx i owe you one !
Razz
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