The use of the wildcard character, '
*
', can make programming the host controller much easier. Be
careful when using wildcards, however, since they can generate a lot of traffic on the digital bus.
3.3. Using Acknowledgements
It is a good idea for the host program or control system to make sure that all connected Vortex devices
have acknowledgment mode enabled (see the
ACKMOD
command). When acknowledgment mode is on,
a Vortex device will send an acknowledgment for each command it receives. Proper use of
acknowledgments makes the host program more robust and makes supporting multiple hosts effortless.
The rest of this section describes how to use acknowledgments to achieve these goals.
As a convenient example, let us imagine a host program with a graphical user interface (GUI). The user
presses buttons on the GUI to enable or disable features of various linked Vortex devices. The buttons
on the GUI reflect the current status of the corresponding feature.
When the user presses a button on the GUI to enable or disable a feature, the host program should
send the corresponding command to the selected Vortex device. It may be tempting to update the
status of the GUI button at this point, but this can cause problems if there are transmission errors or if
there are multiple host controllers. The proper way to handle this is to only update the GUI controls
based on acknowledgments received from the Vortex device.
To implement this, organize your code so that the functions that send commands are totally separate
from the functions that receive responses from the Vortex devices. This also enables your host program
to support the presence of multiple host controllers. For example, consider the following sequence of
events.
1. Another host sends a command to a Vortex device.
2. The Vortex device responds with an acknowledgment that is broadcast to all of the other hosts.
3. Your host program receives the acknowledgment and updates the status of the corresponding
control.
The result of this programming model is that all hosts and linked Vortex devices will always be
synchronized.
For simple on/off features, your host program can make use of the toggle arguments to some
commands (e.g., '
SSEN2
'). By sending a toggle command when a button is pressed, and updating the
button based on acknowledgments, your host program will not have to keep track of the status of the
button.
In a similar fashion, many of the integer commands (such as gains) can be controlled by incrementing
or decrementing them by a specific amount. For example, the command '
GAINIT>1
' increments the
input gain on channel T by 1 dB. The acknowledgment for this command will return the actual value
that the gain was incremented to. Thus, to implement a volume control, your control program can send
a command to increment the gain by 1 dB when the "up" button is pressed and decrement the gain by
1 dB when the "down" button is pressed. The control can update its level indicator based on the
acknowledgment that is received.