Echelon I/O Model Reference for Smart Transceivers and Neu Manuel d'utilisateur Page 83

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 209
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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
}
Vue de la page 82
1 2 ... 78 79 80 81 82 83 84 85 86 87 88 ... 208 209

Commentaires sur ces manuels

Pas de commentaire