Aurora Visio Studio TOP » Program Examples » IO Serial Port Communicator

IO Serial Port Communicator

目的

The task is to create a demonstrative version of a program, that is responsible for connecting to the serial port with provided parameters, send new data (binary or text), have the option to see the last message and have the ability to safely disconnect.

Data required for connection:

  • Port Name
  • Baud Rate
  • Parity
  • Data Bits
  • Flow Control
  • Stop Bits

ヒント

You can use help of that article:Programming Finite State Machines, when it comes to deciding on the structure of the program. You can also read more on Macrofilters

マクロフィルタ メイン

Macrofilter StateMachine(CONNECTED)

Macrofilter StateMachine(DISCONNECT)

Macrofilter StateMachine(SEND_BYTES)

Macrofilter StateMachine(SEND_TEXT)

Macrofilter StateMachine(SETUP_CONNECTION)

Macrofilter StateMachine(WAIT_FOR_KEY)

Macrofilter CreateTextForConsole

使用したフィルタ

アイコン 名前 説明
ChooseByPredicate E.g. to choose GREEN color to visualize correct objects or RED to visualize defective ones.
RemoveNils This filter is useful e.g. when inspecting multiple objects while some of the inspections may fail (Nil result). RemoveNils is used to ignore the failed cases in the final result.
ConcatenateStrings_OfArray Joins multiple strings into a single one.
SerialPort_Config Configures the serial port.
SerialPort_WriteString Writes string characters to serial port.
SerialPort_ReadBuffer Reads raw binary data from serial port.
WriteIntegerArrayToBuffer Converts an array of integer values into specified binary representation and writes it to a byte buffer.
SerialPort_WriteBuffer Writes raw binary data from a byte buffer to serial port.
Loop このフィルターを、ループを持つ必要があるタスクに配置しますが、他のループ ジェネレーター (例: GrabImage) を持たないようにします。
LastMultipleObjects Returns an array of most recent objects.
ParseInteger Returns the integer number represented by a string.
FormatIntegerToString Useful for preparing a number for display or communication with specific number of digits, sign etc.
ConcatenateStrings Joins two or more strings into a single one.
SplitString Divides the input string into an array of strings using the specified delimiters.
ReadIntegerArrayFromBuffer Reads an array of integer values in specified binary format from a byte buffer.

その他の資料

  • Array Transforms - List of filters performing operations on arrays.
  • Serial Port - List of filters performing operations on Serial Ports.