Class TCustomPWM

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TCustomPWM = class abstract(TObject)

Description

Abstract PWM (Pulse-Width Modulation) manager.

Hierarchy

  • TObject
  • TCustomPWM

Overview

Methods

Protected function GetDutyCycle(const Channel: TPinChannel): Cardinal; virtual; abstract;
Protected function GetEnabled(const Channnel: TPinChannel): Boolean; virtual; abstract;
Protected function GetPeriod(const Channel: TPinChannel): Cardinal; virtual; abstract;
Public procedure Start(const Channel: TPinChannel; const Frequency, DutyCycle: Cardinal); virtual;
Public procedure Stop(const Channel: TPinChannel); virtual;
Protected procedure SetDutyCycle(const Channel: TPinChannel; const Value: Cardinal); virtual; abstract;
Protected procedure SetEnabled(const Channel: TPinChannel; const Value: Boolean); virtual; abstract;
Protected procedure SetPeriod(const Channel: TPinChannel; const Value: Cardinal); virtual; abstract;

Properties

Public property DutyCycle[constChannel:TPinChannel]: Cardinal read GetDutyCycle write SetDutyCycle;
Public property Enabled[constChannel:TPinChannel]: Boolean read GetEnabled write SetEnabled;
Public property Period[constChannel:TPinChannel]: Cardinal read GetPeriod write SetPeriod;

Description

Methods

Protected function GetDutyCycle(const Channel: TPinChannel): Cardinal; virtual; abstract;

Returns current duty cycle (nanoseconds, in relation to period) set for the specified channel.

Protected function GetEnabled(const Channnel: TPinChannel): Boolean; virtual; abstract;

Returns True when the specified channel is configured for PWM output and False otherwise.

Protected function GetPeriod(const Channel: TPinChannel): Cardinal; virtual; abstract;

Returns current period (nanoseconds) set for the specified channel.

Public procedure Start(const Channel: TPinChannel; const Frequency, DutyCycle: Cardinal); virtual;

Starts Pulse-Width Modulation on specified channel with the desired frequency (in Hz) and duty cycle.

Parameters
Pin
Physical channel number on which to enable PWM.
Frequency
The desired frequency (in Hz).
DutyCycle
The desired duty cycle as fixed-point between 0 and 65535, each corresponding to 0% and 100% respectively.
Public procedure Stop(const Channel: TPinChannel); virtual;

Stops PWM on the specified Pin.

Protected procedure SetDutyCycle(const Channel: TPinChannel; const Value: Cardinal); virtual; abstract;

Changes duty cycle (nanoseconds, in relation to period) for the specified channel.

Protected procedure SetEnabled(const Channel: TPinChannel; const Value: Boolean); virtual; abstract;

Changes status of PWM output on the specified channel.

Protected procedure SetPeriod(const Channel: TPinChannel; const Value: Cardinal); virtual; abstract;

Changes period (nanoseconds) for the specified channel.

Properties

Public property DutyCycle[constChannel:TPinChannel]: Cardinal read GetDutyCycle write SetDutyCycle;

Determines PWM duty cycle in nanoseconds in respect to period (e.g. 500000 ns for period of 1000000 ns would define a 50% of duty cycle).

Public property Enabled[constChannel:TPinChannel]: Boolean read GetEnabled write SetEnabled;

Determines whether the specified Pin is configured for PWM output.

Public property Period[constChannel:TPinChannel]: Cardinal read GetPeriod write SetPeriod;

Determines PWM period in nanoseconds (e.g. 1000000 ns period would be 1 ms or 100 hz).


Copyright © 2000 - 2017 Yuriy Kotsarenko. Help files generated by PasDoc.