Jump to content


  • Content Count

  • Joined

  • Last visited

Reputation Activity

  1. Like
    guybarash reacted to roadrunner84 in PWM with spedific period   
    You're using CCS or Energia?
    Anyway, you first need to set up your timer to a clock source of which you can take a certain number to get your 15msec period.
    For example, if your SMCLK is set to 1MHz (1 usec-1), you'll need 15000 of those pulses to get 15msec. This 15000 would go into CCR0 of that timer and the timer is set in UP mode (so it will reset at 15000).
    Then you can alter the PWM cycle by changing the CCR1 or CCR2 value between 1100 and 1900, be sure to set up a pin for timer output and to set that CCR to have Set/Reset behaviour.
    Assuming you're using an MSP430G2 you can look into the family guide SLAU144J (google it) and the datasheet for your specific MSP430.
  2. Like
    guybarash reacted to KatiePier in PWM input   
    Hi @@guybarash,
    The family user's guide is definitely where you want to look for more details about timer operation and the registers and bits that control these functions, just as @@roadrunner84 recommended. However, the SLAU144 document is for the 2xx family of devices - for the F5529, you will want to look at SLAU208 which is the user's guide for the F5xx/6xx family of devices.
    For timer A operation this shouldn't really matter as timer A is pretty much the same across families, but there are other modules that differ between the two families (clock system, power management, etc) so this is definitely the better document to look at in your particular case.
  3. Like
    guybarash reacted to tripwire in PWM input   
    Table 16 ("TA2 signal connections") on page 33 of the datasheet is a good place to start. The left half of that table shows the inputs for the different module blocks of TA2. For externally connected inputs it gives the corresponding pin numbers for the various package types. In the case of the F5529 this is fairly simple; P2.3-5 are your external inputs to TA2, so the input pins match the output pins. That's not always the case, which is why it's important to check the timer's "signal connections" table in the datasheet.
    Notice how the table says that the three external inputs are called module input CCI0A, CCI1A and CCI2A. You'll need to know that when you set up TA2CCTL0, TA2CCTL1 or TA2CCTL2 later.
    Assuming you've connected the input signal to P2.3, you then need to configure that pin to pass the input through to the timer module. Table 50 on page 83 of the datasheet shows what you need to do. In this case, you want to configure P2.3 for the TA2.CCI0A function. That means clearing bit 3 of P2DIR and setting bit 3 of P2SEL.
    Next you need to set up TA2CCTL0. Set the CAP bit, and set the CCIS bits to 00 to take the input from for CCI0A. You can pick which signal edge(s) trigger a capture with the CM_x bits.
    Finally you need to set up the timer. For capturing you generally want to use continuous mode so the range of timer values is as big as possible.
    To measure the frequency and duty cycle you'll need to capture the timer's value on the rising and falling edge of the input signal. You can either use a single capture register set to capture on both edges, or use separate registers for the rising edge and the falling edge. If you use two registers you'll need to connect the input signal to multiple timer input pins, of course.
  • Create New...