resolution Constant

Top  Previous  Next

Gets the clock frequency for the PWM module.

Syntax

Cell.PWM[n].resolution

Value

The clock frequency of PWM module n, where n is 0 or 1.

Remarks

The resolution constant can be use to calculate the pulse width value needed to set the PWM pulse width to a specific amount of time. The value to use for pulse width given a duration in fractional seconds can be computed as follows:

 

Cell.PWM[n].width[channel] = duration * Cell.PWM[n].resolution;

 

where duration has been assigned the pulse width in fractional seconds, channel is in the range 0 - 3, and n is 0 or 1.

Examples

Cell.PWM[0].frequency = 60;

Cell.PWM[0].width[0] = 0.001 * Cell.PWM[0].resolution;  // pulse width is 1 ms

See Also

width Property