This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Keil Programming

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

Parents
  • 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...

Reply
  • 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...

Children
No data