Tscope5
serialport03.c
////////////////////////////////////////////////////////////////////////////////
//
// __ ______
// / /_______________ ____ ___ / ____/
// / __/ ___/ ___/ __ \/ __ \/ _ \ /___ )
// / /_(__ ) /__/ /_/ / /_/ / __/ ____/ /
// \__/____/\___/\____/ .___/\___/ /_____/
// /_/
//
// serialport03.c
// - Use the serial port for trigger output.
// - This example can be used together with serialport02.c
// (on another computer).
// - Serial port parameters have to be set by the user
// (see the function in config_serialport.c)
// - This example does not open a display
////////////////////////////////////////////////////////////////////////////////
#include <tscope5.h>
#include <stdio.h>
#include "config_serialport.c"
int main()
{
// set the log level to some high value
ts5_set_log_level(TS5_LOGLEVEL_4);
// register serialport COM1 as a trigger output device
// use /dev/ttys0 or something similar on Mac OS X and Linux
// this wil open the port, but it won't configure the port
int portnum = ts5_define_serialport_trigger_output("COM1");
TS5_SERIALPORT *portptr = ts5_get_serialport (portnum);
// use os specific functions to configure the serial port
config_serialport(portptr);
// send 10 triggers, one every second
int i;
double start = ts5_get_time();
for (i=0; i<10; i++) {
ts5_wait_until(start+(i+1));
}
return 0;
}