Tscope5
parport02.c
////////////////////////////////////////////////////////////////////////////////
//
// __ ______
// / /_______________ ____ ___ / ____/
// / __/ ___/ ___/ __ \/ __ \/ _ \ /___ )
// / /_(__ ) /__/ /_/ / /_/ / __/ ____/ /
// \__/____/\___/\____/ .___/\___/ /_____/
// /_/
//
// parport02.c
// - Use the parallel port for trigger input.
// - This example can be used separately (use trigger simulation)
// or together with parport03.c (on another computer).
// - This example does not open a display
////////////////////////////////////////////////////////////////////////////////
#include <tscope5.h>
#include <stdio.h>
int main()
{
// set the log level to some high value
ts5_set_log_level(TS5_LOGLEVEL_4);
// register parallel port 1 as a trigger input device
// turn on trigger input simulation
// send value 255 to port 1 every 0.1 seconds
// comment this out if you want to receive real triggers
// from a computer that is connected via the serial port
// wait for 10 triggers
int trigger=0;
double trigtime, timing_error;
int i;
for (i=0; i<10; i++) {
trigger = ts5_wait_for_trigger(&trigtime, &timing_error);
printf("trigger %d %f %f\n", trigger, trigtime, timing_error);
}
// write (append) all triggers to a log file
ts5_write_all_triggers("parport_triggers.txt");
return 0;
}