Forum: Mikrocontroller und Digitale Elektronik ADC_Init am Luminary micro lm3s8962


von Hans (Gast)


Lesenswert?

Hallo!

Bin gerade dabei den ADC Port vom Luminary zu initialisieren, jedoch 
funkt das irgendwie nicht. Mein Code:
1
void adc0_init()
2
{
3
    // Enable the ADC peripheral
4
5
    SysCtlPeripheralEnable( SYSCTL_PERIPH_ADC );
6
7
   // Setup the sequence
8
   //
9
   // Configure the ADC to sample the potentiometer when the timer expires.
10
   // After sampling, the ADC will interrupt the processor; this is used as
11
   // the heartbeat for the game.
12
   //
13
    ADCSequenceConfigure( ADC_BASE,             // base
14
                          0,                    // sequence num
15
                          ADC_TRIGGER_TIMER,    // trigger
16
                          0 );                  // priority
17
18
    ADCSequenceStepConfigure( ADC_BASE,         // base
19
                              0,                // sequence num
20
                              0,                // step num
21
                              ADC_CTL_CH0 );    // config
22
23
    
24
    ADCSequenceEnable( ADC_BASE, 0 );
25
26
    ADCIntEnable( ADC_BASE, 0);
27
    IntEnable(INT_ADC0);
28
}
29
30
void ADC_isr( void )
31
{
32
    // Clear the interrupt
33
34
    ADCIntClear( ADC_BASE, 0 );
35
36
    // Grab the data from the ADC
37
38
    ADCSequenceDataGet( ADC_BASE, 0, &ulValue);
39
40
41
} // ADC_isr

Habe im den Interrupt im Vektor (Startup) eingetragen.
Weiß einer woran es liegen könnte, bzw. könnte mir wer tipps geben?

danke im voraus!

mfg.
Hans

von Formatierung (Gast)


Lesenswert?

Hallo,

Du solltest

>funkt das irgendwie nicht.

genauer spezifizieren.

Hast Du die Interrupts freigegeben?
Möglicherweise gibt´s da mehrere Stellen,
wo man den einschalten muss (CPU core, NVIC..., ADC - das
scheinst Du gemacht zu haben)

Ich nehme an, auch bei TI gibt es tonnenweise Beispielcode,
der läuft.

von Hans (Gast)


Lesenswert?

Danke! Für die Antwort!
Hab es nun geschafft das er in den Interrupt springt, jedoch gibt er mir 
noch nicht die Werte aus... :(

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.