Difference between revisions of "Component: HBRIDGE (CAL) (Misc)"
From Flowcode Help
Jump to navigationJump to search (Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | Matrix TSL |- | width="20%" style="color:gray;" | Version | 2.1 |- | width="20%" style="color:gray...") |
|||
| (12 intermediate revisions by the same user not shown) | |||
| Line 15: | Line 15: | ||
CAL = Code Abstraction Layer - Allows one code base to run on a wide range of chips. A low level implementation giving direct access to the H-Bridge peripheral. Currently only supports compatible 8-bit PIC devices. | CAL = Code Abstraction Layer - Allows one code base to run on a wide range of chips. A low level implementation giving direct access to the H-Bridge peripheral. Currently only supports compatible 8-bit PIC devices. | ||
| − | ==Component | + | ==Component Source Code== |
| − | + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_HBRIDGE.fcfx FC_Comp_Source_HBRIDGE.fcfx] | |
| + | |||
| + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_HBRIDGE.fcfx FC_Comp_Source_HBRIDGE.fcfx] | ||
==Detailed description== | ==Detailed description== | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| Line 45: | Line 61: | ||
==Examples== | ==Examples== | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| Line 62: | Line 92: | ||
{{Fcfile|HBridgeTest_18877.fcfx|PIC16F18877 H-Bridge Example}} | {{Fcfile|HBridgeTest_18877.fcfx|PIC16F18877 H-Bridge Example}} | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ==Macro reference== | ||
| + | |||
| + | ===Disable=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| Line 95: | Line 122: | ||
| + | ===Enable=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| Line 108: | Line 136: | ||
| + | ===GetList=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetList''' |
|- | |- | ||
| − | | colspan="2" | | + | | colspan="2" | Returns CHANNEL or PRESCALE list from the FCD and updates the internal property |
|- | |- | ||
|- | |- | ||
| − | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING |
| − | | width="90%" | | + | | width="90%" | Name |
|- | |- | ||
| − | | colspan="2" | | + | | colspan="2" | |
|- | |- | ||
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
| + | ===GetValue=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetValue''' |
|- | |- | ||
| − | | colspan="2" | | + | | colspan="2" | Returns Named property Value |
|- | |- | ||
|- | |- | ||
| Line 139: | Line 169: | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
| − | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
| + | ===SetDirection=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| Line 167: | Line 193: | ||
| + | ===SetSpeed=== | ||
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
| + | |- | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetSpeed''' | ||
| + | |- | ||
| + | | colspan="2" | Sets the motor speed by varying the PWM duty. | ||
| + | |- | ||
| + | |- | ||
| + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
| + | | width="90%" | duty | ||
| + | |- | ||
| + | | colspan="2" | Duty value 0 - 1023 | ||
| + | |- | ||
| + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
| + | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
| + | |} | ||
| + | |||
| + | |||
| + | ===SetValue=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetValue''' |
|- | |- | ||
| − | | colspan="2" | | + | | colspan="2" | Sets the Value of the property PERIOD, PRESCALE or CHANNEL (if CHANNEL also updates the PORT from FCD) |
|- | |- | ||
|- | |- | ||
| Line 180: | Line 226: | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING |
| + | | width="90%" | Value | ||
| + | |- | ||
| + | | colspan="2" | | ||
| + | |- | ||
| + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
| − | |||
| − | |||
| Line 199: | Line 248: | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| + | |- | ||
| + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
| + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Settings | ||
| + | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
| Line 229: | Line 282: | ||
|- | |- | ||
| colspan="2" | PWM Period Register value | | colspan="2" | PWM Period Register value | ||
| + | |- | ||
| + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
| + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Dead Band | ||
| + | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
| Line 250: | Line 307: | ||
| colspan="2" | Number of cycles to wait after a rising edge and before a falling edge. | | colspan="2" | Number of cycles to wait after a rising edge and before a falling edge. | ||
|- | |- | ||
| − | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | |
| − | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | | width="10%" align="center" style="background-color:# | ||
| − | | width="90%" style="background-color:# | ||
|- | |- | ||
|- | |- | ||
| Line 314: | Line 351: | ||
| colspan="2" | Remap Pin D - Specifies the pin used for the D output. Only available on devices supporting remappable hardware pins. | | colspan="2" | Remap Pin D - Specifies the pin used for the D output. Only available on devices supporting remappable hardware pins. | ||
|- | |- | ||
| − | | width="10%" align="center" style="background-color:# | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] |
| − | | width="90%" style="background-color:# | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Calculations |
| + | |- | ||
| + | |- | ||
| + | | width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | ||
| + | | width="90%" | Clock Speed | ||
| + | |- | ||
| + | | colspan="2" | Target Microcontroller Clock Speed. | ||
| + | |- | ||
| + | | width="10%" align="center" | [[File:Fc9-type-15-icon.png]] | ||
| + | | width="90%" | Period (uS) | ||
|- | |- | ||
| + | | colspan="2" | Calculated length of PWM period in micro seconds. | ||
| + | |- | ||
| + | | width="10%" align="center" | [[File:Fc9-type-15-icon.png]] | ||
| + | | width="90%" | Frequency (KHz) | ||
| + | |- | ||
| + | | colspan="2" | Calculated PWM output frequency in KHz. | ||
| + | |- | ||
| + | | width="10%" align="center" | [[File:Fc9-type-15-icon.png]] | ||
| + | | width="90%" | Frequency (Hz) | ||
| + | |- | ||
| + | | colspan="2" | Calculated PWM output frequency in Hz. | ||
|} | |} | ||
Latest revision as of 10:24, 24 February 2023
| Author | Matrix TSL |
| Version | 2.1 |
| Category | Misc |
Contents
HBRIDGE component
CAL = Code Abstraction Layer - Allows one code base to run on a wide range of chips. A low level implementation giving direct access to the H-Bridge peripheral. Currently only supports compatible 8-bit PIC devices.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_HBRIDGE.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_HBRIDGE.fcfx
Detailed description
Half Bridge Application
A Half Bridge type output has two output signals A and B.
Full Bridge Application
Full Bridge type output has four output signals A, B, C and D.
Examples
A simple proof of concept example to drive a full bridge output with varying speed and direction.
Macro reference
Disable
| Disable | |
| Disable this PWM Channel | |
| Return | |
Enable
| Enable | |
| Enable this PWM Channel | |
| Return | |
GetList
| GetList | |
| Returns CHANNEL or PRESCALE list from the FCD and updates the internal property | |
| Name | |
| Return | |
GetValue
| GetValue | |
| Returns Named property Value | |
| Name | |
| Return | |
SetDirection
| SetDirection | |
| Set the motor direction. | |
| direction | |
| 0 = Forwards, 1 = Reverse | |
| Return | |
SetSpeed
| SetSpeed | |
| Sets the motor speed by varying the PWM duty. | |
| duty | |
| Duty value 0 - 1023 | |
| Return | |
SetValue
| SetValue | |
| Sets the Value of the property PERIOD, PRESCALE or CHANNEL (if CHANNEL also updates the PORT from FCD) | |
| Name | |
| Value | |
| Return | |

