Msg_receive( ) built-in function, Syntax, Example – Echelon Neuron C User Manual

Page 134: Msg_send( ) built-in function

Advertising
background image

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);

Advertising