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

From Flowcode Help
Jump to navigationJump to search
 
Line 163: Line 163:
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Mode''.
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Mode''.
  
''<span style="color:red;">No additional information</span>''
+
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
  
 
<span style="font-weight: normal;"><u>Polarity</u></span>
 
<span style="font-weight: normal;"><u>Polarity</u></span>
Line 171: Line 171:
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Polarity''.
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Polarity''.
  
''<span style="color:red;">No additional information</span>''
+
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.
  
 
<span style="font-weight: normal;"><u>Timer</u></span>
 
<span style="font-weight: normal;"><u>Timer</u></span>
Line 227: Line 229:
 
This property is of type ''Single digital pin'' and can be referenced with the variable name ''A_Pin''.
 
This property is of type ''Single digital pin'' and can be referenced with the variable name ''A_Pin''.
  
''<span style="color:red;">No additional information</span>''
+
Output Pin A
 
 
 
 
  
 
<span style="font-weight: normal;"><u>B Pin</u></span>
 
<span style="font-weight: normal;"><u>B Pin</u></span>
Line 235: Line 235:
 
This property is of type ''Single digital pin'' and can be referenced with the variable name ''B_Pin''.
 
This property is of type ''Single digital pin'' and can be referenced with the variable name ''B_Pin''.
  
''<span style="color:red;">No additional information</span>''
+
Output Pin B
 
 
 
 
  
 
<span style="font-weight: normal;"><u>C Pin</u></span>
 
<span style="font-weight: normal;"><u>C Pin</u></span>
Line 243: Line 241:
 
This property is of type ''Single digital pin'' and can be referenced with the variable name ''C_Pin''.
 
This property is of type ''Single digital pin'' and can be referenced with the variable name ''C_Pin''.
  
''<span style="color:red;">No additional information</span>''
+
Output Pin C
 
 
 
 
  
 
<span style="font-weight: normal;"><u>D Pin</u></span>
 
<span style="font-weight: normal;"><u>D Pin</u></span>
Line 251: Line 247:
 
This property is of type ''Single digital pin'' and can be referenced with the variable name ''D_Pin''.
 
This property is of type ''Single digital pin'' and can be referenced with the variable name ''D_Pin''.
  
''<span style="color:red;">No additional information</span>''
+
Output Pin D
 
 
 
 
  
 
<span style="font-weight: normal;"><u>A Remap Pin</u></span>
 
<span style="font-weight: normal;"><u>A Remap Pin</u></span>
Line 259: Line 253:
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''A_RemapPin''.
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''A_RemapPin''.
  
''<span style="color:red;">No additional information</span>''
+
Remap Pin A - Specifies the pin used for the A output.
 
 
  
 +
Only available on devices supporting remappable hardware pins.
  
 
<span style="font-weight: normal;"><u>B Remap Pin</u></span>
 
<span style="font-weight: normal;"><u>B Remap Pin</u></span>
Line 267: Line 261:
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''B_RemapPin''.
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''B_RemapPin''.
  
''<span style="color:red;">No additional information</span>''
+
Remap Pin B - Specifies the pin used for the B output.
 
 
  
 +
Only available on devices supporting remappable hardware pins.
  
 
<span style="font-weight: normal;"><u>C Remap Pin</u></span>
 
<span style="font-weight: normal;"><u>C Remap Pin</u></span>
Line 275: Line 269:
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''C_RemapPin''.
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''C_RemapPin''.
  
''<span style="color:red;">No additional information</span>''
+
Remap Pin C - Specifies the pin used for the C output.
 
+
 
+
Only available on devices supporting remappable hardware pins.
  
 
<span style="font-weight: normal;"><u>D Remap Pin</u></span>
 
<span style="font-weight: normal;"><u>D Remap Pin</u></span>
Line 283: Line 277:
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''D_RemapPin''.
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''D_RemapPin''.
  
''<span style="color:red;">No additional information</span>''
+
Remap Pin D - Specifies the pin used for the D output.
 
+
Only available on devices supporting remappable hardware pins.
 
 
  
 
<span style="font-weight: normal;"><u>Clock Speed</u></span>
 
<span style="font-weight: normal;"><u>Clock Speed</u></span>
Line 291: Line 284:
 
This property is of type ''Signed integer'' and can be referenced with the variable name ''CLK_SPEED''.
 
This property is of type ''Signed integer'' and can be referenced with the variable name ''CLK_SPEED''.
  
''<span style="color:red;">No additional information</span>''
+
Target Microcontroller Clock Speed.
 
 
 
 
  
 
<span style="font-weight: normal;"><u>Period (uS)</u></span>
 
<span style="font-weight: normal;"><u>Period (uS)</u></span>
Line 299: Line 290:
 
This property is of type ''Floating point'' and can be referenced with the variable name ''CALC_PERIOD''.
 
This property is of type ''Floating point'' and can be referenced with the variable name ''CALC_PERIOD''.
  
''<span style="color:red;">No additional information</span>''
+
Calculated length of PWM period in micro seconds.
 
 
 
 
  
 
<span style="font-weight: normal;"><u>Frequency (KHz)</u></span>
 
<span style="font-weight: normal;"><u>Frequency (KHz)</u></span>
Line 307: Line 296:
 
This property is of type ''Floating point'' and can be referenced with the variable name ''CALC_FREQ''.
 
This property is of type ''Floating point'' and can be referenced with the variable name ''CALC_FREQ''.
  
''<span style="color:red;">No additional information</span>''
+
Calculated PWM output frequency in KHz.
 
 
 
 
  
 
<span style="font-weight: normal;"><u>Frequency (Hz)</u></span>
 
<span style="font-weight: normal;"><u>Frequency (Hz)</u></span>
Line 315: Line 302:
 
This property is of type ''Floating point'' and can be referenced with the variable name ''CALC_FREQ2''.
 
This property is of type ''Floating point'' and can be referenced with the variable name ''CALC_FREQ2''.
  
''<span style="color:red;">No additional information</span>''
+
Calculated PWM output frequency in Hz.

Latest revision as of 10:20, 20 August 2018


Author Matrix TSL
Version 2.1 (Release)
Category Peripheral CAL


Image HBRIDGE (CAL) 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.


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

Downloadable macro reference

Disable

Disable this PWM Channel

Parameters

This macro has no parameters


Return value

This call does not return a value


Enable

Enable this PWM Channel

Parameters

This macro has no parameters


Return value

This call does not return a value


SetSpeed

Sets the motor speed by varying the PWM duty.

Parameters

UINT duty
Duty value 0 - 1023


Return value

This call does not return a value


SetDirection

Set the motor direction.

Parameters

BYTE direction
0 = Forwards, 1 = Reverse


Return value

This call does not return a value


Simulation macro reference

GetValue

Returns Named property Value

Parameters

STRING Name


Return value

STRING


SetValue

Sets the Value of the property

PERIOD, PRESCALE or CHANNEL

(if CHANNEL also updates the PORT from FCD)

Parameters

STRING Name
STRING Value


Return value

This call does not return a value


GetList

Returns CHANNEL or PRESCALE list from the FCD

and updates the internal property

Parameters

STRING Name


Return value

STRING



Property reference

Channel

This property is of type Fixed list of ints and can be referenced with the variable name CHANNEL.

PWM Channel selector

Mode

This property is of type Fixed list of ints and can be referenced with the variable name 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

Polarity

This property is of type Fixed list of ints and can be referenced with the variable name 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.

Timer

This property is of type Fixed list of ints and can be referenced with the variable name 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.

Prescaler Divide

This property is of type Fixed list of ints and can be referenced with the variable name PRESCALE.

Prescaler Divider value

Period Register

This property is of type Signed integer and can be referenced with the variable name PERIOD.

PWM Period Register value

Rising Bits

This property is of type Unsigned integer and can be referenced with the variable name RisingBits.

Number of bits assigned to the rising edge dead band counter.

Auto populated based on selected target chip.

Falling Bits

This property is of type Unsigned integer and can be referenced with the variable name FallingBits.

Number of bits assigned to the falling edge dead band counter.

Auto populated based on selected target chip.

Rising Count

This property is of type Unsigned integer and can be referenced with the variable name RisingCount.

Number of cycles to wait after a falling edge and before a rising edge.

Falling Count

This property is of type Unsigned integer and can be referenced with the variable name FallingCount.

Number of cycles to wait after a rising edge and before a falling edge.

A Pin

This property is of type Single digital pin and can be referenced with the variable name A_Pin.

Output Pin A

B Pin

This property is of type Single digital pin and can be referenced with the variable name B_Pin.

Output Pin B

C Pin

This property is of type Single digital pin and can be referenced with the variable name C_Pin.

Output Pin C

D Pin

This property is of type Single digital pin and can be referenced with the variable name D_Pin.

Output Pin D

A Remap Pin

This property is of type Fixed list of ints and can be referenced with the variable name A_RemapPin.

Remap Pin A - Specifies the pin used for the A output.

Only available on devices supporting remappable hardware pins.

B Remap Pin

This property is of type Fixed list of ints and can be referenced with the variable name B_RemapPin.

Remap Pin B - Specifies the pin used for the B output.

Only available on devices supporting remappable hardware pins.

C Remap Pin

This property is of type Fixed list of ints and can be referenced with the variable name C_RemapPin.

Remap Pin C - Specifies the pin used for the C output.

Only available on devices supporting remappable hardware pins.

D Remap Pin

This property is of type Fixed list of ints and can be referenced with the variable name D_RemapPin.

Remap Pin D - Specifies the pin used for the D output. Only available on devices supporting remappable hardware pins.

Clock Speed

This property is of type Signed integer and can be referenced with the variable name CLK_SPEED.

Target Microcontroller Clock Speed.

Period (uS)

This property is of type Floating point and can be referenced with the variable name CALC_PERIOD.

Calculated length of PWM period in micro seconds.

Frequency (KHz)

This property is of type Floating point and can be referenced with the variable name CALC_FREQ.

Calculated PWM output frequency in KHz.

Frequency (Hz)

This property is of type Floating point and can be referenced with the variable name CALC_FREQ2.

Calculated PWM output frequency in Hz.