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

priority interrupts in dsPIC33f family

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



Joined: 07 Jul 2009
Posts: 98
Location: Curtea de Arges, Romania

View user's profile Send private message Send e-mail Yahoo Messenger

priority interrupts in dsPIC33f family
PostPosted: Wed Aug 31, 2011 2:07 pm     Reply with quote

I have a confusion about their levels and interruptions.
I need the priority interrupt to be the ADC.
I understand LEVEL = 7 is the highest priority in dsPIC33 but if I leave the compiler to decide for themselves apparently believe the results are better.
What to do?
Interruption must be always constant view a Tim.
They is another solution to change dt to each interrupt and the timer to measure time spent.
Do you think that is a more viable solution has been to force the termination to be priority?
.Orice change "dt" I do a lot of problems.
Attached below may have wrong somewhere.


Code:
#int_ADC1 LEVEL = 6
void  ADC1_isr(void)
{
//   disable_interrupts(INT_TIMER4);


output_high(pin_B0);  // reset HP filter
   
      if(flag_1 == false)
         {flag_1 = true;
             gyro.an_in_X = ADC1BUF0 ;
             set_adc_channel(1);
         }
      else
         {flag_1 = false;
             gyro.an_in_Z = ADC1BUF0 ;   
//       gyro.an_in_Z = ((ADC1BUF0 * 3.3f) / 1023.0f - 1209.0f) / //0.000083f; 
             set_adc_channel(0);

         }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   state_update(gyro.an_in_X);   // 3.8f, 4.0f
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
output_low(pin_B0); // HP filter normal operation mode

//   mot_inc();
//   enable_interrupts(INT_TIMER4);

    IFS0bits.AD1IF = 0;      // Clear the ADC1 Interrupt Flag
}


Code:
//~~~~~~~~~~~~~~~do not touch this !!!, used from ADC start conversion ~~~~~~~~~~~~~~~~~~~~~~
#int_TIMER3 LEVEL = 7
void  TIMER3_isr(void)
{
    IFS0bits.T3IF = 0;      // Clear Timer 3 interrupt
}


If you put a pin on change in break off the oscilloscope and rubber rectangle random fluctuation is not as
If it were the priority should not be synchronous?
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