Component: Control (AllCode)
Author | Matrix TSL |
Version | 1.0 (Release) |
Category | AllCode |
Contents
- 1 Control component
- 2 Examples
- 3 Downloadable macro reference
- 4 Simulation macro reference
- 4.1 SetAutoPrescaler
- 4.2 GetOutput
- 4.3 SetAutoOnOff
- 4.4 SetWIFIPort
- 4.5 SetAutoPIDFlip
- 4.6 SetBluetoothDetails
- 4.7 GetDataArray
- 4.8 GetWifiIP
- 4.9 SetWifiDetails
- 4.10 ResetToBoot
- 4.11 SetAutoOnOffParam
- 4.12 SetWifiMode
- 4.13 GetPIDComponent
- 4.14 SetEthernetPort
- 4.15 SetEthernetIP
- 4.16 SetCANID
- 4.17 GetFeedback
- 4.18 GetAPI
- 4.19 SetManualDuty
- 4.20 CheckErrorStatus
- 4.21 SetCANMode
- 4.22 SetAutoPID
- 4.23 SetLogDivider
- 4.24 ZeroSensor
- 4.25 SetAutoPIDParam
- 4.26 SetEthernetMode
- 4.27 SetBluetoothMode
- 4.28 Initialise
- 4.29 SetFeedbackMethod
- 4.30 SetSetpoint
- 5 Property reference
Control component
Drives the Matrix Control hardware via the AllCode API.
Examples
No additional examples
Downloadable macro reference
This component does not contain any downloadable macros
Simulation macro reference
SetAutoPrescaler
Configures the automatic mode prescaler, for running really slowly.
Defaults off so no need to call this unless you are using it.
Parameters
- BYTE Prescaler
- 0=Off, 2=Div by 2, 3=Div By 3 etc
Return value
- This call does not return a value
GetOutput
Gets the output value as an integer value betwen 0 and 100 representing
the output PWM duty
Parameters
- This macro has no parameters
Return value
SetAutoOnOff
Enable the auto PID control using the on-board microcontroller
Parameters
- BYTE Channel
- Range: 0-1
- BYTE Enable
- 0=Off, 1=5Hz, 2=10Hz, 3=20Hz, 4=50Hz, 5=100Hz, 6=200Hz, 7=500Hz, 8=1KHz
Return value
- This call does not return a value
SetWIFIPort
Configures the WIFI Port number.
Default 1245.
Parameters
- UINT Port
- Default 1245
Return value
- This call does not return a value
SetAutoPIDFlip
Controls if the PID response is flipped, a negative response vs a positive
Parameters
- BOOL Flip
- Default: 0=Not Flipped, 1=Flipped
Return value
- This call does not return a value
SetBluetoothDetails
Configures the Bluetooth device name and pin and stores into the none volatie memory onboard the robot arm.
Call the SetBluetoothMode macro after this to action the change.
Parameters
- <- STRING Name
- Bluetooth Device String, Max 20 Characters
- This parameter may be returned back to the caller
- <- STRING Pin
- Pin String, 4 Numeric Characters e.g. "1234"
- This parameter may be returned back to the caller
Return value
- This call does not return a value
GetDataArray
Collects a data array from the Control board.
Returns number of samples collected.
Parameters
- FLOAT data
Return value
GetWifiIP
Collects the IP address of the robot arm WIFI connection.
Parameters
- This macro has no parameters
Return value
SetWifiDetails
Configures the WIFI SSID and Password strings and stores into the none volatie memory onboard the robot arm.
Call the SetWifiMode macro after this to action the change.
Parameters
- <- STRING SSID
- Netword ID String, Max 32 Characters
- This parameter may be returned back to the caller
- <- STRING Password
- Password String, Max 32 Characters
- This parameter may be returned back to the caller
Return value
- This call does not return a value
ResetToBoot
Resets the board into bootload mode for reprogramming.
Comms port will be closed on calling this macro,
Parameters
- This macro has no parameters
Return value
- This call does not return a value
SetAutoOnOffParam
Sets the Hysteresis parameter for the Auto on-board On/Off
Parameters
- FLOAT Hysteresis
- Hysterists in real world units
Return value
- This call does not return a value
SetWifiMode
Configures the WIFI mode.
When enabled the control system can either create its own WIFI network or join an existing WIFI network,
Parameters
- BYTE Mode
- 0=Disabled, 1=Host Network, 2=Join Network
Return value
- This call does not return a value
GetPIDComponent
Gets one of the PID controller output components in real world units
Parameters
- BYTE Index
- Range 0-2, 0=P, 1=I, 2=D
Return value
SetEthernetPort
Configures the Ethernet Port number.
Default 1245.
Parameters
- UINT Port
- Default 1245
Return value
- This call does not return a value
SetEthernetIP
Configures the Ethernet IP Address.
Parameters
- <- STRING IP
- IP Address string e.g. "192.168.1.100"
- This parameter may be returned back to the caller
Return value
- This call does not return a value
SetCANID
Stores the specified CAN ID into an internal none volatile memory location.
Parameters
- UINT ID
Return value
- This call does not return a value
GetFeedback
Gets the feedback as a value in real world units
Parameters
- This macro has no parameters
Return value
GetAPI
Gets the API version number
Parameters
- This macro has no parameters
Return value
SetManualDuty
Sets duty parameter for one of the manual controlled outputs
Parameters
- BYTE Channel
- Range: 0-1
- FLOAT Duty
- Duty Cycle Output in Percentage Range 0 - 100%
Return value
- This call does not return a value
CheckErrorStatus
Returns the Error status value indicating if there has been any errors.
0 = No Error
1 = Timeout Error
Parameters
- This macro has no parameters
Return value
SetCANMode
Configures if the CAN API mde is enabled or disabled.
Parameters
- BYTE Mode
- 0=Disabled / 1=Enabled
Return value
- This call does not return a value
SetAutoPID
Enable the auto PID control using the on-board microcontroller
Parameters
- BYTE Channel
- Range: 0-1
- BYTE Enable
- 0=Off, 1=5Hz, 2=10Hz, 3=20Hz, 4=50Hz, 5=100Hz, 6=200Hz, 7=500Hz, 8=1KHz
Return value
- This call does not return a value
SetLogDivider
Configures the rate of the PID logging.
Parameters
- BYTE Divider
- Divides the rate by the selected value
Return value
- This call does not return a value
ZeroSensor
Zeros the attached sensor reading.
Useful for Pressure and Level control applications.
Parameters
- This macro has no parameters
Return value
- This call does not return a value
SetAutoPIDParam
Sets one of the P, I, D parameters for the Auto on-board PID
Parameters
- BYTE Index
- Range: 0-5 Where 0=P, 1=I, 2=D, 3=IntClamp, 4=DFilt, 5=FiltCo
- FLOAT Value
- Range: 0.0 to 65.535
Return value
- This call does not return a value
SetEthernetMode
Configures the Ethernet mode.
Parameters
- BYTE Mode
- 0=Disabled, 1=Enabled
Return value
- This call does not return a value
SetBluetoothMode
Configures the Bluetooth mode.
Parameters
- BOOL Mode
- 0=Disabled, 1=Enabled
Return value
- This call does not return a value
Initialise
No additional information
Parameters
- This macro has no parameters
Return value
- This call does not return a value
SetFeedbackMethod
Sets feedback method to dictate which control application we are running
Parameters
- BYTE FBMethod
- Range: 0-3 Where 0=Level, 1=Flow, 2=Pressure, 3=Temp
- FLOAT InputScaler
- Feedback scaling factor used to convert the feedback reading into a meaningful value
- FLOAT OutputScaler
- Value used to convert input to 0-100% duty
Return value
- This call does not return a value
SetSetpoint
Sets Setpoint parameter for the Auto on-board PID
Parameters
- FLOAT Setpoint
- Required Output in Real World Units
Return value
- This call does not return a value
Property reference
Comms Method
This property is of type Fixed list of ints and can be referenced with the variable name CommsMethod.
Selects the method to communicate with the Matrix 3 Axis Robot Arm.
USB connection requires the USB drivers to be installed.
Bluetooth connection requires the device first be paired using the Windows Bluetooth control panel.
WIFI connection requires the connection settings to be configured first on the robot using USB or Bluetooth.
CAN connection does not simulate and works on embedded hardware e.g. the MIAC.
Autodetect
This property is of type True or false and can be referenced with the variable name Autodetect.
Autodetects the COM port, only works for USB AllCode connection.
COM Port
This property is of type Fixed list of ints and can be referenced with the variable name COMPort1::COM_port.
Selects which port to communicate with, only lists ports which are currently available.
Network Interface
This property is of type Fixed list of ints and can be referenced with the variable name NetworkComms1::NetworkInterface.
Some computers may have several network interfaces such as ethernet ports and wifi access.
Select the correct network interface for the network you wish to connect to.
Use the IP address to confirm you are connected to the right network.
Local IP Address
This property is of type Line of text and can be referenced with the variable name NetworkComms1::IPAddress.
IP Address of the selected network interface.
Control IP Address
This property is of type Line of text and can be referenced with the variable name ArmIP.
IP address of the Control Board.
You can find the IP address by connecting using USB and running the GetIP component macro.
You may first need to configure the Control Board in WIFI mode by providing the network SSID and Password.
Port
This property is of type Unsigned integer and can be referenced with the variable name Port.
Allows the Control TCP/IP Port to be selected. Default 1245.
Channel
This property is of type Fixed list of ints and can be referenced with the variable name can1::CHANNEL_CAN.
Switches between Internal CAN peripheral and External CAN controller IC MCP2515.
Text Colour
This property is of type Color picker and can be referenced with the variable name TextColour.
No additional information