Rockwell-automation 1771-DMC_DMC1_DMC4_DXPS Control Coprocessor User M Instrukcja Użytkownika Strona 228

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 312
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 227

Appendix B

B-97
C Example
short variable [4] /* buffer to store read data */
unsigned timeout = 45; /* 45 second timeout */
unsigned msgnum = 10; /* plc message number 10 */
unsigned cc_type = 3; /* CC_WORD = 3; */
unsigned plc_type = 3; /* PLC_WORD = 3; */
unsigned items = 4; /* 4 words of data to be read */
int iostat; /* iostatus return value */
int rtn_val; /* function return value */
.
.
.
variable [0] = 1;
variable [1] = 9;
variable [2] = 9;
variable [3] = 2;
rtn_val = MSG_READ_W_HANDLER ( variable, sizeof (variable), msgnum, items,
timeout, cc_type, PLC_type, &iostat);
BASIC Example
The BASIC function code is 40.
DIM status : INTEGER
DIM iostat : INTEGER
DIM msgrbuf(5) : INTEGER
.
.
.
rem * MSG_READ_W_HANDLER - Set up handler to allow for a synchronous message
rem * read of msgrbuf. This function will wait for
rem * completion of the I/O before returning to the user.
rem * Size of buffer is 20 bytes, message number is 0,
rem * number of items to read is 5, the timeout value is
rem * 6 seconds, the coprocessor data type is integer,
rem * the plc data type is short and iostat gets the I/O
rem * completion code.
RUN AB_BAS (40,status,ADDR(msgrbuf(1)),20,0,5,6,5,3,ADDR(iostat))
.
.
.
References
MSG_WRITE_W_HANDLER();
Also see asynchronous functions
MSG_READ_HANDLER(); MSG_WRITE_HANDLER();
Przeglądanie stron 227
1 2 ... 223 224 225 226 227 228 229 230 231 232 233 ... 311 312

Komentarze do niniejszej Instrukcji

Brak uwag