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

Defining ISRs for Input Capture IC7 and IC8 in dsPIC30F4013
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Satish Kolloor



Joined: 01 Jan 2009
Posts: 8
Location: Singapore

View user's profile Send private message

Defining ISRs for Input Capture IC7 and IC8 in dsPIC30F4013
PostPosted: Fri Jan 02, 2009 3:56 am     Reply with quote

The device header file for dsPIC30F4013 device does not include defines for INT_IC7 and INT_IC8. Only INT_IC1 and INT_IC2 are defined.

Because of this, I am unable get ISRs for IC7 and IC8 compiled .
I get the error message "Invalid PreProcessor Directive" during compilation using PCWHD compiler that supports this device.

Adding the defines in the header file by modifying it does not solve the problem. Changing the values for the defines of IC7 and IC8 to any unused value below 64 also gives the same error message.

The portion of header file and body of the ISRs are attached.
ISR for IC1 and IC2 compile OK. Issue is with IC7 and IC8 .

Does anyone have come across this problem and have a fix for this ?
Thanks in advance for any suggestion.

Part of 30F4013.h header file is as shown below:
Code:

#define INTR_CN_PIN              0x8000  // or in a PIN_xx constant
#define INT_OSCFAIL              1
#define INT_ADDRERR              2
#define INT_STACKERR             3
#define INT_MATHERR              4
#define INT_DMAERR               5
#define INT_EXT0                 6
#define INT_IC1                  7
#define INT_OC1                  8
#define INT_TIMER1               9
#define INT_IC2                   10
#define INT_OC2                   11
#define INT_TIMER2               12
#define INT_TIMER3               13
#define INT_SPI1                   14
#define INT_RDA                   15
#define INT_TBE                    16
#define INT_ADC1                 17
#define INT_EEPROM              18
#define INT_SI2C                  19
#define INT_MI2C                  20
#define INT_CNI                    21
#define INT_EXT1                  22
#define INT_IC7                    23      //   added to support IC7
#define INT_IC8                    24      //   added to support IC8
#define INT_EXT2                  35
#define INT_RDA2                 36
#define INT_TBE2                  37
#define INT_CAN1                 39
#define INT_LOWVOLT           64

#list
----------------------  end of header file ------------------------------------
 
//ISR Routines
 
#INT_IC1
void  IC1_isr(void)
{

 }
 
#INT_IC2
void  IC2_isr(void)
{
 
}
 
#INT_IC7
void IC7_isr(void)
{
 
}
 
#INT_IC8
void IC8_isr(void)
{
 
}
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Jan 02, 2009 4:16 am     Reply with quote

The said device.h entries are used for enable_interrupt() function, but not for ISR definition. As far as I see, the latter function is hard coded somewhere in the PCD code. Also CCS device editor can't enable a forgotten interrupt. I have a similar problem with PIC24FJxxxGA chips and UART interrupts, fortunately I can solve it by abusing a 24FJxxxGB device file.

Report the bug to CCS support and hope to get heard. I'm waiting since some months with this unchanged support case status:
Quote:
Your e-mail has been assigned to someone in C Tech Support. As of yet, we have not had time to further review your e-mail.


"I speak of none but the computer that is to come after me!" (Deep Thought in Douglas Adams Hitchhikers Guide to the Galaxy)

P.S.: Actually Device Editor can enable an forgotten interrupt, see below.


Last edited by FvM on Sat Jan 03, 2009 5:31 am; edited 1 time in total
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Fri Jan 02, 2009 8:24 am     Reply with quote

FvM, are you saying they don't show in the Interrupt list in the Editor? I don't have the dsPIC compiler so I can't check...
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Jan 02, 2009 11:20 am     Reply with quote

Thanks for your interest,

the missing interrupts, e.g. RDA3, TBE3 for PIC24FJ128GA106 or IC7, IC8 for dsPIC30F4013 can be enabled in the Device Editor Tool. This causes them to be displayed in the Valid Interrupts List, but still not recognized for #INT_xxx. There seems to be no user editable entry to change this behaviour.

Best regards

Frank
Satish Kolloor



Joined: 01 Jan 2009
Posts: 8
Location: Singapore

View user's profile Send private message

Defining ISRs for Input Capture IC7 and IC8 in dsPIC30F4013
PostPosted: Fri Jan 02, 2009 10:01 pm     Reply with quote

Frank,
The reply from CCS Support was to use the device editor to add the two interrupts, as you have mentioned. While doing this I found there are two sets of IC7 and IC8 check boxes as below :
IC7 v17
IC8 v18
.
..
IC7 v22
IC8 v23

After ticking one or both sets and saving it, I still cannot see these two interrupts displayed in the Valid Interrupts list. Did I miss some step ?

Of course compiler still does not recognise #INT_IC7, #INT_IC8

The skeleton code generated through project wizard puts #INT_IC1 just above the ISR routine for IC1, as shown in my last posting. I believe this
helps to the compiler to identify the routine as the ISR for the particular interrupt. This is same for all other ISR definitions generated by the wizard.

As you have pointed out, there seems to be nothing we can do to change the compiler preprocessor behavior. However, I believe, I need to see the two interrupts in the valid interrupts list as a first step.

Would appreciate your input on this.

Best Regards,
Satish
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Fri Jan 02, 2009 10:07 pm     Reply with quote

Did you exit the compiler and restart? I believe it reads the configuration data on startup. I had to do that when I made changes...it may help your situation.
Satish Kolloor



Joined: 01 Jan 2009
Posts: 8
Location: Singapore

View user's profile Send private message

Defining ISRs for Input Capture IC7 and IC8 in dsPIC30F4013
PostPosted: Sat Jan 03, 2009 12:50 am     Reply with quote

Yes, I exited the compiler and restarted it again a few times.
But the Valid Interrupts list does not change.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sat Jan 03, 2009 5:21 am     Reply with quote

I tried again with Device Editor, and found, that it works now. CCS support is correct. I don't understand yet, why my previous attempts have been unsuccesful. Also my 24FJ128 issue is apparently solved.

But look sharp, there are multiple occurences of IC7 and IC8 interrupts (valid for different chips), you have to choose the correct instance.
Satish Kolloor



Joined: 01 Jan 2009
Posts: 8
Location: Singapore

View user's profile Send private message

Defining ISRs for Input Capture IC7 and IC8 in dsPIC30F4013
PostPosted: Sat Jan 03, 2009 6:32 am     Reply with quote

Frank,
One set is : IC7 v17
IC8 v18

The second set further down is:
IC7 v22
IC8 v23

Which set should I be ticking for 30F4013 device ?

I have tried all the three possible option - , selecting first set, second set and both sets, saved the setting in each case,
exited the compiler and restarted it. But I did not see IC7 and IC8 listed in the valid interrupts keywords list.

By the way, you mentioend that your problem regarding RDA3 and TBE3 interrupts got fixed after using the device editor.

Do these appear in the valid interrupt keyword list ?

Do you manually edit the device header file to include defines for these two ? If so, how do you choose the values for these ? Looking at the other values for defines, they do not follow interrupt vector number. I found that most of them are 2 less than the vector number for my device.

Do you use #INT_RD3 and #_INT_TBR3 in front of their ISR function definition?

I might be doing something worng or missing some step.
My compiler is PCWND version 4.074.

I should get the two new interrupts listed in the Valid Interrupts keywords list as the first step.

Any suggestions ?

Thanks and Regards,
Satish Kolloor
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sat Jan 03, 2009 7:50 am     Reply with quote

I verified, that the Device Editor also works with PCD V4.074, which is the oldest version, I have access to. After saving the changes, IC7 and IC8 are immediately displayed under Vali d Interrupts (the entries are not ordered alphabetically). And the #INT_IC7 preprocessor directive has been recognized then. The device *.h file has to be edited regarding INT_xxx constants, too. Generally, valid interrupt vector numbers should be taken from the datasheet. IC7 and IC8 are directly behind EXT1 interrupt for both entries. You may want to check the correct vector and interrupt enable register assignment in compiled code, however.
Satish Kolloor



Joined: 01 Jan 2009
Posts: 8
Location: Singapore

View user's profile Send private message

Defining ISRs for Input Capture IC7 and IC8 in dsPIC30F4013
PostPosted: Sun Jan 04, 2009 9:55 pm     Reply with quote

I have located the correct set as IC7 v17 , IC8 V18 , 17 and 18 being the interrupt numbers. I also tried to add few other interrupts. But still no
change on the Valid Interrupt List seen by you.
There is a devices.dat DAT File in C:\Program Files/PICC folder. This file is supposed to hold all the changes in entries to a device made in the device editor (as per the help message window in the device editor).
I noticed that my devices.dat file (actually I have two, device4.dat and devicesp.dat) does not change after saving the changes made in the Device editor.

Can you please verify if it changes in your case. If the changes are not stored somewhere, the Valid Interrupts list is not going to be updated.

By the way, I have upgraded my PCWHD Compiler to latest vetsion 4.084.
You are supposed to save your devices.dat file during upgrades or you will loose your custom changes.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Jan 05, 2009 1:54 am     Reply with quote

Strange indeed.

With my PCWHD installation, the Device Editor actually rewrites device4.dat, when I press the Save button. This can be seen from the file date and by FileMon (from sysinternals.com) as well.

Perhaps you check, which action is performed with your installation iin this case.

Anyway, I think it's necessary, to repeat the corrections to device4.dat rather than copying the file during upgrade, cause it's supposed to contain a lot of corrections and bug fixes, that would be lost otherwise.

P.S.: I just remembered, that with some Windows configurations, write to a folder below \Program Files may be blocked depending on the user rights.
Satish Kolloor



Joined: 01 Jan 2009
Posts: 8
Location: Singapore

View user's profile Send private message

Defining ISRs for Input Capture IC7 and IC8 in dsPIC30F4013
PostPosted: Mon Jan 05, 2009 4:07 am     Reply with quote

Frank,
My PC is running under Windows Vista. How about your's ?

May be Vista prevents automatic update of any file in Program Files folder.

Regards,
Satish
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Jan 05, 2009 3:42 pm     Reply with quote

I have Win2k respectively WinXP.
Satish Kolloor



Joined: 01 Jan 2009
Posts: 8
Location: Singapore

View user's profile Send private message

Defining ISRs for Input Capture IC7 and IC8 in dsPIC30F4013
PostPosted: Mon Jan 05, 2009 7:37 pm     Reply with quote

Frank,
Looks like the cause of the problem is devices.dat file not getting updated after saving device editor changes in PC running Windows Vista.

If any one else has got the Device Editor changes working successfully in a PC running Windows Vista, please let us know.

If not, i will report this as a likely bug in Vista support for CCS Compiler
to the CCS Support.

Many Thanks for all your helpful suggestions so far that has helped us to locate the cause of the problem.

Regards,
Satish Kolloor
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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