Source Code Examples

The source code examples can be found in the "src" folder of the library directory tree. In addition, the source code of a program providing a command line interface (CLI) to tdcbase is stored in "cli". All those sources can be used, modified and retdistributed without restriction.

example0.c demonstrates the initialisation and basic configuration of the device and shows how to retrieve timestamps, coincidence counters, and start stop histograms.

example1.c deals with the configuration of the signal conditioning of 1b and 1c devices.

example2.c is dedicated to the HBT feature. It shows the configuration and how to retrieve and process the cross correlation and G(2) functions.

example3.c demonstrates the software compensation for different signal runtimes.

example4.c shows how to use file I/O functions and timestamp generation.

example5.c revisits the signal conditioning and deals with the start multistop histograms of the lifetime feature.

example6.c is a small performance test for data transfer and file output.

example7.c is an example for the handling of multiple devices.

tdccli.c contains the source code of the CLI program. It supports all features shown in the examples except the HBT and lifetime functions.

getopt.c (Windows only) is a windows port of the POSIX getopt functions by Todd C. Miller and the Net BSD foundation. It is used by the CLI program under the open source license found in README.getopt.txt. Many thanks!