13.07.2015 Views

VCI - Virtual CAN Interface - Ixxat

VCI - Virtual CAN Interface - Ixxat

VCI - Virtual CAN Interface - Ixxat

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Accessing the busAfter a message monitor is opened, it must be initialized. This is done with thefunction linMonitorInitialize. The function expects the size of the receive buffer innumber of LIN messages and the threshold values for the receive event as the inputparameters.The memory reserved for the receive buffer comes from a limited system memorypool. The individual buffers of a message monitor should therefore not consist ofmore than approx. 2000 messages.The receive event of a monitor is triggered when the receive buffer contains atleast the number of messages defined in wRxThreshold.When the monitor is configured, it can be activated or deactivated with the functionlinMonitorActivate. The monitor is activated when the function is called withthe value TRUE in the parameter fEnable. When the function is called with thevalue FALSE in the parameter fEnable, the monitor is deactivated. In the defaultsetting, a message monitor is deactivated when opened.Messages are only received by the LIN controller when the message monitor isactive. In addition, the LIN controller must be started, otherwise no messagetransfer between the LIN bus and the monitor takes place.A message monitor is closed with the function linMonitorClose. The functionshould always be called when the monitor is no longer required.3.2.3.1 Reception of LIN messagesThe simplest way of reading received messages from the receive buffer is to callthe function linMonitorReadMessage. If there are no messages available in thereceive buffer, the function waits until a new message is received from the bus orthe waiting time defined in the parameter dwMsTimeout has expired.The function linMonitorPeekMessage reads the next message from the receivebuffer. Unlike linMonitorReadMessage, however, the function does not wait for anew message but returns immediately to the calling program with a correspondingerror code if no messages are available in the receive buffer.With the function linMonitorWaitRxEvent it is possible to wait for a new receivemessage, or for the occurrence of the receive event. The receive event is triggeredwhen the receive buffer contains at least the number of messages defined inwThreshold when linMonitorInitialize is called.The following code fragment shows one possible use of the functions linMonitorWaitRxEventand linMonitorReadMessage.34Copyright IXXAT Automation GmbH C-API Programming Manual, Version 1.5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!