Forum: Mikrocontroller und Digitale Elektronik ADC1,ADC2,AD3 but ADC4?


von John (Gast)


Lesenswert?

Hallo,

ich besitze einen STM3210e-Eval board mit einem STM32F103ZG ARM
Prozessor und arbeite in der Keil Umgebung. Bin relativ ein Neuling in
dem Gebiet...

Ich benütze von meinem Board die 3xBNC Eingänge(ADC1,ADC2,ADC3) als
Input.
Alles funktioniert.

Jetzt wollte ich zusätzlich noch den Potentiometer ansprechen

Leider habe ich kein ADC4 gefunden....

Wie soll das gehen das ich mehr ADC benutzen kann als nur ADC1,ADC2,ADC3
in meiner Libary.


Hier sieht man ne Typische Konfiguration allgemein für die ADC und dann
für ADC1.
1
void Config_ADC(GPIO_InitTypeDef *GPIO_InitStructure)
2
{
3
  RCC_ADCCLKConfig(RCC_PCLK2_Div6);                                            //clock for ADC  ADCCLK = PCLK2/6 = 72/6 = 12MHz*/
4
5
  // enable ADC system clock
6
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO | RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2 | RCC_APB2Periph_ADC3, ENABLE);
7
 
8
   /* Configure PC.01, PC.02 and PC.03 (ADC Channel 11, ADC Channel 12, ADC Channel 13) as analog input */
9
  GPIO_InitStructure->GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 ;           // PC.01, PC.02 and PC.03
10
  GPIO_InitStructure->GPIO_Mode = GPIO_Mode_AIN;                                 // Input-Mode
11
  GPIO_InitStructure->GPIO_Speed = GPIO_Speed_50MHz;                              // Speed of port
12
  GPIO_Init(GPIOC, GPIO_InitStructure);                                           // apply configuration on PortC
13
 
14
}
15
16
17
void ADC1_Configuration(ADC_InitTypeDef *ADC_InitStructure)
18
{
19
  ADC_InitStructure->ADC_ContinuousConvMode = ENABLE;                            //ster next convert automatically
20
  ADC_InitStructure->ADC_DataAlign = ADC_DataAlign_Right;                        //put left/right adjusted in register
21
  ADC_InitStructure->ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;            //choose which extern signal should start convert
22
  ADC_InitStructure->ADC_Mode = ADC_Mode_Independent;
23
  ADC_InitStructure->ADC_NbrOfChannel = 1;
24
  ADC_InitStructure->ADC_ScanConvMode = DISABLE;
25
  
26
  ADC_RegularChannelConfig(ADC1, ADC_Channel_11, 1, ADC_SampleTime_28Cycles5);  //ADC_SampleTime_1Cycles5
27
  ADC_Init(ADC1, ADC_InitStructure);                                             //set config of ADC1
28
  
29
  ADC_Cmd(ADC1, ENABLE);                                                         //enable ADC1
30
31
}

von Besserwisser (Gast)


Lesenswert?

Hat der STM32F103ZG nicht nur drei ADCs?

von Bitkracherl (Gast)


Lesenswert?

Die Frage ist irgendwie merkwürdig. Das klingt wie:

Ich habe ein Ein-Euro Stück, ein Zwei-Euro Stück und einen Fünf-Euro 
Schein. Nun würde ich gerne noch fünf Millionen Euro verwenden, finde 
aber keine.

D.h.
>Leider habe ich kein ADC4 gefunden....
wird wohl leider darauf hinauslaufen das Du keine Fünf Millionen Euro 
findest

und das
>Wie soll das gehen das ich mehr ADC benutzen kann als nur ADC1,ADC2,ADC3
in meiner Libary.
das Du wohl keine fünf Millionen Euro ausgeben kannst.

Was ist jetzt genau die Frage?

Der ST hat eben nur drei ADCs.

von Besserwisser (Gast)


Lesenswert?

Datenblatt sagt

Three 12-bit analog-to-digital converters ...
 each ADC shares up to 21 external channels

Also den Multiplexer anders stellen, dann kannst Du auch das Poti 
messen, bzw Scan Mode

 In scan mode, automatic conversion
is performed on a selected group of analog inputs.

von John (Gast)


Lesenswert?

Naja wie stelle ich das an das ich gemultiplext einen ADC Kanal benütze 
?

Kann mir jemand sagen wie ich das z.B beim ADC3 mache ?


Wirkt sich das auf die Abtastrate 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.