FreescalePWM
 
Component FreescalePWM
Pulse width modulation - special version
Component Level: Low
Methods:
(Methods are user-callable functions/subroutines intended for the component functions control. Please see the Embedded Components page for more information.)
  • Enable - Enable the component - it starts the output signal generation.

      ANSIC prototype: byte Enable(void)
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_SPEED - This device does not work in the active speed mode

  • Disable - Disable the component - it stops the output signal generation.

      ANSIC prototype: byte Disable(void)
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_SPEED - This device does not work in the active speed mode

  • Methods for Freescale HC08 derivatives LD64, BD48.
    • SetDataReg - This method sets the PWM Data Register of the PWM module.

        ANSIC prototype: byte SetDataReg(byte Channel, byte Value)
      • Channel:byte - Number of the channel.
      • Value:byte - Value of the data register (5 bits in MSB portion determine the pulse width, 3 bits in LSB portion determine a number of included narrow pulses).
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_RANGE - Parameter out of range
        • ERR_SPEED - This device does not work in the active speed mode

    • SetPWM - This method sets the 5-bit PWM portion of the data register.

        ANSIC prototype: byte SetPWM(byte Channel, byte Value)
      • Channel:byte - Number of the channel.
      • Value:byte - Number of pulse width (0 - 31)
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_RANGE - Parameter out of range
        • ERR_SPEED - This device does not work in the active speed mode

    • SetBRM - This method sets the 3-bit BRM portion of the data register.

        ANSIC prototype: byte SetBRM(byte Channel, byte Value)
      • Channel:byte - Number of the channel.
      • Value:byte - Number of included pulses (0 - 7).
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_RANGE - Parameter out of range
        • ERR_SPEED - This device does not work in the active speed mode

  • Methods for Freescale HC08 derivatives SR12
    • SetDataReg - This method sets the PWM Data Register directly.

        ANSIC prototype: byte SetDataReg(byte Channel, byte Value)
      • Channel:byte - Number of the channel.
      • Value:byte - Value of the data register (pulse width of the channel).
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_RANGE - Parameter out of range
        • ERR_SPEED - This device does not work in the active speed mode

    • SetPhaseReg - This method sets the PWM Phase Control Register directly. 7-bit value is used to determined the start-up time of the different PWM counters when phase control is enabled (method EnablePhase). This method is not effective if output of the channel, which should be delayed, is already being generated.

        ANSIC prototype: void SetPhaseReg(byte Value)
      • Value:byte - Phase width of the channels.

    • EnablePhase - Enable the phase control. The component must be disabled and again enabled before code of this method is effective. The best approach is to disable the component, call this method and then again enable the component.

        ANSIC prototype: byte EnablePhase(void)
      • Return value:byte - Error code.

    • DisablePhase - Disable the phase control.

        ANSIC prototype: byte DisablePhase(void)
      • Return value:byte - Error code.


Note: Some methods can be implemented as macros.