MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Manual de usuario Pagina 338

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 408
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 337
8 Serial Port I/O
8-18
Getting Started with Serial I/O
To get you started with MATLAB’s serial port interface, this section provides
the following information:
“Example: Getting Started” illustrates some basic serial port commands.
“The Serial Port Session” describes the steps you use to perform any serial
port task from beginning to end.
“Configuring and Returning Properties” describes how you display serial
port property names and property values, and how you assign values to
properties.
Example: Getting Started
If you have a device connected to the serial port COM1 and configured for a
baud rate of 4800, you can execute the following complete example.
s = serial('COM1');
set(s,'BaudRate',4800);
fopen(s);
fprintf(s,'*IDN?')
out = fscanf(s);
fclose(s)
delete(s)
clear s
The *IDN? command queries the device for identification information, which is
returned to
out. If your device does not support this command, or if it is
connected to a different serial port, you should modify the above example
accordingly.
Note *IDN? is one of the commands supported by the Standard Commands
for Programmable Instruments (SCPI) language, which is used by many
modern devices. Refer to your device documentation to see if it supports the
SCPI language.
Vista de pagina 337
1 2 ... 333 334 335 336 337 338 339 340 341 342 343 ... 407 408

Comentarios a estos manuales

Sin comentarios