AnsweredAssumed Answered

MPC5604B some problems

Question asked by xl han on Apr 11, 2016
Latest reply on Apr 16, 2016 by Aleksandar Vinchev

Hi,

 

1.When I create new  project of mpc5604B  and set interrupt by software,the interrupt will not work。

2. The example of  interrupt project has pointed to EWL_C library, how can I  change it to point to MSL_C, because I want to use the library functions such as floor,fabs.

3.when AD collection  the adjacent channel influence each other, such as 0 channel change when 1 channel will has a 0.1 v wave.

 

a1=ADC_ReadVal(0);

a2=ADC_ReadVal(1);

when a1==1024,a2 is 500,and when a1=0,a2 is 400.

 

//CDR[0..15] = precision channels

//CDR[32..47] = standard channels

//CDR[64..95] = external multiplexed channels

uint16 ADC_ReadVal(uint8 channel)

{

    while((ADC.CDR[channel].B.VALID != 1);

    return ADC.CDR[channel].B.CDATA; 

}                                    

void ADC_Init(void)

{

   ADC.MCR.R        = 0x20000000;        //

   ADC.MCR.B.OWREN=1;

   //ADC.MCR.B.WLSIDE=1;

   ADC.NCMR[0].R    = 0x0000FFFF;        //

   ADC.NCMR[1].R    = 0x0000FFFF;        //

   ADC.NCMR[2].R    = 0x0000000F;        //

   ADC.CTR[0].R     = 0x00008606;        //

   ADC.CTR[1].R     = 0x00008606;

   ADC.CTR[2].R     = 0x00008606;

   ADC.MCR.B.NSTART = 1;                 //

}                        

 

 

Thanks

Hanxl

Outcomes