Hi
How can I toggle the output toggles at 10 Hz (±10%).
Thanks
N
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi
How can I toggle the output toggles at 10 Hz (±10%).
Thanks
N
Hi Nabila,
You can use the PWM to toggle a pin at 10Hz. For that you would have to set the PWM Clock Divisor to get in the range where the Count Values can cause a 10Hz signal
Regards
Amit
Hi
Thanks. Can you please give an example for better understanding
Thanks
Nabila
Hi Nabila,
There is a PWM example in TIVAWare 2.0.1.11577 release
C:\ti\TivaWare_C_Series-2.0.1.11577\examples\peripherals\pwm\reload_interrupt.c
In the main code please remove the API Call
PWMIntEnable(PWM0_BASE, PWM_INT_GEN_0);
and that should get you a 250Hz PWM output. Then add the SysCtlPWMClockSet API for TM4C123 to adjust the Clock Divider to predivide the PWM Input Clock so that 250Hz can be brought down further. You will have to adjust the values for SysCtlPWMClockSet and the PWM Load to come into the vicinity of 10Hz
Regards
Amit
Thank you very much. I am also trying to record the changes in bit 1,2 and 4 if the value changes when either swithes are on. I am using this line of code but it is not storing anything. Do i need to set up any flag etc.
Data[i] = GPIO_PORTF_DATA_R&0x13;
Thanks
Nabila
Hi Nabila,
To record the changes, please configure the GPIO's in Input Mode by using GPIOPinTypeGPIOInput function. Please note that PF0 is a NMI pin and need to be unlocked using the GPIO_O_LOCK register and then GPIO_O_CR bit for PF0 written to '1' so that you can configure it as a GPIO.
Regards
Amit