Echelon I/O Model Reference for Smart Transceivers and Neu Bedienungsanleitung Seite 83

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 209
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 82
I/O Model Reference 73
Example
The following example shows how to use the io_in_ready and io_out_ready
events, in conjunction with the io_out_request( ) function, to handle parallel I/O
processing.
#define DATA_SIZE 255
struct parallel_io_interface {
unsigned int length; // length of data field
unsigned int data [DATA_SIZE]; // data field
} piofc;
IO_0 parallel slave slaveBus;
// ready to input data
when (io_in_ready(slaveBus)) {
piofc.length = DATA_SIZE; // number of bytes to read
io_in(slaveBus, &piofc); // get 10 bytes of incoming data
}
// ready to output data
when (io_out_ready(slaveBus)) {
piofc.length = 10; // number of bytes to write
io_out(slaveBus, &piofc); // output 10 bytes from buffer
}
// user defined event
when (...) {
io_out_request(slaveBus); // post the write request
}
Seitenansicht 82
1 2 ... 78 79 80 81 82 83 84 85 86 87 88 ... 208 209

Kommentare zu diesen Handbüchern

Keine Kommentare