Portbase User Guide
void SendData(void);
void GetData(void);
//Creates the main function and calls the function.
main (int argc, char *argv[])
{
time_t tti;
struct tm *ttm;
int
gettime;
int
gettime2;
OpenSerial();
time(&tti);
ttm = localtime(&tti);
gettime = ttm->tm_sec;
gettime2 = ttm->tm_sec;
while(1){
time(&tti);
ttm = localtime(&tti);
gettime = ttm->tm_sec;// Obtains the present time.
if (gettime2 > gettime) gettime = g 60;
if ( gettime - gettime2 > 2) {// Calls the SendData() function every 3
second.
SendData();
gettime2
=
ttm->tm_sec;
}
GetData();
}
}
//Transmits a data packet to the opened socket by creating the data packet.
//Calls it in the main function every 3 seconds.
void SendData(void)
{
int
i;
char temp[30] = "This is LoopBack Data!”
// Outputs data to the ttys0.
write(porthandle, temp, sizeof(temp));
}
//Outputs received data on the screen.
void GetData(void)
{
int
i;
106
Содержание Portbase-3010
Страница 1: ......
Страница 61: ...Portbase User Guide 4 Click Next 5 Choose destination location and click Next 61 ...
Страница 90: ...Portbase User Guide Log Window 90 ...