Jump to content
32614_1489253935

ADC0-ADC1 PERIPL

Recommended Posts

Hi guys,

I have a question about SYSCTL_PERIPH_ADC0,SYSCTL_PERIPH_ADC1

I knew that on Tiva board have 12 ADC channels, but I do not know what is the role of SYSCTL_PERIPH_ADC0/ADC1 ? what is the function of them? When do we use it ?

I hope someone can make me understand my problems.

Thanks!

Share this post


Link to post
Share on other sites

Hi guys,

I have a question about SYSCTL_PERIPH_ADC0,SYSCTL_PERIPH_ADC1

I knew that on Tiva board have 12 ADC channels, but I do not know what is the role of SYSCTL_PERIPH_ADC0/ADC1 ? what is the function of them? When do we use it ?

I hope someone can make me understand my problems.

Thanks!

 

well you see how you have PA1, PA2, PB1?

 

the leter A,B or any other specifies the GPIO module. There's a peripheral, a component inside the chip that drives the digital ports. Each one having 8 (therefore the Px0 to Px7).

 

With the ADC it's the same. There's 2 modules. Each one with a number of ADC input chanels. Simple answer, you use one of them everytime you need to read a analog input.

For the older tiva launchpad, the one with the TM4C123GH6PM, the input chanels are shared, meaning the 12 ADC inputs can be read from any of the 2 ADC. How is this useful? Well if you want to read 2 inputs at the same time with an ADC? you can't! you can read them with uS diference or less, but there can't be readings at the same time. But you have 2 ADC, meaning you can read 2 inputs at the same time.

Also this alows to not having to set up interrupts, triggers, sample rates, etc, etc each time you want to read a diferent analog pin.

You have a critical reading that needs that config and is being read all the time? well, keep those configs and use the other ADC.

Share this post


Link to post
Share on other sites

I wanna use these pins (    //E2-CH1,E3-CH0,E4-CH9,E0-CH8,D0-CH7,D1-CH6,D2-CH5) to read ADC inputs, have I fail ?, PLZ help me

     SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
     SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
     SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);.
 
     GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5);
     GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2);
     ADCHardwareOversampleConfigure(ADC0_BASE, 32);

     ADCSequenceConfigure(ADC0_BASE, 2, ADC_TRIGGER_PROCESSOR, 0);
     ADCSequenceStepConfigure(ADC0_BASE, 2, 0, ADC_CTL_CH1);
     ADCSequenceStepConfigure(ADC0_BASE, 2, 1, ADC_CTL_CH0);
     ADCSequenceStepConfigure(ADC0_BASE, 2, 2, ADC_CTL_CH9);
     ADCSequenceStepConfigure(ADC0_BASE, 2, 3, ADC_CTL_CH8);
     ADCSequenceStepConfigure(ADC0_BASE, 2, 4, ADC_CTL_CH7);
     ADCSequenceStepConfigure(ADC0_BASE, 2, 5, ADC_CTL_END | ADC_CTL_CH6 | ADC_CTL_IE);
     ADCSequenceEnable(ADC0_BASE, 2);//
     ADCIntRegister(ADC0_BASE, 2, &MyISR);
     ADCIntEnable(ADC0_BASE, 2);

Share this post


Link to post
Share on other sites

Thanks L.R.A for your answer, But I have put Dataget in interrupt service routine. The below lines just a configuration. My goal is configure to read 12 ADC channels. And I still have not solved.

 

Coul you please post the full code?

Share this post


Link to post
Share on other sites

The below post is full of my configuration, in ISR i use Dataget to read value to a buffer, I always doubt the follow lines (7 channels config), please help me for checking:

     SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
     SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
     SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);.
 
     GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5);
     GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2);

Share this post


Link to post
Share on other sites

Is that all the code relating to the ADC?  

What about the ISR ADC code (it should have more than data get in it).

 

MAP_IntEnable( INT_ADC...  )?

Where is the ADC trigger? - e.g. ADCProcessorTrigger( ADC0_BASE, 2)?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...