ADC of MPC5643L

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC of MPC5643L

799 Views
shangjiang
Contributor I

I have bought a TRK-USB-MPC5643L to learn this chip some days ago.

i want to use the adc module to get the temperature through the temperature sensor.Then i initialize the ADC register by using

this code:     ADC_0.MCR.R = 0x2000000;/*Initialize ADC0 for scan mode*/

But when i step to this code,the debugger will get to this text: IVOR1trap: b    IVOR1trap     // IVOR 1 interrupt handler.

Please help me .

this is my all code:

int main(void) {

  volatile int i = 0;

  uint16_t ResultAnalog,ResultDigital,Tem,t;

 

  DisableSoftwareWatchdog();

  InitializeModesAndClock();

  InitializePeriClkGen();

 

  SIU.PCR[23].R = 0x2000;/*Initialize B[7] as AN0*/

  SIU.PCR[24].R = 0x2000;/*Initialize B[8] as AN1*/

 

  ADC_0.MCR.R = 0x2000000;/*Initialize ADC0 for scan mode*/

  ADC_0.NCMR[0].R = 0x00000007;/*selcet AN1 input for convertion*/

  ADC_0.CTR[0].R = 0x00008606;/*Conversion times 18Mhz*/

  ADC_0.MCR.B.NSTART = 1;

 

  while(1)

  {

  while(ADC_0.CDR[1].B.VALID !=1)

  {

 

  }

  t = (uint16_t) ADC_0.CDR[0].B.CDATA;

  ResultAnalog = (uint16_t) ADC_0.CDR[1].B.CDATA;

  ResultDigital = (uint16_t) (5000*ResultAnalog/0x3FF);

  Tem = 100*ResultDigital - 60;

  i++;

  }

 

 

}

 

Labels (1)
Tags (1)
0 Kudos
Reply
1 Reply

390 Views
jorge_plascencia
NXP TechSupport
NXP TechSupport

Hi Jiang,

Attached is the example for Temp sensor reading designed in CW2.10.

Hope it helps.

Regards,