External Interfaces/API Reference    
fopen (serial)

Connect a serial port object to the device

Syntax

Arguments

obj
A serial port object or an array of serial port objects.

Description

fopen(obj) connects obj to the device.

Remarks

Before you can perform a read or write operation, obj must be connected to the device with the fopen function. When obj is connected to the device:

An error is returned if you attempt to perform a read or write operation while obj is not connected to the device. You can connect only one serial port object to a given device.

Some properties are read-only while the serial port object is open (connected), and must be configured before using fopen. Examples include InputBufferSize and OutputBufferSize. Refer to the property reference pages to determine which properties have this constraint.

The values for some properties are verified only after obj is connected to the device. If any of these properties are incorrectly configured, then an error is returned when fopen is issued and obj is not connected to the device. Properties of this type include BaudRate, and are associated with device settings.

If you use the help command to display help for fopen, then you need to supply the pathname shown below.

Example

This example creates the serial port object s, connects s to the device using fopen, writes and reads text data, and then disconnects s from the device.

See Also

Functions

fclose

Properties

BytesAvailable, BytesToOutput, Status, ValuesReceived, ValuesSent


  fgets (serial) fprintf (serial)