PWM (Pulse Width Modulation)

The PWM instruction is used to provide pulse width modulation control using using a control port or universal terminal.

Syntax

PWM ( Source, Port, Period, Units )

Remarks

The PWM instruction programs the datalogger hardware based on the duty cycle (Source) and period. Its operation is independent of the datalogger scan interval. The duty cycle will remain set until the PWM instruction changes it.

Parameters

Source

Used to specify the duty cycle for the instruction. It is a constant or variable specified as a value of 0.0 <= value <= 1.0, where 0.0 is always off (port low) and 1.0 is always on (port high).

Type: Constant or Variable (cannot be declared as string or long)

Port

The digital channel to be used for this instruction. Valid options are C1, C2, C3, C4, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, and U12. Right-click the parameter to display a list of valid options.

Type: Constant

Period

A constant or variable that is used to specify the period for the signal. Maximum period is 36.4 seconds.

Resolution for different periods:

Type: Constant or variable

Units

The unit for the Period parameter. Valid units are microseconds (usec), milliseconds (msec), or seconds (sec). Right-click the parameter for a list of valid options.

Type: Constant