how to use PWM in msp430G2553??

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Submitted by yogeshnand on Wed, 03/16/2016 - 15:56 

 

VisSim 9.0

i am learner of VisSim embedded. trying to use PWM , but when i connect square wave block to PWM , it shows error ' type mismatch on input 0' how this error would be solved.i am using MSP430G2553 As a target. thanking you..

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by imatalon on Wed, 03/16/2016 - 18:51.

    The PWM block expects a scaled integer (fixed point) 1.16 input. Have you converted the block to 1.16 using the convert block?

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by yogeshnand on Thu, 03/17/2016 - 12:18.

    no. but when i connected mismatch problem solved,and shows the error'Warning!PWM causes timer TA0 period conflict' sir show me some example so i can do it. thanking you.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by pete on Fri, 03/18/2016 - 08:14.

    Yogesh, You can't use TA0 for both your main timer interrupt and PWM unless the period is the same in both cases. Attach your diagram so we can see how to fix it.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    Submitted by yogeshnand on Fri, 03/18/2016 - 10:37.

     

    sir below is my sample program.. thanking you.

    Unable to find an attachment - read this blog

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by yogeshnand on Tue, 03/29/2016 - 14:06.

    how can i do the same period ...please tell me. thanks in advance.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    Submitted by pete on Wed, 03/30/2016 - 07:28.

    Since TA0 is the only timer on this chip, you need to share it with the PWM and control interrupt generation. To do that the periods must agree. The easiest way is to choose a control rate, generate code, and look at the value VisSim assigns to TA0CCR like so:

       TA0CCR0 = 0x3e80; // Timer Period 

    Then convert 0x3e80 to decimal (16000), and use that as the PWM period. See attached.

    Unable to find an attachment - read this blog

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by yogeshnand on Wed, 03/30/2016 - 14:55.

    thanks for your reply. but sorry to say it showing the same error. same way first i generate code , took values of TA0CCR , convert ed into decimal and used this value for PWM period. but it showing the same error. ''Warning!PWM causes timer TA0 period conflict'.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by pete on Sat, 04/02/2016 - 00:02.

    Glad to hear it works now!