PWM To analog

JAPIB
2018-06-14
2024-01-12
  • JAPIB

    JAPIB - 2018-06-14

    Hello,

    Has anyone ever written a program to convert PWM pulses to analog value?
    If yes can you explain to me the principle.
    I looked at OSCAT, but I did not find !

    Thank you in advance
    Best regard

     
  • somlioy - 2018-06-14

    You have a constant frequency usually, then you know the total time between first rising edge to second rising edge:

    T = 1/f.

    Period can also be calculated and averaged in software if frequency is not known.

    Then you check the length of the on-pulse and then for example get the percentage on-time from total periode-time.

    Or even easier, use a first or second order low-pass filter and get an analog voltage.

     
  • JAPIB

    JAPIB - 2018-06-15

    Thanks a lot somlioy , I'll try this soon.

     
  • anderson - 2024-01-12

    ja aproveitando a discussão, eu estou com um problema relacionado ao uso da biblioteca OSCAT. estou tentando usar o bloco pwm, porém nao consigo executar.nao tem uma entrada para a função execute

     

Log in to post a comment.