Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Undeclared Identifier 'USB_Interrupt_Proc' - HELP

Status
Not open for further replies.

eebhoi01

Advanced Member level 4
Joined
Feb 22, 2012
Messages
116
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
2,347
Hello guys,

I am studying how to use PIC18 right now, I have found a good example here in edaboard https://www.edaboard.com/blog/1512/. I am sure I did follow the instructions in here, but I am stuck in "build" process. I can't build the project because MikroC says the error Undeclared Identifier 'USB_Interrupt_Proc'.

Code:
unsigned char Read_Buffer[16] absolute 0x500;
unsigned char Write_Buffer[16]absolute 0x510;
unsigned char num,flag;




void interrupt()
{
 USB_Interrupt_Proc();
 TMR0L = 100;             //Reload Value
 INTCON.TMR0IF = 0;       //Re-Enable Timer-0 Interrupt
}

//LCD 8-bit Mode Connection
sbit LCD8_RS at RC1_bit;
sbit LCD8_RW at RC0_bit;
sbit LCD8_EN at RC2_bit;
sbit LCD8_D7 at RD7_bit;
sbit LCD8_D6 at RD6_bit;
sbit LCD8_D5 at RD5_bit;
sbit LCD8_D4 at RD4_bit;
sbit LCD8_D3 at RD3_bit;
sbit LCD8_D2 at RD2_bit;
sbit LCD8_D1 at RD1_bit;
sbit LCD8_D0 at RD0_bit;

sbit LCD8_RS_Direction at TRISC1_bit;
sbit LCD8_RW_Direction at TRISC0_bit;
sbit LCD8_EN_Direction at TRISC2_bit;
sbit LCD8_D7_Direction at TRISD7_bit;
sbit LCD8_D6_Direction at TRISD6_bit;
sbit LCD8_D5_Direction at TRISD5_bit;
sbit LCD8_D4_Direction at TRISD4_bit;
sbit LCD8_D3_Direction at TRISD3_bit;
sbit LCD8_D2_Direction at TRISD2_bit;
sbit LCD8_D1_Direction at TRISD1_bit;
sbit LCD8_D0_Direction at TRISD0_bit;
// End Lcd8 module connections

char i;                              // Loop variable

void UART1_Write_Text_Newline(unsigned char msg[])
{
 UART1_Write_Text(msg);
 UART1_Write(10);
 UART1_Write(13);
}

void clear_buffer(unsigned char buffer[])
{
 unsigned int i = 0;
 while(buffer[i] != '\0')
 {
  buffer[i] = '\0';
  i++;
 }
}

//
void main()
{

  UART1_Init(9600);
  Delay_ms(100);
  UART1_Write_Text("USB Test Program");

  ADCON1 |= 0x0F;                    // Configure AN pins as digital
  CMCON  |= 7;                       // Disable comparators
  TRISB = 0x00;
  TRISC = 0x80;
  Lcd8_Init();                       // Initialize Lcd8
  Delay_ms(100);
  Lcd8_Cmd(_LCD_CLEAR);              // Clear display
  Delay_ms(100);
  Lcd8_Cmd(_LCD_CURSOR_OFF);         // Cursor off
  Delay_ms(100);

  Lcd8_Out(1,3,"PIC18F4550");                // Write text in first row
  Delay_ms(100);
  Lcd8_Out(2,3,"USB Example!");                // Write text in second row
  Delay_ms(2000);
  INTCON = 0;
  INTCON2 = 0xF5;
  INTCON3 = 0xC0;
  RCON.IPEN = 0;
  PIE1 = 0;
  PIE2 = 0;
  PIR1 = 0;
  PIR2 = 0;
  //
  // Configure TIMER 0 for 3.3ms interrupts. Set prescaler to 256
  // and load TMR0L to 100 so that the time interval for timer
  // interrupts at 48MHz is 256.(256-100).0.083 = 3.3ms
  //
  // The timer is in 8-bit mode by default
   T0CON = 0x47; // Prescaler = 256
   TMR0L = 100; // Timer count is 256-156 = 100
   INTCON.TMR0IE = 1; // Enable T0IE
   T0CON.TMR0ON = 1; // Turn Timer 0 ON
   INTCON = 0xE0; // Enable interrupts
   //
 // Enable USB port
 //

 UART1_Write(10);
 UART1_Write(13);
 UART1_Write_Text_Newline("Data is Ready to be Received from the PC");

 Hid_Enable(&Read_Buffer,&Write_Buffer);
 Delay_ms(2000);

 // Read from the USB port. Number of bytes read is in num
  start:
  while(Hid_Read() == 0);    //Stay Here if Data is Not Coming from Serial Port
  //If Some Data is Coming then move forward and check whether the keyword start is coming or not
  if(strncmp(Read_Buffer,"S",1) == 0)
  {
  Lcd8_Cmd(_LCD_CLEAR);
  Lcd8_Out(1,2,"Authentication");
  Lcd8_Out(2,8,"OK");
  goto loop;
  }
  else
 {
  Lcd8_Cmd(_LCD_CLEAR);
  Lcd8_Out(1,2,"Authentication");
  Lcd8_Out(2,5,"Fails!");
  goto start;
 }
 loop:

  //Now Authentication is Successfull Lets Try Something else
  //Lets Display the Data Coming from the USB HID Port to the LCD
   Delay_ms(1000);
   Lcd8_Cmd(_LCD_CLEAR);
   Lcd8_Out(1,1,"Received Data:-");
   flag = 0;

 loop_second:
 clear_buffer(Read_Buffer);
 while(Hid_Read() == 0)
 {
  if(flag == 0)
  {
   Lcd8_Out(2,1,"No Data");
   flag = 1;
  }
 }
 Lcd8_Cmd(_LCD_CLEAR);
 Lcd8_Out(1,1,"Received Data:-");
 Lcd8_Out(2,1,Read_Buffer);
 goto loop_second;
 Delay_ms(1000);
 Hid_Disable();
 Lcd8_Out(1,1,"HID DISABLE");
}


By the way I am using PIC18f4550 - MikroC - Proteus in my study. Also the 'USB_Interrupt_Proc' isn't corrected by MikroC (underlined with a red fuzzy line), I think my USB library is enabled that makes me confused more why is this so.

P.S I also have tried running the example of MikroC about USB in the "help". When I build it, it says the same error.

Looking forward for your help guys.
 

You need to add this descriptor file into your Project.

Go to Project --> Add Files to Project
 

You need to add this descriptor file into your Project.

Go to Project --> Add Files to Project

Thank you for your reply, but i already have done including the descriptor in the project ^_^...
 

You have to check the USB Library in the Library Manager. Have you added the descriptor file to your project?
Zip and post your mikroC files and proteus .dsn file.
 

Attachments

  • usb.jpg
    usb.jpg
    230.2 KB · Views: 106

You have to check the USB Library in the Library Manager. Have you added the descriptor file to your project?
Zip and post your mikroC files and proteus .dsn file.



here it is sir...



by the way the descriptor file is named "HIDsample"
 

Attachments

  • sample.rar
    19.4 KB · Views: 55

I am not getting the error you mentioned. I am getting the errors shown in the attached image. Try to reinstall mikroC.
 

Attachments

  • mikroC output.jpg
    mikroC output.jpg
    275.9 KB · Views: 220

I am not getting the error you mentioned. I am getting the errors shown in the attached image. Try to reinstall mikroC.


Really Sir? I guess I have to reinstall mikroC then. THank you

- - - Updated - - -

I am not getting the error you mentioned. I am getting the errors shown in the attached image. Try to reinstall mikroC.


Really Sir? I guess I have to reinstall mikroC then. THank you
 

It is working. See the attached image. You had selected wrong PIC. Instead of selecting PIC18F4550 you had selected PIC18F4450.
 

Attachments

  • usb 2.jpg
    usb 2.jpg
    440.4 KB · Views: 83
yes I have same problem usb1 project from advanced PIC Microcontroller projects in c with PIC18f
Undeclared Identifier 'USB_Interrupt_Proc'
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top