w w w . u q d e v i c e s . c o m
L o g i c 1 6 U s e r M a n u a l
| 36
Simple C# Demo Source Code
The demo source code is a very simple C# project that shows the basic usage of the time tag
interface. The project file is “SimpleTimetagDemo.sln”. It can be opened with Microsoft Visual
Studio 2010. The “Express” version of Visual Studio will also work.
This simple program fragment shows how to use the interface:
ttInterface =
new
TTInterface
();
//Create object
ttInterface.Open(1);
//Open device No 1
ttInterface.Calibrate();
ttInterface.StartTimetags();
//Start measurement
byte
[] channels;
long
[] times;
int
count
=
ttInterface.ReadTags(channels, times);
ttInterface.StopTimetags();
ttInterface.Close();
On error conditions, an exception of type
TimeTag.UsbException
is thrown.
Python
In Python, the .NET functions are accessible using the Pythonnet package.
UQD_Logic_Python_Frequency_Analzyer.py is a simple example that shows how to use the UQD
logic, both in Logic counting mode, as well as time-tagging mode.
Note: For speed and performance consider using other platforms such as C# or VB.
To access the ttInterface.dll file in python, include the following into your code. Modify the file
path as necessary.
import time
import sys
#please change paths to the location of ttInterface.dll
sys.path.append("C:\\Users\\Work\\Documents\\UQD\\TTexplorers\\TT
Explorer_2_28_32bit")
import clr
clr.AddReference("C:\\Users\\Work\\Documents\\UQD\\TTexplorers\\T
TExplorer_2_28_32bit\\ttInterface")
from System import Array, Byte, Int16, Int32, Int64, UInt32, UInt16
from TimeTag import TTInterface, Logic, UsbException