Slow Pulse Generator (SPG) Tool

© 2013-2019 Kevan Hashemi, Open Source Instruments Inc.

You will find the Slow Pulse Generator (SPG) Tool in the Tools/More menu of LWDAQ. The Slow Pulse Generator creates a slow sequence of logic transitions on a LWDAQ device of some kind. In the configuration array, there is a hexadecimal LWDAQ command to turn something ON, and another to turn the same thing OFF. For example, if we have an Octal Data Receiver (A3027C) with Firmware Version 7, we can write hexadecimal command 0108 to the device and assert a TTL HI (logic 1, or 3.3 V) on its X2 output, which appears on a BNC socket on the front panel. When we write 0008, this same output goes LO (logic 0, or 0.0 V). Consult the table below for the X2 and X2 output functions for various devices and firmware version.


Figure: Slow Pulse Generator Panel

In order to get the control commands to the device, we must specify the IP address of the LWDAQ Driver, the driver socket to which the device is connected, and in some cases, when there is a multiplexer between the driver and the device, we specify the multiplexer socket number as well.

A single stimulus consists of a num_pulses pulses of logic HI, each pulse_length_s long, and each separated by pulse_separation_s. Thus the period of the pulses is the sum of the pulse length and the separations. The stimulus is repeated every stimulus_period_s. Thus we have each stimulus beginning with a pulse and ending with a waiting period before the next stimulus begins.

When we press Start, the Slow Pulse Generator waits until the user-specified start date and time, unless this time has already passed by, in which case the Slow Pulse Generator sets the start time to the current time and commences the first stimulus immediately. The Stop button sends the OFF command and stops the stimulus. The Reset command does the same thing as Stop, but in addition resets the pulse and stimulus counters to zero.

At each pulse ON and OFF, the Slow Pulse Generator writes one line to a log file. The log file is a Neuroarchiver event list in the following format. We set the log file with the Change button.

1409413842 0.0 "*" "ON, 30-Aug-2014 11:50:42"

The first number is the date and time in seconds since the start of 1970, which is the standard UNIX timestamp. Then there is an offset from the date and time, which is always zero, and a *, which means the event is not to do with any particular recoding channel. Of course, it could be that the event does have something to do with some particular channel, so we could list these channels in the channel_select parameter, available in the Configuration Panel. So we could be turning on a video camera that watches animals with devices 1, 3, and 8.

1409413842 0.0 "1 3 8" "ON, 30-Aug-2014 11:50:42"

In the Configuration Panel, which you get with the Config button, you will find additional parameters, such as the format string for the date and time parameter, and the on and off commands.

When we are trying out the tool, we may not be connected to the LWDAQ over the internet. We can disable the LWDAQ communication by un-checking the lwdaq_enabled button. Now we run the Slow Pulse Generator and it creates its log file. We can check that we can read in the log file with the Neuroarchiver. The log file indicates that the lwdaq is disabled.

1409413842 0.0 "*" "ON, 30-Aug-2014 11:50:42, LWDAQ DISABLED"

With the LWDAQ enabled, if there is any problem with the TCPIP connection to the LWDAQ Driver, error messages will appear in the Slow Pulse Generator text window, and these will also appear in the log file, in the event description.

1409414038 0.0 "*" "ON, Timeout waiting for sock13 connection to 129.64.37.78:90. "

When we see such an error, we should check our IP settings and cables. If we experience a network disruption some time we are away from our experiment, there will be multiple error messages in the window, and in the log file, marking the resumption of network communications, an entire stimulus will be recorded in the log file in one or two seconds, regardless of our specified pulse lengths and separations. This compression of pulses is a consequence of the way that the Slow Pulse Generator decides when to provoke a change of state.

The Slow Pulse Generator does not check to see if we have connected the correct device to the LWDAQ Driver. It simply sends commands to the sockets we have specified.

Here is a table of commands and devices that we might use to generate pulses. The commands are in hexadecimal.

DeviceFirmwareCommand
(hex)
Effect
A3027A60104X1 = 3.3 V
A3027A60004X1 = 0.0 V
A3027A60108X2 = 3.3 V
A3027A60008X2 = 0.0 V
A3027A70104X1 = 25-Hz 0-3.3 V Pulses
A3027A70004X1 = 0.0 V
A3027A70108X2 = 3.3 V
A3027A70008X2 = 0.0 V
A3027E130104X2 = 3.3 V
A3027E130004X2 = 0.0 V
A2057V-008FOUT1=OUT2=OUT3=OUT4=0.0V
A2057V-0080OUT1=OUT2=OUT3=OUT4=HiZ
A3025A-6080Both LED Arrays On
A3025A-0080Both LED Arrays Off
Table: Effect of Commands on Various Boards Compatible with the Slow Pulse Generator

You can determine the commands for specific combinations of outputs by looking at the command bit allocation in the manuals or circuit diagrams for these devices.

If you want to run multiple instances of the Slow Pulse Generator, copy the SPG.tcl file in the Tools/More directory. Rename it SPG_2.tcl. Open it with a text editor and replace every occurance of SPG with SPG_2. Save to disk, start LWDAQ, and you should now have SPG and SPG_2 in your Tools/More menu. You can continue making copies as many times as you like.