Hallo, in einem F2808 µC Controller möchte ich den Sequencer dazu nutzen Alle 16 Kanäle auszulesen. Das probier ich schon ne ganze weile ohne es zum klappen zu bringen.
Gibt es von TI Beispielcode dafür , den ich übersehen habe? Gibt es spezielle Fallen, die es zu umschiffen gilt?
spru716b kenn ich schon, und meine es verstanden zu haben. Ja ich weiß, irgendwo darin liegt die Lösung, nur ich finde sie nicht.
Code Snippet :
Die Statemachine wird zyklisch abgefragt.
void AdcStateMachine(void) {
switch ( AdcState ) {
case START : AdcRegs.ADCTRL2.all = 0x2000; // // Reset SEQ1 // Reset SEQ2 AdcState = RUN ; break ;
case RUN : // if (AdcRegs.ADCASEQSR.bit.SEQ_CNTR== 0) if ( AdcRegs.ADCST.bit.INT_SEQ1== 1) { Adc0 = AdcRegs.ADCRESULT0 ; Adc1 = AdcRegs.ADCRESULT1 ; Adc2 = AdcRegs.ADCRESULT2 ; Adc3 = AdcRegs.ADCRESULT3 ; Adc4 = AdcRegs.ADCRESULT4 ; Adc5 = AdcRegs.ADCRESULT5 ; Adc6 = AdcRegs.ADCRESULT6 ; Adc7 = AdcRegs.ADCRESULT7 ; Adc8 = AdcRegs.ADCRESULT8 ; Adc9 = AdcRegs.ADCRESULT9 ; Adc10 = AdcRegs.ADCRESULT10 ; Adc11 = AdcRegs.ADCRESULT11 ; Adc12 = AdcRegs.ADCRESULT12 ; Adc13 = AdcRegs.ADCRESULT13 ; Adc14 = AdcRegs.ADCRESULT14 ; Adc15 = AdcRegs.ADCRESULT15 ;
AdcRegs.ADCST.bit.INT_SEQ1= 0 ; AdcState = START ; } break ;
default : AdcState = START ; break ;
}}
extern void DSP28x_usDelay(Uint32 Count);
// To powerup the ADC the ADCENCLK bit should be set first to enable // clocks, followed by powering up the bandgap, reference circuitry, and ADC core. // Before the first conversion is performed a 5ms delay must be observed // after power up to give all analog circuits time to power up and settle
// Please note that for the delay function below to operate correctly the // CPU_CLOCK_SPEED define statement in the DSP280x_Examples.h file must // contain the correct CPU clock period in nanoseconds.
AdcRegs.ADCTRL1.all = 0x4000 ; // // Reset
DELAY_US(ADC_usDELAY);
AdcRegs.ADCTRL1.all = 0x0008 ; // // Reset // SEQ16 Mode
AdcRegs.ADCTRL2.all = 0x4040; // // Reset SEQ1 // Reset SEQ2
DELAY_US(ADC_usDELAY);
AdcRegs.ADCTRL3.all = 0x00E0; // // Power up bandgap/reference/ADC circuits
DELAY_US(ADC_usDELAY);
AdcRegs.ADCMAXCONV.all = 0x000f ; // 16 Sequence DELAY_US(ADC_usDELAY);
AdcRegs.ADCREFSEL.all = 0x0000 ; // internal reference
DELAY_US(ADC_usDELAY);
AdcRegs.ADCCHSELSEQ1.all = 0x3210 ; AdcRegs.ADCCHSELSEQ2.all = 0x7654 ; AdcRegs.ADCCHSELSEQ3.all = 0xba98 ; AdcRegs.ADCCHSELSEQ4.all = 0xfedc ;
DELAY_US(ADC_usDELAY);
AdcRegs.ADCTRL1.all = 0x0010 ;
DELAY_US(ADC_usDELAY); // Delay before converting ADC channels