Difference between revisions of "Component: MIAC USB Slave (MIAC Module)"
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | |||
+ | |||
{| width="50%" | {| width="50%" | ||
|- | |- | ||
Line 5: | Line 7: | ||
|- | |- | ||
| width="20%" style="color: gray;" | Version | | width="20%" style="color: gray;" | Version | ||
− | | 1. | + | | 1.1 (Release) |
|- | |- | ||
| width="20%" style="color: gray;" | Category | | width="20%" style="color: gray;" | Category | ||
Line 14: | Line 16: | ||
==[[File:Component Icon eabeda20_432c_4554_80b3_5851d675a9e7.png|Image]] MIAC USB Slave component== | ==[[File:Component Icon eabeda20_432c_4554_80b3_5851d675a9e7.png|Image]] MIAC USB Slave component== | ||
− | + | Allows Matrix's MIAC PLC to be used as a PC peripheral controlled by Flowcode via a USB | |
+ | connection. | ||
==Examples== | ==Examples== | ||
− | |||
− | |||
===Firmware & USB Driver=== | ===Firmware & USB Driver=== | ||
Line 34: | Line 35: | ||
Here is a simple Flowcode program to toggle one of the transistor outputs on the MIAC USB Slave device. Remember to connect a linking wire between the (M) screw terminal to the (V+) screw terminal to allow the Transistor LEDs to light. | Here is a simple Flowcode program to toggle one of the transistor outputs on the MIAC USB Slave device. Remember to connect a linking wire between the (M) screw terminal to the (V+) screw terminal to allow the Transistor LEDs to light. | ||
− | |||
{{Fcfile|MIAC USB Slave.fcfx|MIAC USB Slave}} | {{Fcfile|MIAC USB Slave.fcfx|MIAC USB Slave}} | ||
− | |||
− | |||
Here is an example of the high level MIAC USB Slave console. | Here is an example of the high level MIAC USB Slave console. | ||
Line 56: | Line 54: | ||
− | ===Controlled Using | + | ===Controlled Using VB6 / VB2008=== |
− | Files taken from the [http://www.matrixmultimedia.com/product.php?Prod=LK5783 Industrial sensor, actuator and control applications | + | Files taken from the [http://www.matrixmultimedia.com/product.php?Prod=LK5783 Locktronics Industrial sensor, actuator and control applications solution] |
− | |||
− | |||
+ | [[File:VB Examples.zip]] | ||
===Controlled Using Labview=== | ===Controlled Using Labview=== | ||
− | Files taken from the [http://www.matrixmultimedia.com/product.php?Prod=LK5783 Industrial sensor, actuator and control applications | + | Files taken from the [http://www.matrixmultimedia.com/product.php?Prod=LK5783 Locktronics Industrial sensor, actuator and control applications solution] |
− | [[File: | + | [[File:Labview Examples.zip]] |
Line 184: | Line 181: | ||
Data2 (0-255) | Data2 (0-255) | ||
Data3 (0-255) | Data3 (0-255) | ||
+ | |||
Data4 (0-255) | Data4 (0-255) | ||
Data5 (0-255) | Data5 (0-255) | ||
Line 198: | Line 196: | ||
|21 | |21 | ||
|CAN Check Incoming | |CAN Check Incoming | ||
+ | |N/A | ||
+ | |ID High | ||
+ | ID Low | ||
+ | |- | ||
+ | |22 | ||
+ | |CAN Get RX Data | ||
|N/A | |N/A | ||
|Num Bytes (0-8) | |Num Bytes (0-8) | ||
Line 204: | Line 208: | ||
Data2 (0-255) | Data2 (0-255) | ||
Data3 (0-255) | Data3 (0-255) | ||
+ | |||
Data4 (0-255) | Data4 (0-255) | ||
Data5 (0-255) | Data5 (0-255) |
Latest revision as of 15:01, 2 May 2018
Author | Matrix Ltd |
Version | 1.1 (Release) |
Category | MIAC Module |
Contents
- 1 MIAC USB Slave component
- 2 Examples
- 3 Downloadable macro reference
- 4 Simulation macro reference
- 4.1 LCDPrintString
- 4.2 GetRegisterValue
- 4.3 GetAnalogueInput
- 4.4 LCDPrintNumber
- 4.5 CANTx
- 4.6 GetKeypadBuffer
- 4.7 SetRegisterValue
- 4.8 GetEEPROMData
- 4.9 PWMOvercurrentCheck
- 4.10 PWMSetPeriod
- 4.11 PWMControl
- 4.12 CANSetTxData
- 4.13 GetDigitalInputs
- 4.14 CANGetRxData
- 4.15 SetEEPROMData
- 4.16 PWMSetDuty
- 4.17 SetOutputBank
- 4.18 SetTransistorOutput
- 4.19 GetDigitalInput
- 4.20 ClearKeypadBuffer
- 4.21 LCDSetCursor
- 4.22 CANCheckRx
- 4.23 LCDClear
- 4.24 SetRelayOutput
- 5 Property reference
MIAC USB Slave component
Allows Matrix's MIAC PLC to be used as a PC peripheral controlled by Flowcode via a USB connection.
Examples
Firmware & USB Driver
The MIAC needs programming with the USB Slave firmware to function correctly with the MIAC USB Slave component.
Use the MIACprog tool to download the firmware .hex file to the MIAC.
File:MIAC USB Slave Firmware.zip
The MIAC USB Slave USB driver will need to be installed before Windows will correctly recognise the device and allow Flowcode to communicate correctly.
Controlled Using Flowcode
Here is a simple Flowcode program to toggle one of the transistor outputs on the MIAC USB Slave device. Remember to connect a linking wire between the (M) screw terminal to the (V+) screw terminal to allow the Transistor LEDs to light. MIAC USB Slave Here is an example of the high level MIAC USB Slave console.
Here is an example of the low level MIAC USB Slave console.
If the MIAC USB Slave component can see the MIAC USB Slave then you will able to select the instance via the Instance property.
Multiple MIAC USB slaves can be connected to a single PC and controlled by adding multiple MIAC USB Slave components each referring to their own instance of the hardware.
Controlled Using VB6 / VB2008
Files taken from the Locktronics Industrial sensor, actuator and control applications solution
Controlled Using Labview
Files taken from the Locktronics Industrial sensor, actuator and control applications solution
Command Table
Command Number | Description | Parameters | Returns |
1 | Digital Input | Channel (1-8) | Input State (0-1) |
2 | Digital Multi Input | N/A | Input State 8-bit (0-255) |
3 | Analogue Input | Channel (1-8) | Input ADC Reading (0-255) |
4 | Read Keypad Buffer | N/A | Key Press (0-8 or 255) |
5 | Clear Keypad Buffer | N/A | N/A |
6 | Relay Control | Channel (1-4)
Relay State (0-1) |
N/A |
7 | Transistor Control | Channel (1-4)
Transistor State (0-1) |
N/A |
8 | Multi Output Control | Output Value (0-255)
Output Mask (0-255) |
N/A |
9 | Display Clear | N/A | N/A |
10 | Display Cursor Position | X Coord (0-15)
Y Coord (0-3) |
N/A |
11 | Display Number | Number Low Byte (0-255)
Number High Byte (0-255) |
N/A |
12 | Display String | String Data | N/A |
13 | PWM Enable Control | PWM Channel (1-2)
Enabled (0-1) |
N/A |
14 | PWM Duty Control | PWM Channel (1-2)
Duty (0-255) |
N/A |
15 | PWM Period Control | Prescaler (0-2) | N/A |
16 | PWM Overcurrent Check | N/A | Overcurrent State (0-1) |
17 | EEPROM Write | Address (0-255)
Data (0-255) |
N/A |
18 | EEPROM Read | Address (0-255) | Data (0-255) |
19 | CAN Set Data | Num Bytes (0-8)
Data0 (0-255) Data1 (0-255) Data2 (0-255) Data3 (0-255) Data4 (0-255) Data5 (0-255) Data6 (0-255) Data7 (0-255) |
N/A |
20 | CAN Send Message | ID Low Byte (0-255)
ID High Byte (0-7) |
N/A |
21 | CAN Check Incoming | N/A | ID High
ID Low |
22 | CAN Get RX Data | N/A | Num Bytes (0-8)
Data0 (0-255) Data1 (0-255) Data2 (0-255) Data3 (0-255) Data4 (0-255) Data5 (0-255) Data6 (0-255) Data7 (0-255) |
23 | Register Read | Address Low Byte (0-255)
Address High Byte (0-255) |
Register Data Byte (0-255) |
24 | Register Write | Address Low Byte (0-255)
Address High Byte (0-255) Register Data Byte (0-255) |
N/A |
Downloadable macro reference
This component does not contain any downloadable macros
Simulation macro reference
LCDPrintString
Prints a string to the LCD on the MIAC.
Parameters
- <- STRING Str
- This parameter may be returned back to the caller
Return value
- This call does not return a value
GetRegisterValue
Gets the value of the register specified on the MIAC
Parameters
- UINT RegAddress
Return value
GetAnalogueInput
Returns the value for a specific analogue input on the MIAC slave.
Parameters
- BYTE Input
Return value
LCDPrintNumber
Prints out a number to the display on the MIAC.
Parameters
- INT Number
Return value
- This call does not return a value
CANTx
Sends the Tx data with the ID specified in the form of a CAN message
Parameters
- UINT CANID
Return value
- This call does not return a value
GetKeypadBuffer
Returns a keypress from the keypress buffer, returns 255 if no keypress is available.
Parameters
- This macro has no parameters
Return value
SetRegisterValue
Sets the value of the register specified on the MIAC
Parameters
- UINT RegAddress
- BYTE Value
Return value
- This call does not return a value
GetEEPROMData
Reads a byte from the EEPROM data memory
Parameters
- BYTE Address
Return value
PWMOvercurrentCheck
Checks the PWM outputs to see if they are overcurrent
Parameters
- This macro has no parameters
Return value
PWMSetPeriod
Sets the PWM period for the channel specified
Parameters
- BYTE Prescaler
- BYTE Period
Return value
- This call does not return a value
PWMControl
Sets the PWM channel specified to be enabled or disabled
Parameters
- BYTE Channel
- BYTE Enable
Return value
- This call does not return a value
CANSetTxData
Sets the LCD cursor position on the MIAC
Parameters
- BYTE DataCount
- BYTE d0
- BYTE d1
- BYTE d2
- BYTE d3
- BYTE d4
- BYTE d5
- BYTE d6
- BYTE d7
Return value
- This call does not return a value
GetDigitalInputs
Returns the value for a all 8 digital inputs on the MIAC slave.
Parameters
- This macro has no parameters
Return value
CANGetRxData
Collects the data from the last received CAN message
Parameters
- This macro has no parameters
Return value
SetEEPROMData
Writes a byte to the EEPROM data memory
Parameters
- BYTE Address
- BYTE Data
Return value
- This call does not return a value
PWMSetDuty
Sets the duty cycle for the PWM channel specified
Parameters
- BYTE Channel
- BYTE Duty
Return value
- This call does not return a value
SetOutputBank
Controls the state of one of the transistor outputs on the MIAC slave.
Parameters
- BYTE Mask
- BYTE Output_States
Return value
- This call does not return a value
SetTransistorOutput
Controls the state of one of the transistor outputs on the MIAC slave.
Parameters
- BYTE Transistor
- BYTE State
Return value
- This call does not return a value
GetDigitalInput
Returns the value for a specific digital input on the MIAC slave.
Parameters
- BYTE Input
Return value
ClearKeypadBuffer
Destroys the contents of the keypad buffer.
Parameters
- This macro has no parameters
Return value
- This call does not return a value
LCDSetCursor
Sets the LCD cursor position on the MIAC
Parameters
- BYTE x
- BYTE y
Return value
- This call does not return a value
CANCheckRx
Checks to see if a CAN message has been received, if so the ID is returned
Parameters
- This macro has no parameters
Return value
LCDClear
Clears the LCD display on the MIAC.
Parameters
- This macro has no parameters
Return value
- This call does not return a value
SetRelayOutput
Controls the state of one of the Relay outputs on the MIAC slave.
Parameters
- BYTE Relay
- BYTE State
Return value
- This call does not return a value
Property reference
Instance
This property is of type Fixed list of ints and can be referenced with the variable name instance.
USB Slave Instance, if empty then is the MIAC slave firmware loaded, Is the MIAC slave driver installed, Is the MIAC connected and powered.