We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi everyone,
I am using XC164CS microcontroller. I need some help in keil programming. The operating frequency is 20KHz. The condition is that if the Vin= 0 volt the duty cycle=5% and if Vin=5V then duty cycle= 95% and duty cycle should be vary in between 0 to 5V range. I manually connected 0 to 5V resistor to the CAPCOM pin to check the condition and how quickly it measure.
I have one idea about after every interrupt the voltage level change and duty cycle also change but difficult to find in programming.
Any ideas or thoughts?
Thanks
Vivek
So it looks like you need to set up an interrupt on the period (50usec) and then you could update the duty cycle.
Depending on what you are doing and how you schedule your tasks. I would most likely opt to additionally set a task ready flag in the interrupt so a task can run that performs the ADC conversion and duty cycle calculation for the next event (period).
If you have very strict requirements on when the voltage measurement must be read during the period then you could set up a trigger in hardware for this also.
Just some ideas to consider...