wangine
Joined: 07 Jul 2009 Posts: 98 Location: Curtea de Arges, Romania
|
priority interrupts in dsPIC33f family |
Posted: Wed Aug 31, 2011 2:07 pm |
|
|
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? |
|