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

Duplicate Interrupt function error - w/o dup function

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



Joined: 11 Sep 2007
Posts: 18

View user's profile Send private message

Duplicate Interrupt function error - w/o dup function
PostPosted: Wed Dec 12, 2007 1:29 pm     Reply with quote

When I include the following in my program:
Code:
#int_global
void isr_global(){
    if(in_app)
        jump_to_isr(LOADER_END+5*(getenv("BITS_PER_INSTRUCTION")/8));
    else
        jump_to_isr(5*(getenv("BITS_PER_INSTRUCTION")/8) - 1);       
}

I get the following message.
Quote:
*** Error 92 "usb_loader.c" Line 376(0,1): Duplicate Interrupt function
1 Errors, 2 Warnings.

The line number corresponds to one line beyond the end of the module.

There are no other #int_global statements in any of the code.

What do I have to do to override the default int_global.

This project includes USB code from the CCS library.

Robert Ramey
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 12, 2007 1:41 pm     Reply with quote

Quote:

I get the following message:

Duplicate Interrupt function

This project includes USB code from the CCS library.


The CCS manual says:
Quote:

#int_global
This directive causes the following function to replace the compiler
interrupt dispatcher.

Some of the CCS USB files contain interrupt handlers for INT_USB and
other interrupts. Once you put in the #int_global directive, it replaces
the normal CCS interrupt dispatcher code, and there's no way for the
program to ever reach the #INT_USB handler. This means that you
must put in code in the #int_global routine to call the INT_USB handler.
You can't use the #int_usb directive any more.
ibsumith



Joined: 24 Jul 2009
Posts: 21

View user's profile Send private message

PostPosted: Wed Aug 19, 2009 11:29 pm     Reply with quote

Code:
// CCS USB Libraries
#include <pic18_usb.h>          //Microchip 18Fxx5x hardware layer for usb.c
#include <usb_desc_hid.h>       //USB Configuration and Device descriptors for this UBS device
#include <usb.c>                //handles usb setup tokens and get descriptor reports
//#include <usb_cdc.h>
//#include <usb.h>
#include <usbn960x.c>


#define LED_ON output_high      //output_high SETS GIVEN PIN TO HIGH
#define LED_OFF output_low      //output_low SETS GIVEN PIN TO LOW
#define DELAY 1000

int8 out_data[2];   
int8 in_data[2]; 



#int_usb        //interrupt fires when receive data available
void serial_isr()
{
delay_ms(20);
LED_ON(LEDG);
return;
}


void main() {
//  int8 out_data[2];   
//  int8 in_data[2];   
  enable_interrupts(global);
  enable_interrupts(int_usb);
  ext_int_edge(L_TO_H);
   usb_init();
   LED_OFF(LEDR);
   usb_task();                  //Will call usb_attach().To attach USB Device to the bus.
   usb_wait_for_enumeration();
   if(usb_enumerated()){       //Checks if device Enumeration Successful or Not
      LED_ON(LEDR);
      delay_ms(DELAY);
        LED_OFF(LEDR);
       delay_ms(DELAY);   
       LED_ON(LEDG);
      delay_ms(2000);   
      LED_OFF(LEDG);
     }
   else
      LED_OFF(LEDR);

  #if defined(AN0)                  //Enabling Port for Communication
   setup_adc_ports(AN0);
  #elif defined(AN0_AN1_AN3)
   setup_adc_ports(AN0_AN1_AN3);
  #else
   #error CONFIGURE ADC PORTS SO WE CAN READ CHANNEL 0
  #endif
  setup_adc(ADC_CLOCK_INTERNAL);
  set_adc_channel(0);

   
   while(input(BUTTON))  //Initially Button Status is High
   {
      LED_ON(LEDR);
      delay_ms(100);
      LED_OFF(LEDR);
      delay_ms(100);
      
   }
   

//   delay_ms(1000);
}


Duplicate Interrupt function
The same problem what should i do????
What changes I should do???
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 19, 2009 11:44 pm     Reply with quote

Quote:

#include <pic18_usb.h>
#include <usb_desc_hid.h>
#include <usb.c>
#include <usbn960x.c>

#int_usb
void serial_isr()
{
delay_ms(20);
LED_ON(LEDG);
return;
}

Duplicate Interrupt function
The same problem what should i do????
What changes I should do???

Get a text search utility program, such as Examine32. Search the
entire CCS directory for .c and .h files that contain #int_usb.
Quote:
c:\Program Files\Picc


Here are the results. Look for filenames that are the same as the
ones that you have #include'd in your program. They are shown
in bold below:
Quote:

c:\program files\picc\drivers\pic18_usb.c
#int_usb NOCLEAR

c:\program files\picc\drivers\pic24_usb.c
#int_usb

c:\program files\picc\drivers\pic_usb.c
#int_usb

c:\program files\picc\usb\pic source\drivers\pic_usb.h
#int_usb

c:\program files\picc\usb\pic source\drivers\pic18_usb.h
#int_usb

Since #int_usb is in one of the files that you have included, either:
1. Don't include that file.
or
2. Remove the #int_usb routine from your main program.

You can only have one #int_usb in your program.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Aug 20, 2009 12:23 am     Reply with quote

I understand, that you intend to create a second interrupt dispatcher (to switch between bootloader and regular application interrupt processing) in front of the default dispatcher. This simply doesn't work with CCS C.

By using #int_global, the complete CCS C interrupt processing is removed from the code. The below line jumps to nowhere.
Code:
jump_to_isr(5*(getenv("BITS_PER_INSTRUCTION")/8) - 1);

If you want to do it that way, you have to reproduce the complete interrupt dispatcher code up to the interrupt functions present in your code.
ibsumith



Joined: 24 Jul 2009
Posts: 21

View user's profile Send private message

plse help me
PostPosted: Thu Aug 20, 2009 5:42 am     Reply with quote

I am trying to communicate to usb using interrupts. If device endpoint contains data to read an interrupt should be generated. The code should go to an ISR so it can get the value. I want to generate an interrupt when an endpoint contain data to read or data is available in the endpoint. Is it possible using Interrupt? I was doing it by using polling.
Ttelmah
Guest







PostPosted: Thu Aug 20, 2009 3:25 pm     Reply with quote

I think you slightly 'miss' the frequency of USB interrupts.
Unlike conventional serial, where you will only get an interrupt when data is being transferred, in USB, the interrupt wll be occuring for internal packets to do with the interface, as well as ones carrying data. To do what you want, you need to use the existing USB interrupt handler, and add a test at the end of it, to see if data has arrived, and only if this is true, call your code.
Normally much easier to just poll the status functions to see if data has arrived for you.....

Best Wishes
ibsumit
Guest







PostPosted: Sat Aug 22, 2009 3:50 am     Reply with quote

thank you............................. Smile ......................................
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