FreescaleHRP
 
Component FreescaleHRP
High Resolution PWM
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 signal generation. Events may be generated ("DisableEvent"/"EnableEvent"). This method cannot be disabled if SHTDWN pin is enabled

      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 signal generation and events calling. When the timer is disabled, it is possible to call methods "ClrValue" and "SetValue".

      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

  • EnableEvent - Enable the events.

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

  • DisableEvent - Disable the events.

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

  • SetPeriod - Setting of the period register of the HRP module.

      ANSIC prototype: byte SetPeriod(word Period)
    • Period:word - Value for setting HRP period register. In the variable duty cycle mode the lower five bits have no effect.
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK

  • SetDuty - Setting of the duty cycle register of the HRP module. In the variable frequency mode the content of the duty cycle register is ignored.

      ANSIC prototype: byte SetDuty(word Duty)
    • Duty:word - Duty value to be written to the duty cycle register of the HRP module.
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK

  • GetShtdwnVal - Returns the current logic level of the Shutdown pin.

      ANSIC prototype: byte GetShtdwnVal(void)
    • Return value:byte - Logic level of the Shutdown pin.

  • SetPeriodMode - Switch the component to the specified mode (changes the period/frequency using a mode's values). Each mode is identified by a single 8-bit unsigned number which expresses one period/frequency of the generated signal. This method reduce the time needed for setting a new period value. This method can be used only if you specify a list of possible period settings at design time (see Timing dialog box - Runtime setting - from a list of values). Each of these settings constitutes a mode and Processor Expert assigns them a mode identifier. The prescaler and compare values corresponding to each mode are calculated at design time. You may switch modes at runtime by referring only to a mode identifier.

      ANSIC prototype: byte SetPeriodMode(byte Mode)
    • Mode:byte - Mode to switch to (0 to N)
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK
      ERR_VALUE - Value out of range, requested timing mode is not defined

  • SetFreqHz - This method sets the new frequency of the output signal. The frequency is expressed in Hz as a 16-bit unsigned integer number. This method is available only if runtime setting type 'from interval' is selected in the Timing dialog box in Runtime setting area.

      ANSIC prototype: byte SetFreqHz(dword Freq)
    • Freq:dword - Frequency to set [in Hz]
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK
      ERR_RANGE - Parameter out of range

  • SetRatio16 - This method sets a new duty-cycle ratio. Ratio is expressed as an 16-bit unsigned integer number. 0 - FFFF value is proportional to ratio 0 - 100%.
    Note: Calculated duty depends on the timer possibilities and on the selected period.

      ANSIC prototype: byte SetRatio16(word Ratio)
    • Ratio:word - Ratio to set. 0 - 65535 value is proportional to ratio 0 - 100%
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK


Note: Some methods can be implemented as macros.