AnsweredAssumed Answered

Initializing an ADC scan, MCF5213, Codewarrior V5.9.0

Question asked by antony hart on Feb 1, 2011
Latest reply on Feb 7, 2011 by antony hart

Hi there.


My problem here is that I am using the codewarrior device initialization bean to set up the ADC. I have not yet experienced any problems when using the 'Device Initialization' tool when using it to setup pins for GPIO. I have included below the exact bean parameters, and the code to write a '1' to the START0 bit of register CNTRL1. Can anyone advise on why a scan will not run? 



  Clock Settings

  Clock Divisor select          divide by 8

  ADC Freq                          5MHz

Stop mode 0                        no

Stop mode 1                        no

ADC mode                          Once sequential

Parrallel mode                     Independent  

Trigger mode 0                   Write to START bit only

Trigger mode 1                              "     "

High voltage ref source      External          (AN2 connected to VDDA)

Low voltage ref source      External           (AN6 connected to GND)


-A/D channels

AN0-AN1                            Single ended mode

AN2-AN3                                        "    "

AN4-AN5                                        "    "

AN6-AN7                                        "    "


-sample 0

channel                            AN0

sample                            Enabled

zero crossing                  Disabled

low limit                           0

high limit                         32752                 (highest value before disabling high limit)


-sample 1- 7                  All disabled



-AN0                              Enabled

-AN2/Vrefh pin               Enabled

-AN6/Vrefl pin                Enabled


the rest of the pins are disabled


Sync0 and sync1 are both disabled



-conversion complete

interrupt                           INT_ADC_ADCA

request                            Enabled

level                                 7

Priority                             Highest

End of scan interrupt      Enabled


conversion complete interrupt for scanner b is disabled


Zero crossing or limit error

interrupt                      INT_ADC_ADCINT

Request                      Enabled

Level                           7

Priority                        6

Zero crossing             Disabled

Low limit error            Disabled

High limit error           Enabled



Start ADC conversion after Init A         no

         "                "                      B         no

Power down ADC0                              no

    "            "           1                              no

Power down voltage ref                       no

Auto power down                               disabled

power up delay                                  13

Auto stand by                                     disabled



The following code is used to start the scan.


#include "support_common.h"


uint16 Set_START0 = 0;


set_START0 = CNTRL1;

Set_START0 = (uint16)(Set_START0 | CTRL1_START0_BITMASK);




The code compiles, but as far as i can tell, there is no scan being run, and at no point during debug will the program jump to the corresponding end of scan ISR.


Apologies if I have gone a bit over kill on the information included here, I just didn't want to miss out anything that might be important. If anyone has any suggestions, I would be most greatfull. Thanks in advance. Antony