Problems with the ADC (MC68HC908JL16)

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

Problems with the ADC (MC68HC908JL16)

1,884 Views
rebe
Contributor I
I am working with the MC68HC908JL16 and I have a problem with converter ADC.
I use 2 inputs of the converter and if while I make the conversion of an input I enter signal by the other the measurement varies.

I believe that it is a problem of the configuration of the ADC, since with the MC68HC908JL8 it happened to me the same and when modifying the configuration the problem I am solved. But now with himself not to solve the problem.
I have an external crystal of 16 and want to make the conversion of 10 bits.
As I must program the converter?

Thank.


RB
Labels (1)
0 Kudos
Reply
1 Reply

754 Views
UK_CF_FAE
NXP Employee
NXP Employee
Hi Rebe,
 
You could try this initialisation, which assumes the 2-off ADC channels are ADC1 and ADC2. You sure you have the ADC clock right, and the source impedence of your analog stages are OK? Try putting the mcu into sleep mode during the ADC conversion.
 
void MCU_init(void)
{
  /*** ### MC68HC908JL16_28 "Cpu" init code ... ***/
  /*** PE initialization code after reset ***/
  /* System clock initialization */
  /* Common initialization of the write once registers */
  /* CONFIG1: COPRS=0,LVID=0,SSREC=0,STOP=0,COPD=1 */
  CONFIG1 = 0x01;                                     
  /* CONFIG2: IRQPUD=0,LVIT1=0,LVIT0=0,IICSEL=0,STOP_ICLKDIS=0 */
  CONFIG2 = 0x00;                                     
  /* Common initialization of the write once registers */
  /* Common initialization of the CPU registers */
  /* PTAPUE: PTA6EN=1 */
  PTAPUE |= (unsigned char)0x80;                              
  /* ### Init_ADC init code */
  /* ADCLK: ADLPC=0,ADIV1=1,ADIV0=1,ADICLK=0,MODE1=0,MODE0=1,ADLSMP=1,ACLKEN=1 */
  ADCLK = 0x67;                                     
  /* ADCSC: COCO=0,AIEN=0,ADCO=0,ADCH4=0,ADCH3=0,ADCH2=0,ADCH1=0,ADCH0=0 */
  ADCSC = 0x00;                                     
  /* ### */
  asm CLI;                             /* Enable interrupts */
} /*MCU_init*/
 
Let the forum know how you get on...
 
Mark
0 Kudos
Reply