MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Manuale Utente Pagina 347

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 408
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 346
Connecting to the Device
8-27
Connecting to the Device
Before you can use the serial port object to write or read data, you must connect
it to your device via the serial port specified in the
serial function. You connect
a serial port object to the device with the
fopen function.
fopen(s)
Some properties are read-only while the serial port object is connected and
must be configured before using
fopen. Examples include the
InputBufferSize and the OutputBufferSize properties. Refer to “Property
Reference” on page 8-70 to determine when you can configure a property.
Note You can create any number of serial port objects. However, you can
connect only one serial port object to a given serial port at a time.
You can examine the
Status property to verify that the serial port object is
connected to the device.
s.Status
ans =
open
As illustrated below, the connection between the serial port object and the
device is complete, and you can write and read data.
Serial Port I/O Hardware
s=serial('COM1');
fopen(s)
01.00
COM1
InstrumentMATLAB
Vedere la pagina 346
1 2 ... 342 343 344 345 346 347 348 349 350 351 352 ... 407 408

Commenti su questo manuale

Nessun commento