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 assocaited attributes are set.
An educational vidoe is availble to get users started:
-
Educational Video
Widget Property
PWM/Input Capture Name
Property | Description | Operation |
---|---|---|
Widget Name | Widget displayed name | Name |
Link to Educational Video | Link to IOT’s website for Educational Video |
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 caputre mode can be set to Rising Edge, Falling Edge or Both. | |
Count Register | In Input Caputure 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 Caputre mode, this register holds the eplased 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 Eliapsed Time stores the duration in ms since last time this regisre is read. Once this callback function is called, both Count Register and Elasped Time are cleared. | Blockly Editor |