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
  • hi

    Well, I know what are you thinking about this but i think its not that simple. Four signals coming from the DC/DC close loop control system and I need to convert in to equivalent digital voltage and apply into the CAPCOM pins

    Anyway thanks for your help

    Cheers

    Vivek

Reply
  • hi

    Well, I know what are you thinking about this but i think its not that simple. Four signals coming from the DC/DC close loop control system and I need to convert in to equivalent digital voltage and apply into the CAPCOM pins

    Anyway thanks for your help

    Cheers

    Vivek

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