Class TPU_PWM

  • All Implemented Interfaces:
    Impc555, IntbMpc555HB, Ippc32

    public class TPU_PWM
    extends Object
    implements IntbMpc555HB
    Driver for generating pulse width modulated (PWM) signals on the TPU.
    All 16 channels of TPU-A or TPU-B can be used. All timing data has to be a multiple of the TPU time base clock (806 ns).
    • Field Detail

      • channel

        int channel
      • period

        int period
      • diff

        int diff
      • tpuTimeBase

        public static final int tpuTimeBase
        TPU time base in nanoseconds [ns].
        See Also:
        Constant Field Values
    • Constructor Detail

      • TPU_PWM

        public TPU_PWM​(boolean tpuA,
                       int channel,
                       int period,
                       int highTime)
        Create a TPU channel for the generation of PWM signals.
        Remember: period and highTime have a resolution of 16 bit. However, the maximum value for both values is 0x8000.
        The period time should be defined as an integer constant. Example for a period time of T = 50 µs (f = 20 kHz):
        private final int pwmPeriod = 50000 / TpuTimeBase;
        Parameters:
        tpuA - true: use TPU-A, false: use TPU-B.
        channel - TPU channel to initialize. Allowed values are 0..15.
        period - Period time as a multiple of the TPU time base
        highTime - PWM signal high time as a multiple of the TPU time base. It has to be less or equal then the period time.
    • Method Detail

      • update

        public void update​(int period,
                           int highTime)
        Update the parameters of a PWM signal at a TPU channel.
        This method will simply update the period and high time registers without initializing the channel. The maximum value for both values is 0x8000.
        Parameters:
        period - Period time as a multiple of the TPU time base
        highTime - PWM signal high time as a multiple of the TPU time base. It has to be less or equal then the period time!
      • update

        public void update​(int highTime)
        Update the parameters of a PWM signal at a TPU channel.
        This method will simply update the period and high time registers without initializing the channel. The maximum value for both values is 0x8000.
        Parameters:
        highTime - PWM signal high time as a multiple of the TPU time base. It has to be less or equal then the period time!