Difference between revisions of "Component: HBRIDGE (CAL) (Misc)"

From Flowcode Help
Jump to navigationJump to search
Line 22: Line 22:
  
 
==Detailed description==
 
==Detailed description==
 +
 +
  
  
Line 59: Line 61:
  
 
==Examples==
 
==Examples==
 +
 +
  
  
Line 88: Line 92:
 
{{Fcfile|HBridgeTest_18877.fcfx|PIC16F18877 H-Bridge Example}}
 
{{Fcfile|HBridgeTest_18877.fcfx|PIC16F18877 H-Bridge Example}}
  
==Macro reference==
 
  
{| 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;" | '''GetValue'''
 
|-
 
| colspan="2" | Returns Named property Value  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Name
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
  
 
+
==Macro reference==
{| 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;" | '''Disable'''
 
|-
 
| colspan="2" | Disable this PWM Channel 
 
|-
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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;" | '''Enable'''
 
|-
 
| colspan="2" | Enable this PWM Channel 
 
|-
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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''
 
|}
 
 
 
 
 
{| 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;" | '''SetValue'''
 
|-
 
| colspan="2" | Sets the Value of the property PERIOD, PRESCALE or CHANNEL (if CHANNEL also updates the PORT from FCD)  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Name
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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;" | '''SetDirection'''
 
|-
 
| colspan="2" | Set the motor direction. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | direction
 
|-
 
| colspan="2" | 0 = Forwards, 1 = Reverse 
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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;" | '''GetList'''
 
|-
 
| colspan="2" | Returns CHANNEL or PRESCALE list from the FCD and updates the internal property  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Name
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
 
 
 
 
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Enable
 
|-
 
| 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="90%" | Channel
 
|-
 
| colspan="2" | PWM Channel selector 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Mode
 
|-
 
| colspan="2" | Selects between full bridge and half bridge output modes.  Some H-Bridge channels may only have one mode in which case the property selector will only show the available mode. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Polarity
 
|-
 
| colspan="2" | Selects the active output voltage.  Active high - Pins will be low when inactive and high when active. Active Low- Pins will be high when inactive and low when active. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Timer
 
|-
 
| colspan="2" | Timer associated with PWM to drive the output.  Warning - All PWM channels linked to the same timer will share the same period and prescaler settings. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Prescaler Divide
 
|-
 
| colspan="2" | Prescaler Divider value 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Period Register
 
|-
 
| 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="90%" | Rising Bits
 
|-
 
| colspan="2" | Number of bits assigned to the rising edge dead band counter. Auto populated based on selected target chip. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Falling Bits
 
|-
 
| colspan="2" | Number of bits assigned to the falling edge dead band counter. Auto populated based on selected target chip. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Rising Count
 
|-
 
| colspan="2" | Number of cycles to wait after a falling edge and before a rising edge. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Falling Count
 
|-
 
| 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" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | A Pin
 
|-
 
| colspan="2" | Output Pin A 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | B Pin
 
|-
 
| colspan="2" | Output Pin B 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | C Pin
 
|-
 
| colspan="2" | Output Pin C 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | D Pin
 
|-
 
| colspan="2" | Output Pin D 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | A Remap Pin
 
|-
 
| colspan="2" | Remap Pin A - Specifies the pin used for the A output.  Only available on devices supporting remappable hardware pins. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | B Remap Pin
 
|-
 
| colspan="2" | Remap Pin B - Specifies the pin used for the B output.  Only available on devices supporting remappable hardware pins. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | C Remap Pin
 
|-
 
| colspan="2" | Remap Pin C - Specifies the pin used for the C output.  Only available on devices supporting remappable hardware pins. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | D Remap Pin
 
|-
 
| 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:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| 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. 
 
|}==Macro reference==
 
 
 
{| 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;" | '''GetValue'''
 
|-
 
| colspan="2" | Returns Named property Value  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Name
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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;" | '''Disable'''
 
|-
 
| colspan="2" | Disable this PWM Channel 
 
|-
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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;" | '''Enable'''
 
|-
 
| colspan="2" | Enable this PWM Channel 
 
|-
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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''
 
|}
 
 
 
 
 
{| 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;" | '''SetValue'''
 
|-
 
| colspan="2" | Sets the Value of the property PERIOD, PRESCALE or CHANNEL (if CHANNEL also updates the PORT from FCD)  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Name
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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;" | '''SetDirection'''
 
|-
 
| colspan="2" | Set the motor direction. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | direction
 
|-
 
| colspan="2" | 0 = Forwards, 1 = Reverse 
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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;" | '''GetList'''
 
|-
 
| colspan="2" | Returns CHANNEL or PRESCALE list from the FCD and updates the internal property  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Name
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
 
 
 
 
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Enable
 
|-
 
| 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="90%" | Channel
 
|-
 
| colspan="2" | PWM Channel selector 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Mode
 
|-
 
| colspan="2" | Selects between full bridge and half bridge output modes.  Some H-Bridge channels may only have one mode in which case the property selector will only show the available mode. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Polarity
 
|-
 
| colspan="2" | Selects the active output voltage.  Active high - Pins will be low when inactive and high when active. Active Low- Pins will be high when inactive and low when active. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Timer
 
|-
 
| colspan="2" | Timer associated with PWM to drive the output.  Warning - All PWM channels linked to the same timer will share the same period and prescaler settings. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Prescaler Divide
 
|-
 
| colspan="2" | Prescaler Divider value 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Period Register
 
|-
 
| 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="90%" | Rising Bits
 
|-
 
| colspan="2" | Number of bits assigned to the rising edge dead band counter. Auto populated based on selected target chip. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Falling Bits
 
|-
 
| colspan="2" | Number of bits assigned to the falling edge dead band counter. Auto populated based on selected target chip. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Rising Count
 
|-
 
| colspan="2" | Number of cycles to wait after a falling edge and before a rising edge. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Falling Count
 
|-
 
| 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" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | A Pin
 
|-
 
| colspan="2" | Output Pin A 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | B Pin
 
|-
 
| colspan="2" | Output Pin B 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | C Pin
 
|-
 
| colspan="2" | Output Pin C 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | D Pin
 
|-
 
| colspan="2" | Output Pin D 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | A Remap Pin
 
|-
 
| colspan="2" | Remap Pin A - Specifies the pin used for the A output.  Only available on devices supporting remappable hardware pins. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | B Remap Pin
 
|-
 
| colspan="2" | Remap Pin B - Specifies the pin used for the B output.  Only available on devices supporting remappable hardware pins. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | C Remap Pin
 
|-
 
| colspan="2" | Remap Pin C - Specifies the pin used for the C output.  Only available on devices supporting remappable hardware pins. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | D Remap Pin
 
|-
 
| 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:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| 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. 
 
|}==Macro reference==
 
 
 
{| 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;" | '''GetValue'''
 
|-
 
| colspan="2" | Returns Named property Value  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Name
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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;" | '''Disable'''
 
|-
 
| colspan="2" | Disable this PWM Channel 
 
|-
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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;" | '''Enable'''
 
|-
 
| colspan="2" | Enable this PWM Channel 
 
|-
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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''
 
|}
 
 
 
 
 
{| 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;" | '''SetValue'''
 
|-
 
| colspan="2" | Sets the Value of the property PERIOD, PRESCALE or CHANNEL (if CHANNEL also updates the PORT from FCD)  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Name
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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;" | '''SetDirection'''
 
|-
 
| colspan="2" | Set the motor direction. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | direction
 
|-
 
| colspan="2" | 0 = Forwards, 1 = Reverse 
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| 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;" | '''GetList'''
 
|-
 
| colspan="2" | Returns CHANNEL or PRESCALE list from the FCD and updates the internal property  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Name
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
 
 
 
 
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Enable
 
|-
 
| 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="90%" | Channel
 
|-
 
| colspan="2" | PWM Channel selector 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Mode
 
|-
 
| colspan="2" | Selects between full bridge and half bridge output modes.  Some H-Bridge channels may only have one mode in which case the property selector will only show the available mode. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Polarity
 
|-
 
| colspan="2" | Selects the active output voltage.  Active high - Pins will be low when inactive and high when active. Active Low- Pins will be high when inactive and low when active. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Timer
 
|-
 
| colspan="2" | Timer associated with PWM to drive the output.  Warning - All PWM channels linked to the same timer will share the same period and prescaler settings. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Prescaler Divide
 
|-
 
| colspan="2" | Prescaler Divider value 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Period Register
 
|-
 
| 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="90%" | Rising Bits
 
|-
 
| colspan="2" | Number of bits assigned to the rising edge dead band counter. Auto populated based on selected target chip. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Falling Bits
 
|-
 
| colspan="2" | Number of bits assigned to the falling edge dead band counter. Auto populated based on selected target chip. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Rising Count
 
|-
 
| colspan="2" | Number of cycles to wait after a falling edge and before a rising edge. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Falling Count
 
|-
 
| 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" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | A Pin
 
|-
 
| colspan="2" | Output Pin A 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | B Pin
 
|-
 
| colspan="2" | Output Pin B 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | C Pin
 
|-
 
| colspan="2" | Output Pin C 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | D Pin
 
|-
 
| colspan="2" | Output Pin D 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | A Remap Pin
 
|-
 
| colspan="2" | Remap Pin A - Specifies the pin used for the A output.  Only available on devices supporting remappable hardware pins. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | B Remap Pin
 
|-
 
| colspan="2" | Remap Pin B - Specifies the pin used for the B output.  Only available on devices supporting remappable hardware pins. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | C Remap Pin
 
|-
 
| colspan="2" | Remap Pin C - Specifies the pin used for the C output.  Only available on devices supporting remappable hardware pins. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | D Remap Pin
 
|-
 
| 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:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| 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. 
 
|}==Macro reference==
 
  
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"

Revision as of 16:48, 30 January 2023

Author Matrix TSL
Version 2.1
Category Misc


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.

HB Schematic.jpg


Full Bridge Application

Full Bridge type output has four output signals A, B, C and D.

FB Schematic.jpg


Examples

A simple proof of concept example to drive a full bridge output with varying speed and direction.

FC6 Icon.png PIC16F1937 H-Bridge Example

FC6 Icon.png PIC16F18877 H-Bridge Example


Macro reference

Fc9-comp-macro.png GetValue
Returns Named property Value  
Fc9-string-icon.png - STRING Name
 
Fc9-string-icon.png - STRING Return


Fc9-comp-macro.png Disable
Disable this PWM Channel 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Enable
Enable this PWM Channel 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetSpeed
Sets the motor speed by varying the PWM duty. 
Fc9-u16-icon.png - UINT duty
Duty value 0 - 1023 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetValue
Sets the Value of the property PERIOD, PRESCALE or CHANNEL (if CHANNEL also updates the PORT from FCD)  
Fc9-string-icon.png - STRING Name
 
Fc9-string-icon.png - STRING Value
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetDirection
Set the motor direction. 
Fc9-u8-icon.png - BYTE direction
0 = Forwards, 1 = Reverse 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png GetList
Returns CHANNEL or PRESCALE list from the FCD and updates the internal property  
Fc9-string-icon.png - STRING Name
 
Fc9-string-icon.png - STRING Return



Property reference

Fc9-prop-icon.png Properties
Fc9-type-7-icon.png Enable
 
Fc9-conn-icon.png Settings
Fc9-type-16-icon.png Channel
PWM Channel selector 
Fc9-type-16-icon.png Mode
Selects between full bridge and half bridge output modes. Some H-Bridge channels may only have one mode in which case the property selector will only show the available mode. 
Fc9-type-16-icon.png Polarity
Selects the active output voltage. Active high - Pins will be low when inactive and high when active. Active Low- Pins will be high when inactive and low when active. 
Fc9-type-16-icon.png Timer
Timer associated with PWM to drive the output. Warning - All PWM channels linked to the same timer will share the same period and prescaler settings. 
Fc9-type-16-icon.png Prescaler Divide
Prescaler Divider value 
Fc9-type-14-icon.png Period Register
PWM Period Register value 
Fc9-conn-icon.png Dead Band
Fc9-type-21-icon.png Rising Bits
Number of bits assigned to the rising edge dead band counter. Auto populated based on selected target chip. 
Fc9-type-21-icon.png Falling Bits
Number of bits assigned to the falling edge dead band counter. Auto populated based on selected target chip. 
Fc9-type-21-icon.png Rising Count
Number of cycles to wait after a falling edge and before a rising edge. 
Fc9-type-21-icon.png Falling Count
Number of cycles to wait after a rising edge and before a falling edge. 
Fc9-conn-icon.png Connections
Fc9-type-5-icon.png A Pin
Output Pin A 
Fc9-type-5-icon.png B Pin
Output Pin B 
Fc9-type-5-icon.png C Pin
Output Pin C 
Fc9-type-5-icon.png D Pin
Output Pin D 
Fc9-type-16-icon.png A Remap Pin
Remap Pin A - Specifies the pin used for the A output. Only available on devices supporting remappable hardware pins. 
Fc9-type-16-icon.png B Remap Pin
Remap Pin B - Specifies the pin used for the B output. Only available on devices supporting remappable hardware pins. 
Fc9-type-16-icon.png C Remap Pin
Remap Pin C - Specifies the pin used for the C output. Only available on devices supporting remappable hardware pins. 
Fc9-type-16-icon.png D Remap Pin
Remap Pin D - Specifies the pin used for the D output. Only available on devices supporting remappable hardware pins. 
Fc9-conn-icon.png Calculations
Fc9-type-14-icon.png Clock Speed
Target Microcontroller Clock Speed. 
Fc9-type-15-icon.png Period (uS)
Calculated length of PWM period in micro seconds. 
Fc9-type-15-icon.png Frequency (KHz)
Calculated PWM output frequency in KHz. 
Fc9-type-15-icon.png Frequency (Hz)
Calculated PWM output frequency in Hz.