Rockwell-automation 1771-DMC_DMC1_DMC4_DXPS Control Coprocessor User M Uživatelský manuál Strana 113

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 312
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 112
Chapter 7

7-5
You can use the serial ports for ASCII and other serial communication.
Examples of ASCII peripheral devices that you can use are:
ASCII terminals
bar-code readers
Allen-Bradley Dataliner
weigh scales
printers
Accessing a Port
When you use a serial port for ASCII and other serial communication, use
standard C library calls. You can use C calls such as:
getc()
read()
write()
Your C program can get and change port parameters using the OS-9 library
calls _gs_opt() and _ss_opt().
See the OS-9 C User Manual, publication 1771-6.5.104, for more
information on C library calls.
Example Program
The following program sets up the COMM2 port (/t2) with the proper
parameters for receiving data from a bar-code reader. The program:
clears the input buffer on the COMM2 port
loops forever, waiting for carriage-return-terminated lines
of ASCII characters indicating that a bar code has been read
places bar-code data in a buffer
calls a subroutine to handle decision-making (based
on the content of the bar code)
Using a Serial Port for ASCII
and Other Serial
Communication
Zobrazit stránku 112
1 2 ... 108 109 110 111 112 113 114 115 116 117 118 ... 311 312

Komentáře k této Příručce

Žádné komentáře