Access over 35 million academic & study documents

Given the code below, configure the reload value of the timer perio

Content type
User Generated
Showing Page:
1/4
Given the code below, configure the reload value of the
timer \"period\" to generate 100 ms periodic delay.
unsigned long period =
Solution
int
main(void)
{
unsigned long ulADC0_Value[1];
volatile unsigned long ulLoop;
unsigned long ulPeriod;
SysCtlClockSet(SYSCTL_SYSDIV_10 |
SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
ADCSequenceConfigure(ADC0_BASE, 3,
ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 3, 0,

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/4
ADC_CTL_CH0 | ADC_CTL_IE |
ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 3);
ADCIntClear(ADC0_BASE, 3);
//****************code for pwm
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
GPIOPinTypePWM(GPIO_PORTG_BASE,
GPIO_PIN_2);
PWMGenConfigure(PWM_BASE, PWM_GEN_0,
PWM_GEN_MODE_UP_DOWN |
PWM_GEN_MODE_NO_SYNC);
PWMGenPeriodSet(PWM_BASE, PWM_GEN_0,
ulPeriod);
PWMPulseWidthSet(PWM_BASE, PWM_OUT_0,
ulPeriod *3/4);
PWMOutputState(PWM_BASE, PWM_OUT_0_BIT,
true);

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/4

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 4 pages?
Access Now
Unformatted Attachment Preview
Given the code below, configure the reload value of the timer \"period\" to generate 100 ms periodic delay. unsigned long period = Solution int main(void) { unsigned long ulADC0_Value[1]; volatile unsigned long ulLoop; unsigned long ulPeriod; SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0); ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH0 | ADC_CTL_IE | ADC_CTL_END); ADCSequenceEnable(ADC0_BASE, 3); ADCIntClear(ADC0_BASE, 3); //****************code for pwm SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); GPIOPinTypePWM(GPIO_PORTG_BASE, GPIO_PIN_2); PWMGenConfigure(PWM_BASE, PWM_GEN_0, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC); PWMGenPeriodSet(PWM_BASE, PWM_GEN_0, ulPeriod); PWMPulseWidthSet(PWM_BASE, PWM_OUT_0, ulPeriod *3/4); PWMOutputState(PWM_BASE, PWM_OUT_0_BIT, true); PWMGenEnable(PWM_BASE, PWM_GEN_0); //**************************************************************** ***** while(1) { ADCProcessorTrigger(ADC0_BASE, 3); while(!ADCIntStatus(ADC0_BASE, 3, false)) { } ADC ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Indeed
4.5
Sitejabber
4.4