Difference between revisions of "Component: MIAC USB Slave (MIAC Module)"

From Flowcode Help
Jump to navigationJump to search
(XML import of component help)
(XML import)
Line 4: Line 4:
 
|-
 
|-
 
| width="20%" style="color: gray;" | Author
 
| width="20%" style="color: gray;" | Author
| [http://www.matrixltd.com Matrix Ltd]
+
| Matrix Ltd
 
|-
 
|-
 
| width="20%" style="color: gray;" | Version
 
| width="20%" style="color: gray;" | Version
Line 15: Line 15:
  
  
==[[File:Component Icon eabeda20_432c_4554_80b3_5851d675a9e7.png|Image]] MIAC USB Slave component==
+
==[[Media:Component Icon eabeda20_432c_4554_80b3_5851d675a9e7.png|Image]] MIAC USB Slave component==
A component designed to work with the MIAC hardware which needs to be pre-programmed with the USB slave firmware.
+
 
Allows the MIAC to become a slave to the PC and allows the MIAC functionality to be controlled or interrogated using the PC.
 
  
 
==Examples==
 
==Examples==

Revision as of 11:12, 16 January 2014


Author Matrix Ltd
Version 1.0
Category MIAC Module


Image MIAC USB Slave component

Examples

The MIAC needs programming with the USB Slave firmware to function correctly with the MIAC USB Slave component. Also the MIAC USB Slave USB driver will need to be installed before Windows will correctly recognise the device and allow Flowcode to communicate correctly. Use the MIACprog tool to download the firmware .hex file to the MIAC.

File:MIAC USB Slave Firmware.zip


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.

File:MIAC USB Slave.fcfx


Here is an example of the high level MIAC USB Slave console.

MIACUSBSCH.jpg


Here is an example of the low level MIAC USB Slave console.

MIACUSBSCL.jpg


If the MIAC USB Slave component can see the MIAC USB Slave then you will able to select the instance via the Instance property.

MIACUsbCon.jpg


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.

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

BYTE


GetAnalogueInput

Returns the value for a specific analogue input on the MIAC slave.

Parameters

BYTE Input


Return value

BYTE


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

BYTE


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

BYTE


PWMOvercurrentCheck

Checks the PWM outputs to see if they are overcurrent

Parameters

This macro has no parameters


Return value

BYTE


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

BYTE


CANGetRxData

Collects the data from the last received CAN message

Parameters

This macro has no parameters


Return value

STRING


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

BYTE


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

UINT


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.