Difference between revisions of "Component: Visi (4DSystems) (Comms: System)"

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
(XML import)
 
(2 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
|-
 
|-
 
| width="20%" style="color: gray;" | Version
 
| width="20%" style="color: gray;" | Version
| 1.2 (Release)
+
| 2.0 (Release)
 
|-
 
|-
 
| width="20%" style="color: gray;" | Category
 
| width="20%" style="color: gray;" | Category
Line 20: Line 20:
  
 
==Examples==
 
==Examples==
''<span style="color:red;">No additional examples</span>''
+
These examples are designed to work with a 4D systems display pre-programmed with the VISI Genie runtime files. These files are also included in the example archives to allow you to easily replicate the project.
  
 +
The 4D display can either be connected to the PC running Flowcode using the 4D USB cable or connected to an embedded Microcontroller using a hardware or software UART. If you are using the Flowcode simulation to communicate with the Visi component then be sure to set the Visi COM port property to the COM port assigned by Windows to the 4D USB Cable.
 +
 +
The Console window should also show some helpful information to aid in debugging any problems.
 +
 +
 +
The first example demonstrates a simple rocker switch Visi component.
 +
{{fcfile|RockerSwitch.zip|RockerSwitch}}
 +
The second example demonstrates controlling the colour of an RGB LED using the Visi colour picker component.
 +
{{fcfile|ColourPicker.zip|ColourPicker}}
  
 
==Downloadable macro reference==
 
==Downloadable macro reference==
Line 60: Line 69:
  
 
:[[Variable Types|BYTE]]
 
:[[Variable Types|BYTE]]
 +
 +
 +
===<span style="font-weight: normal;"><u><tt>ChangeHWBaud</tt></u></span>===
 +
Changes the hardware UART baud rate allowing for dynamic speed changes.
 +
 +
'''Parameters'''
 +
 +
:[[Variable Types|BYTE]] ''NewBaud''
 +
::0=1200, 1=2400, 2=4800, 3=9600, 4=19200, 5=38400, 6=57600, 7=115200
 +
 +
 +
'''Return value'''
 +
 +
:''This call does not return a value''
  
  
Line 157: Line 180:
 
==Simulation macro reference==
 
==Simulation macro reference==
  
===<span style="font-weight: normal;"><u><tt>GetConsoleHandle</tt></u></span>===
+
''This component does not contain any simulation macros''
Gets the handle to the console allowing data displaying on the panel etc.
 
  
'''Parameters'''
 
  
:''This macro has no parameters''
+
==Property reference==
 +
<span style="font-weight: normal;"><u>Channel</u></span>
  
 +
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_uart::CHANNEL''.
  
'''Return value'''
+
UART Channel selector
  
:[[Variable Types|HANDLE]]
+
Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels.
  
 +
Hardware channels use the selected peripheral on-board the target microcontroller.
  
 +
<span style="font-weight: normal;"><u>Baud Options</u></span>
  
 +
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_uart::BAUD_LIST''.
  
==Property reference==
+
Baud rate option selector
<span style="font-weight: normal;"><u>Channel</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''CHANNEL''.
+
<span style="font-weight: normal;"><u>Baud Rate</u></span>
  
UART communications channel to specify software mode or select a hardware peripheral
+
This property is of type ''Signed integer'' and can be referenced with the variable name ''cal_uart::BAUD''.
  
<span style="font-weight: normal;"><u>Baud Rate</u></span>
+
''<span style="color:red;">No additional information</span>''
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''BAUD_LIST''.
 
  
Communications data rate in bits per second.
 
  
 
<span style="font-weight: normal;"><u>TX</u></span>
 
<span style="font-weight: normal;"><u>TX</u></span>
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''TX''.
+
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_uart::TX''.
  
Transmit pin which is configurable for software channels but fixed for hardware channels
+
Pin to be used for Transmit data
  
 
<span style="font-weight: normal;"><u>RX</u></span>
 
<span style="font-weight: normal;"><u>RX</u></span>
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''RX''.
+
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_uart::RX''.
  
Receive pin which is configurable for software channels but fixed for hardware channels
+
Pin to be used for Receive data
  
 
<span style="font-weight: normal;"><u>Label</u></span>
 
<span style="font-weight: normal;"><u>Label</u></span>
Line 202: Line 225:
  
 
Label shown on the communications flasher component
 
Label shown on the communications flasher component
 +
 +
<span style="font-weight: normal;"><u>Scope Traces</u></span>
 +
 +
This property is of type ''True or false'' and can be referenced with the variable name ''cal_uart::ScopeTraces''.
 +
 +
Selects if the scope traces are automatically added to the data recorder window or not.
 +
 +
    Simulation - draws an approximation of the UART data onto the scope trace.
 +
 +
    ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD.
 +
 +
<span style="font-weight: normal;"><u>Console Data</u></span>
 +
 +
This property is of type ''True or false'' and can be referenced with the variable name ''cal_uart::ConsoleData''.
 +
 +
Selects if the console data is automatically generated or not
  
 
<span style="font-weight: normal;"><u>Console Columns</u></span>
 
<span style="font-weight: normal;"><u>Console Columns</u></span>
  
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''ConsoleColumns''.
+
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''cal_uart::ConsoleColumns''.
 +
 
 +
Number of characters that can be displayed on a single line of the console.
 +
 
 +
<span style="font-weight: normal;"><u>Data Source</u></span>
 +
 
 +
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_uart::DataSource''.
  
Maximum number of characters to display on the console before moving to the next line.
+
Simulation data source used to allow the component to connect to various remote devices
  
<span style="font-weight: normal;"><u>COM Port</u></span>
+
    Nothing - Simulation data is ignored
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''com_port''.
+
    COM port - Routes the communication data to and from a physical or virtual COM port
  
Simulation COM Port to allow Visi devices to interact with the Flowcode simulation
+
    Injector - Routes the communication data via a data injector component on the Panel.

Latest revision as of 10:31, 9 May 2018


Author Matrix Ltd.
Version 2.0 (Release)
Category Comms: System


Image Visi (4DSystems) component

A way of interacting with the VISI interface designed by 4D systems. VISI firmware must be pre-loaded onto the SD card connected to the display to allow everything to work correctly.

Examples

These examples are designed to work with a 4D systems display pre-programmed with the VISI Genie runtime files. These files are also included in the example archives to allow you to easily replicate the project.

The 4D display can either be connected to the PC running Flowcode using the 4D USB cable or connected to an embedded Microcontroller using a hardware or software UART. If you are using the Flowcode simulation to communicate with the Visi component then be sure to set the Visi COM port property to the COM port assigned by Windows to the 4D USB Cable.

The Console window should also show some helpful information to aid in debugging any problems.


The first example demonstrates a simple rocker switch Visi component. FC6 Icon.png RockerSwitch The second example demonstrates controlling the colour of an RGB LED using the Visi colour picker component. FC6 Icon.png ColourPicker

Downloadable macro reference

VisiWriteString

Writes a string to a specific Visi object.

Returns 0 for a succesful write operation.

Parameters

BYTE StringIndex
<- STRING StringData
This parameter may be returned back to the caller


Return value

BYTE


VisiWriteObject

Writes a value to a specific Visi object.

Returns 0 for a succesful write operation.

Parameters

BYTE ObjectID
BYTE ObjectIndex
UINT Value


Return value

BYTE


ChangeHWBaud

Changes the hardware UART baud rate allowing for dynamic speed changes.

Parameters

BYTE NewBaud
0=1200, 1=2400, 2=4800, 3=9600, 4=19200, 5=38400, 6=57600, 7=115200


Return value

This call does not return a value


VisiReceive

Waits for an incoming Visi Report Object or Report Event to be sent from the display. A detected incoming message returns 0 and can be read using the VisiReadByteFromMessage macro.

Parameters

This macro has no parameters


Return value

BYTE


VisiWriteContrast

Updates the display contrast.

Returns 0 for a succesful write operation.

Parameters

BYTE Contrast
Range 0-15, 0=Backlight Off


Return value

BYTE


VisiWriteVolume

Updates the display volume.

Returns 0 for a succesful write operation.

Parameters

BYTE Volume
Range 8-127


Return value

BYTE


VisiReadByteFromMessage

Reads a byte from a succesful VisiReceive macro.

Index: 0=Command, 1=ObjectID, 2=ObjectIndex, 3=ValueMSB, 4=ValueLSB

Parameters

BYTE Index


Return value

BYTE


VisiReadObject

Reads the value from a specific Visi object.

Returns 0 for a sucessful read.

Use the VisiReadByteFromMessage macro to pull out the incoming data.

Parameters

BYTE ObjectID
BYTE ObjectIndex


Return value

BYTE


Initialise

Sets up the RS232 peripheral, must be called at the start of your program or at least before you start calling any other RS232 macros.

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

Channel

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

UART Channel selector

Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels.

Hardware channels use the selected peripheral on-board the target microcontroller.

Baud Options

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

Baud rate option selector

Baud Rate

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

No additional information


TX

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

Pin to be used for Transmit data

RX

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

Pin to be used for Receive data

Label

This property is of type Line of text and can be referenced with the variable name label.

Label shown on the communications flasher component

Scope Traces

This property is of type True or false and can be referenced with the variable name cal_uart::ScopeTraces.

Selects if the scope traces are automatically added to the data recorder window or not.

   Simulation - draws an approximation of the UART data onto the scope trace.
   ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD.

Console Data

This property is of type True or false and can be referenced with the variable name cal_uart::ConsoleData.

Selects if the console data is automatically generated or not

Console Columns

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

Number of characters that can be displayed on a single line of the console.

Data Source

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

Simulation data source used to allow the component to connect to various remote devices

   Nothing - Simulation data is ignored
   COM port - Routes the communication data to and from a physical or virtual COM port 
   Injector - Routes the communication data via a data injector component on the Panel.