PWM widget is to set pulse-width modulation pin’s output attributes and its binding register.
When the pin is set to be Input Capture mode, Count Register and its associated attributes are set.
For learning how to use this widget, please take a look at our educational video:
-
Educational Video
Widget Property
PWM/Input Capture Name
Property | Description | Operation |
---|---|---|
Widget Name | Widget displayed name | Name |
Link to User Manual | Link to IOT’s website for User Manual |
I/O Pin Configuration
Property | Description | Operation |
---|---|---|
Enable | Enable this I/O Pin | Checkbox |
Pin Operation | Select a pin operation. For GPIO, please refer to GPIO. The other two operation modes are PWM and Input Capture | |
PWM Frequency | Select PWM frequency from 1Hz to 100000Hz | Number Editor |
PWM/IO Binding Register | Select a binding register whose value serves as the duty cycle width percentage. For example, if the PWM frequency is set to 100Hz and the value of this register is set to 50. Then, this PWM outputs 100Hz pulse with 50% duty cycle. Users can use an input widget or Blockly function to change this binding register’s value, as a result, to change the duty cycle. | Register Selector |
Capute Mode | When this pin operation is set to Input Capture. The capture mode can be set to Rising Edge, Falling Edge or Both. | |
Count Register | In Input Capture mode, this register counts how many events of Capture Mode occurs since last time Count Register is read | Register Selector |
Elapsed Time(ms) | In Input Caputer mode, this register holds the elapsed time in ms since the last time the input capture mode related registers are read | Register Selector |
Binding Script | In Input Capture mode, if a Callback Blockly fuction is enabled. | Checkbox |
Observed Behavior | When the input capture mode is enabled and the binding script is enabled, whenever there is an input pulse and the pulse is counted, then this behavior callback function is called. At this time, the Count Register stores the number of pulses since last time it is read; whereas the Elapsed Time stores the duration in ms since last time this register is read. Once this callback function is called, both Count Register and Elapsed Time are cleared. | Blockly Editor |