User Tools

Site Tools

한국어

moacon:startcomxevent:index

startComxEvent

void startCom0Event ( )
void startCom1Event ( )
void startCom2Event ( )

This event occurs when data exists in the corresponding serial channel's receive buffer.

If the receive buffer is not emptied, the event will continue to occur. Use the comGet or comGets functions to remove data from the receive buffer, or comFlush to empty the receive buffer.

The receive buffer events are processed on a timer every 1ms, so the receive buffer may contain more data than was used to trigger the event. In the event handler, it is therefore recommended to use the comLen function to determine the amount of data and process all data in the receive buffer.

#include "moacon500.h"
void cmain(void)
{
 openCom(0,115200,C8N1);      // channel 0 open
 startCom0Event();            // start channel 0 recive event.
 while(1) { } 
}
 
void com0Event(void)          // Come here when got some data in channel 0
{
 while (comLen(0)>0)          // output all in the channel 0
 comPut(0,comGet(0));
} 

go MOACON home

moacon/startcomxevent/index.txt · Last modified: 2016/04/14 11:07 (external edit)