CANNY 7.2 Duo. HR PWM Driver

General Description

CANNY 7.2 Duo supports high-resolution pulse-width modulator mode on all of its nine input-output channels. However, only one controller output can be used as an HR PWM channel at a time. The HR PWM channel can be reassigned from the function diagram during its execution. In HR PWM mode, the PWM timing parameters - the period and duty cycle can be set in the range from 2 to 65535 microseconds, in 1 microsecond increments.

An HR PWM channel has a fixed pulse polarity - GND 100mA. Generation can be done in either open collector (no pull-up or external pull-up) mode or internal pull-up mode to supply voltage (specified by setting value in the appropriate register). In this mode, the channel is asynchronous to function diagram, which allows for maximum stability of generated signal timing parameters.

HR PMW driver operates using the controller’s channel resources, but has a higher priority than the discrete input-output driver. This means that for all channels, for which the HR PMW driver is activated, all value changes in registers associated with discrete input-output driver will be ignored.

Attention! When a channel is set to the high-resolution pulse width modulator mode the electrical short circuit protection for the channel is disabled! Overload or short circuit of a channel set to this mode can cause damage to the controller!

Driver registers

The following shows the expected values for for control registers of the high resolution PWM driver.

High Resolution PWM Driver register values
Register Expected Values
HR PWMx Period Register, μs 3…65535 = specify the period in microseconds of the HR PWM generator
HR PWMx Duty Register, μs 1…65535 = set HR PWM channel filling (duty cycle) in microseconds
HR PWMx IO Channel Select Register 0…8 = set the number of the discrete IO channel, that will be used as a HR PWM channel
HR PWMx Pull-up Enable Register ≥ 1 = HR PWM generation polarity for the channel «MINUS 100mA» / «positive pull-up»
0 = HR PWM generation polarity for the channel «MINUS 100mA» / «air» (open collector mode)

Note: The symbol “x” in the names of the HF PWM registers takes values from 1 to 6 and denotes the driver number of the high-frequency pulse-width modulator to which it belongs.

Features

Activate the HR PWM driver by setting a value other than 0 in the HR PWM Period Register, μs. If the channel number of the HR PWM is not specified, the driver is activated on channel 0.

Disable the HR PWM driver by setting the HR PWM Period Register, μs value to a value of 0. The operation of the HR PWM channel immediately stops and the channel is transferred to the control of the input-output driver.

When the HR PWM driver is turned on, if the duty cycle is set equal to 0, then, regardless of the specified period value, the PWM channel will remain in the initial state, i.e:

  • “air” when the internal pull-up to plus of the HR PWM of the respective channel is not turned on;
  • supply voltage, when the pull-up is turned on.

If the actual duty cycle is greater than or equal to the actual period value, then the PWM channel will always remain in the GND state.

When changing the period values ​​or filling of HR PWM while the channel is actively operating in the HR PWM mode, the new values ​​of the updated parameters will be applied by the driver only at the beginning of the next HR PWM period. To accelerate the application of the new HR PWM parameters, turn off the HR PWM mode and then turn it on again after writing the necessary values.

Due to the features of the microsecond timer, the actual values ​​of the period and duty of the HR PWM slightly differ from the values ​​set by the user. The value of the actual period/duty is 1.0667 times greater than the set value/duty.

Function diagram of a smooth, cyclic change in the brightness of the LED connected to channel 0 of the controller.

SEE ALSO