Echelon Neuron C Manual do Utilizador Página 134

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 267
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 133
114 Functions
}
...
}
msg_receive( ) Built-in Function
The msg_receive( ) built-in function receives a message into the msg_in object.
The function returns TRUE if a new message is received, otherwise it returns
FALSE. If no message is pending at the head of the message queue, this function
does not wait for one. A program might need to use this function if it receives
more than one message in a single task, as in bypass mode. If there already is a
received message, the earlier one is discarded (that is, its buffer space is freed).
Note: Because this function defines a critical section boundary, it should never
be used in a when clause expression (that is, it
can
be used within a
task
, but
not
within the when
clause
itself). Using it in a when clause expression could result
in events being processed incorrectly.
The msg_receive( ) function receives all messages in raw form, so that the online,
offline, and wink special events cannot be used. If the program handles any of
these events, it should use the msg_arrives event, rather than the msg_receive( )
function.
See Chapter 6,
How Devices Communicate Using Application Messages,
in the
Neuron C Programmer's Guide
for more information about application messages.
Syntax
boolean
msg_receive (void);
Example
void f(void)
{
...
if (msg_receive()){
// Process message
...
msg_free();
}
...
}
msg_send( ) Built-in Function
The msg_send( ) built-in function sends a message using the msg_out object.
See Chapter 6,
How Devices Communicate Using Application Messages,
in the
Neuron C Programmer's Guide
for more information about application messages.
Syntax
void
msg_send (void);
Vista de página 133
1 2 ... 129 130 131 132 133 134 135 136 137 138 139 ... 266 267

Comentários a estes Manuais

Sem comentários