VTI Instruments EX1629 User Manual page 88

48-channel strain gage instrument
Table of Contents

Advertisement

VTI Instruments Corp.
protected by design or through suitable inter-thread communication mechanisms (e.g., mutexes) to
guarantee consistency. Again, multi-threaded programming is beyond the scope of this manual,
but it is important to understand the fundamentals before the streaming data mechanism can be
used properly. For more information on this topic, we recommend reviewing a textbook on
operating systems (e.g., Operating System Concepts, by Silberschatz, Galvin, and Gagne or
Modern Operating Systems, by Tanenbaum) as well as the Windows SDK information available
online.
Host Computer
Basic Streaming Data Usage
When using the streaming data interface, via the vtex1629_enable_streaming_data function, the
user application provides a callback function. Internally, the instrument driver creates a thread and
then opens a socket for streaming data between the host computer and the instrument. The newly
constructed thread does a "blocking" read on the socket, which causes it to "sleep" (become idle)
until data arrives. When acquisition data arrives, the thread begins executing, receives the
acquisition data from the instrument, executes the user-provided callback function, passing in the
newly arrived data, and then returns to the "sleep" state. The callback function can do whatever is
necessary for the application: write the acquisition values to a file on disk, perform limit checking
on the acquisition values, update an application-specific data structure (e.g., FIFO) post the
acquisition data to a database or spreadsheet, etc. This behavior is illustrated in Figure 6-3, with
the reception of streaming data causing the user-provided callback function to be executed.
NOTE
Since the callback function executes asynchronously in the same process as the main application
thread, it is important that any data or data structures used by both threads are suitably protected to
guarantee consistency. As with any multi-thread application, care must be taken when using inter-
thread communication primitives (e.g., mutexes) to prevent deadlocks and livelocks. Similarly,
performing GUI operations (e.g., updating an on-screen graph) within the callback function needs
to be implemented carefully.
88
`
time
F
6-2: S
IGURE
TREAMING
EX1629
1
3
5
7
9
11
13
15
17
19
SHUNT
CAL
RES
PWR
HD
LAN
0
2
4
6
8
10
12
14
16
18
EX1629
time
D
N
E
ATA
ETWORK
XAMPLE
21
23
25
27
29
31
33
35
37
39
41
43
45
47
SHUNT
SHUNT
CAL
CAL
RES
RES
20
22
24
26
28
30
32
34
36
38
40
42
44
46
EX1629 Programming

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the EX1629 and is the answer not in the manual?

Table of Contents