Announcement

Collapse
No announcement yet.

Using PWM_Init() in GEN4_ulcd_50d diablo16 IC

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using PWM_Init() in GEN4_ulcd_50d diablo16 IC

    Hello, I am using LCD. In PWM mode, PWM with a frequency of 1 kHz or less was required, so the pwm_Init(PA8, PWM_625HZ, 600) function was used.

    But actually, the output is 62.5Hz. Is this right? Also, although I entered the value 600, the actual output was about 2.5% duty ratio.

    I wondered if the function was used incorrectly, so I rewritten it with the code below.

    pwm_Init(PA8, PWM_5KHZ, 600);

    This works fine. A duty ratio of 60% output was obtained at a frequency of 5 kHz.

    Could you check if I made a mistake or used it wrong?

    Please reply. Thank you.

  • #2
    Hello,

    Sorry for the issues caused here, this was identified late in December but it didn't make it in to the updates for the document in time before the holidays started. This has been updated now in the latest copy of the Internal functions Manual, if you wish to have a look at it.

    https://4dsystems.com.au/mwdownloads...d/link/id/719/

    You are correct, PWM_625Hz produces a 62.5Hz PWM, and the value is between 0 and 160 for the duty cycle, so 80 would be a 50% duty cycle, for example.

    I hope this helps

    Regards
    James
    James

    Comment


    • #3
      Hi,

      Thanks for the answer. Our products require the use of a frequency of 500~1kHz. The duty ratio should be adjustable from 10 to 100%.

      I tried to make a PWM using a regular timer function, but it was not easy because it was only adjustable in 1ms increments.

      If possible, can you provide a function that satisfies the above specifications?

      For example,

      pwm_Init(PA8, PWM_1KHZ, 500); // Sets 1kHz PWM of 50% on PA8

      Thank you for your help.

      Regards

      J.S

      Comment


      • #4
        Give us a little while to get back to you
        Mark

        Comment


        • #5
          Sure, I'll wait for it. Thank you.

          Comment


          • #6
            Hi Mark,
            as I can see in the last "Diablo16 Internal Functions Reference Manual v2.10", the constants PWM_200HZ, PWM_500HZ, PWM_1KHZ are named here, but not defined in Diablo16_Functions.fnc in 4D Workshop 4.6.0.39.
            And in the last PmmC R25 there is undocumented functionality of PWM_200HZ = 12 only.
            Have you already PmmC R26 with added functionality for PWM_500HZ and mainly PWM_1KHZ?
            We will be happy to use it too as today's solution by unstoppable pin_PulseoutCount repeatedly restarted in the event routine produces discontinuous output ...
            Thank you
            Miroslav

            Comment


            • #7
              I'll send you an email.
              Mark

              Comment

              Working...
              X