-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a39ee1c
commit 3d1ecdc
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "adc.h" | ||
|
||
|
||
void ADC0_SS3_Init (void) | ||
{ | ||
SYSCTL_RCGCADC_R |= (1<<0); //enable ADC0 clock | ||
ADC0_ACTSS_R &= ~(1<<SS_num); //disable sample sequncer during configuration | ||
ADC0_EMUX_R = (ADC0_EMUX_R& ~(0xF<<SS_num*4)) | (trigger_select<<SS_num*4) ; //choosing the triggering method | ||
ADC0_SSMUX3_R = 0x0; //input from channel 0 i.e PE3 | ||
ADC0_SSCTL3_R |= ( (ADC0_SSCTL3_TS0<<3) | (ADC0_SSCTL3_IE0<<2) | (ADC0_SSCTL3_END0<<1)); //configuring sample sequncer 3 control port | ||
if(ADC0_SSCTL3_IE0 == 0x1) | ||
{ | ||
ADC0_IM_R |= (1<<3); | ||
NVIC_EN0_R |= (1<<17); | ||
} | ||
ADC0_ACTSS_R |= (1<<SS_num); //enable sample sequncer during configuration | ||
} | ||
void ADC_Init_Potentiometer (void) | ||
{ | ||
ADC0_SS3_Init (); | ||
Port_AnalogOrDigital (PORTE, 0X08, 0); | ||
//Port_AlternateFunction (PORTE,0X08,1, uint32_t pctl_mask); | ||
GPIO_PORTE_AFSEL_R|=0x08; | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
#ifndef ADC_H_ | ||
#define ADC_H_ | ||
|
||
#include "port.h" | ||
#include "DIO.h" | ||
#include "tm4c123gh6pm.h" | ||
#include "std_types.h" | ||
|
||
#ifndef PORTA | ||
#define PORTA 0 | ||
#endif | ||
|
||
#ifndef PORTB | ||
#define PORTB 1 | ||
#endif | ||
|
||
#ifndef PORTC | ||
#define PORTC 2 | ||
#endif | ||
|
||
#ifndef PORTD | ||
#define PORTD 3 | ||
#endif | ||
|
||
#ifndef PORTE | ||
#define PORTE 4 | ||
#endif | ||
|
||
#ifndef PORTF | ||
#define PORTF 5 | ||
#endif | ||
|
||
#define trigger_select 0x0F | ||
#define SS_num 3 | ||
#define ADC0_SSCTL3_IE0 0x1 | ||
#define ADC0_SSCTL3_END0 0x1 | ||
#define ADC0_SSCTL3_TS0 0x1 | ||
|
||
|
||
void ADC0_SS3_Init (void); | ||
|
||
#endif |