Init_TPM
 
Component Init_TPM for HCS08
Timer Pulse Width Modulator (TPM)
Device Initialization
(Description of the component parameters.)
  • Device - Selection of the TPM device module.
  • Settings - Common TPM module settings.
    • Clock settings - Clock/timing settings of the module.
      • Clock source select - Select one of the three clock sources or No clock option to disable the TPM system.
        This item modifies the CLKSB:CLKSA bits in the TPMxSC register.
        There are 4 modes:
      • Prescaler - Select one of the eight divisor for the TPM clock input.
        This item modifies the PS[0:2] bits in the TPMxSC register.
      • Modulo counter - Value of the TPM modulo counter.
        This item modifies the TPMxMODH and TPMxMODL registers.
      • Period - Period of the counter overflow (for information only).
        This item is influenced by the following properties: Prescaler, Modulo Counter, Center Aligned.
    • Channels - Settings of the TPM channels.
      One Item of the list looks like:
      Channel - TPMx Channel
      • Capture/compare device - TPM channel selection.
      • Settings - Common channel 0 settings
        • Mode - This property selects mode as input capture, output compare etc.
          This item modifies the CPWMS:MSnB:MSnA bits in the TPMxCnSC register.
          There are 4 modes:
          • Pin not used - Pin not used
            There are no items in this mode.
          • Input capture - Input capture
            The following items are displayed in this mode:
            • Input control - This property selects the polarity of the input edge that triggers an input capture event.
              This item modifies the ELSnB:ELSnA bits in the TPMxCnSC.

              There are 3 options:
              • Capture on rising edge only: Capture on rising edge only
              • Capture on falling edge only: Capture on falling edge only
              • Capture on rising or falling edge: Capture on rising or falling edge

          • Output compare - Output compare
            The following items are displayed in this mode:
            • Output action - This property selects the level that will be driven in response to an output compare match.
              This item modifies the ELSnB:ELSnA bits in the TPMxCnSC.

              There are 4 options:
              • Software compare only: Software compare only
              • Toggle output on compare: Toggle output on compare
              • Clear output on compare: Clear output on compare
              • Set output on compare: Set output on compare

            • Channel compare value - This property contains the compare value for the TPM counter.
              This item modifies the TPMxCnV register.
          • PWM - PWM
            The following items are displayed in this mode:
            • PWM output action - This property selects the polarity of the PWM output.
              This item modifies the ELSnB:ELSnA bits in the TPMxCnSC.

              There are 2 options:
              • Clear output on compare: High-true pulses
              • Set output on compare: Low-true pulses

            • Channel compare value - See previous modes for more details
            • Channel duty - Value of the PWM channel duty.
              This item is influenced by the following properties: Channel Compare Value, Modulo Counter.
      • Pin - Channel 0 pin settings.
        This item is influenced by the following properties: Mode.
        The following items are available only if the group is enabled (the value is "Used"):
        • Channel pin - Name of the channel 0 pin
        • Pull resistor - Channel 0 pull resistor.

          There are 6 options:
          • no pull resistor: Input without pull resistor is required
          • pull up: Input with pull-up resistor is required
          • pull down: Input with pull-down resistor is required
          • pull up or no pull: Input with pull-up resistor is preferred, but no-pull is acceptable
          • pull down or no pull: Input with pull-down resistor is preferred, but no-pull is acceptable
          • autoselected pull: There are no special requirements for pull resistors

      • Interrupt - Interrupt settings of channel 0.
        • Channel Interrupt - Channel 0 interrupt settings
          • Settings only if CPU supports interrupts
            • Interrupt - Interrupt vector (for information only).
          • Channel Interrupt - Enable/disable channel 0 interrupt.
            This item modifies the CHnIE bits in the TPMxSC register.
          • Settings only if CPU supports interrup priority.
            • Priority - Priority of the chanell interrupt.
          • Settings only if CPU supports interrupts
            • ISR name - Name of the interrupt service routine (ISR) invoked by this interrupt vector.
              The user code of the routine should handle all respective interrupt flags correctly.
  • Pins - Module pins/signals settings.
    • External clock source - External clock source input pin.
      This item is influenced by the following properties: Clock Source Select.
      The following items are available only if the group is enabled (the value is "Enabled"):
      • Source pin - Name of the pin used as external clock input.
  • Interrupts - Interrupts settings of the module.
    • Overflow Interrupt - TPM overflow interrupt settings.
      • Settings only if CPU supports interrupts
        • Interrupt - Interrupt vector (for information only).
      • Overflow Interrupt - Enable/disable Overflow interrupt.
        This item modifies the TOIE bits in the TPMxSC register.
      • Settings only if CPU supports interrupt priority.
        • Priority - Priority of the overflow interrupt.
      • Settings only if CPU supports interrupts
        • ISR name - Name of the interrupt service routine (ISR) invoked by this interrupt vector.
          The user code of the routine should handle all respective interrupt flags correctly.
  • Initialization - Initialization options of the module.
    • Enable module - Enable module (for information only).
      This item is influenced by the following properties: Clock source select.