

Patchit

Rev. 2.50


The Manual

Copyright 1995-1989.  George B. Grant, Somerville, MA  02144



Introduction:
	This manual describes the operation of the Patchit data 
acquisition program.  The current revision of this program 
is 2.50.  This software and manual are copyright 1995 
through 1989 by George B. Grant, Somerville, MA  02144.

Compatibilities:
	Patchit runs on IBM PC compatible computer systems.  It 
operates entirely in graphics mode.  As such, it requires a 
compatible graphics display adapter.  Patchit supports all 
major display adapters (Hercules, CGA, EGA, VGA) and has 
drivers for several other graphics display adapters 
including Super VGA. Patchit works with a Microsoft 
compatible mouse.
	Patchit is a data acquisition program.  It therefore 
requires a data acquisition card.  Patchit works with both 
the Tecmar Labmaster and Labmaster DMA data acquisition 
cards, in addition, Patchit should work with all cards in 
the Data Translation DT2821 family (except the DT2829), and 
in particular, has been thoroughly tested with both the 
DT2828 and DT2821 data acquisition cards. For configuring 
these boards, see the appendix at the end of this manual.  
As of this time, these are the only data acquisition 
adapters supported by Patchit.

Starting Up:
	Patchit runs entirely in graphics (not text) mode.  In 
order for it to run, a graphics driver for the graphics 
adapter that is installed in the computer must be available 
in the directory in which the Patchit executable file is.  
These drivers have the file extension ".bgi".  The drivers 
required for the following screen types are as follows:
	Display Adapter					Display Driver
	Hercules (Hercules Graphics Adapter)		herc.bgi
	CGA (Color Graphics Adapter)			cga.bgi
	EGA (Enhanced Graphics Adapter)			egavga.bgi
	VGA (Video Graphics Adapter)			egavga.bgi
	Super VGA						svga16m.bgi
	(Supports several common SVGA cards and the VESA 
standard SVGA interface)
	IBM 8514 Graphics Adapter			
	ibm8514.bgi
	AT&T 400-Line Graphics Adapter			att400.bgi
	3270 PC Graphics Adapter				pc3270

	By default, Patchit will automatically try to detect 
the proper graphics driver for the computer.  If the proper 
driver is not found by Patchit (in the same directory as the 
Patchit executable file) upon start up then the program will 
abruptly end and display an error message.  Otherwise the 
program will start and Patchit's main screen will appear.

The Screen:
	Patchit's main screen is divided into three areas.  The 
menu bar is on the top of the screen, it allows the user to 
access all of Patchit's commands.  The right-most portion of 
the menu bar shows the amount of free conventional (real 
mode) memory available for Patchit's use.  The lower part of 
the screen shows the status line.  This line displays 
information about the current status of the program (the 
amount of data sampled, the current parameter file and the 
last data file saved).  The data display area fills the 
screen between the menu bar and the status line.

Help:
	On-line help is available throughout Patchit.  Just 
type the F1 key and a relevant help message will pop up.  
The help file "Patchit.hlp" must be in the same directory as 
the Patchit executable file.

Accessing the Menus:
	The menu bar has a series of pull down menus.  A menu 
(e.g. "File") can be accessed in a number of ways.  1) A 
menu can be pulled down by clicking on the desired menu 
entry with the mouse.  2)  A menu can be pulled down by 
holding down the ALT key while the selection letter of the 
desired menu is typed (the selection letter is usually the 
first letter of the word and is shown underlined and in a 
different color from the rest of that word (unless the 
current graphics display only supports two colors, or the 
color configuration has been messed with)).  For example, to 
pull down the File menu, type ALT-F.  3)  A menu can be 
pulled down by first activating the menu bar with the F10 or 
"/" key.  The file menu will drop down, but not be selected.  
The selection letter of any of the main menu items can then 
be typed in order to access that particular menu.
	Certain functions on the individual menus can be 
accessed directly, without pulling down the menus, by typing 
a hot-key (the hot-keys are shown to the left of a menu 
entry, on its menu).  For instance, the F7 key will cause 
Patchit to read a parameter file if pressed when the menu 
bar is not activated.

Files:
	Patchit writes three types of files.  data files, 
parameter files and configuration files.  Data files contain 
recorded data and parameters that describe the data and how 
it was recorded.  Data files are only written by Patchit, 
they can be read by the Tack data analysis program.  
Parameter and configuration files contain all of the 
information describing the operation of Patchit.  Parameter 
files contain the parameters that describe how data will be 
acquired during a Sample session.  The parameters that go 
in a parameter file are all specified on the 
Sample:Parameters menu.  All other parameters are stored in 
the configuration file.  Patchit reads the configuration 
file (Patchit.cfg) contained in the current working 
directory at start-up.  If you need multiple configurations, 
you can either run Patchit from several different 
directories (each with its own Patchit.cfg file) or else 
rename patchit.cfg.


The Menus:

File Menu:
Read Parameters:  Selecting this option allows the user to 
load a new set of parameters into Patchit.  The parameter 
set determines how stimulus/i will be generated and how 
data will be recorded.  The parameters that are stored in 
this file are those that are indicated and controlled by 
the Sample:Parameters menu, below.  Parameters are stored 
in files called "parameter files".  If there are files in 
the current directory that match the selected filespec 
(default is "*.prm"), a selection box will appear listing 
the available files.  A parameter file may be cursor 
selected from this box (with the mouse or keyboard) or 
else the name of a parameter file may be typed in (do not 
type the ".prm" extension).  To change the current drive, 
directory, or filespec, just type that in, or else click 
the left mouse button in the upper window and type the 
pathname.  The list of parameter files will be updated 
for this new directory.

Write Parameters:  Selecting this option allows the user 
to store the current parameter set to a parameter file. 
The name of the parameter file should be typed without 
the extension ".prm" (this is automatically appended by 
the program).

Save Data File:  Selecting this option saves the latest 
set of data that has been recorded.  When the data is 
saved, a complete copy of the parameters used to record 
this data is also stored along with it.  You must use 
this option to save the data that you have just recorded.  
If you do not, then the data recorded by Patchit will be 
overwritten the next time you acquire data.  The only 
exception to this is if you have configured Patchit to 
record data directly to your disk (see below, 
Stim:Parameters:Number of Records/Record To Disk).

DOS Shell:  When this is selected the user temporarily 
exits to DOS to perform simple commands.  In order to 
allow this, Patchit "spawns" a copy of the DOS command 
interpreter.  Note that Patchit is still loaded in memory 
so there will be less DOS memory available to execute a 
command.  Type "EXIT" at the DOS command line ("C:\>") to 
return to Patchit.

About:  When this is selected another the user can find 
out about Patchit.
  Patchit:  Selecting this causes information about 
Patchit to appear.  This information is the current 
revision level, a copyright notice and information 
about its author (me!).
  Memory:  Selecting this causes information about the 
memory on your computer and Patchit's use of it to 
appear.  There are three types of memory used by 
Patchit.
  Conventional Memory:  This is the memory used by all 
DOS real mode programs, it is limited to a maximum of 
640 Kilobytes (KB).  Patchit will show you the total 
amount of conventional memory on your computer and 
the amount that is currently available.
  XMS Memory:  This is memory above the 1 Megabyte 
boundary that can be accessed by Patchit if an XMS 
driver (such as Microsoft's HIMEM.SYS) is loaded.  
XMS memory allows Patchit to store a great deal of 
data without filling up the DOS (conventional) memory 
area.  If XMS is available Patchit will store 
acquired data in it unless you have disabled this 
feature (see below, Config:Miscellaneous:XMS Data 
Storage).
  Disk Memory: This is the memory available on the 
disk.  Patchit shows the total disk space and the 
available amount on the current disk.
  Okay:  Selecting this closes this menu.

Quit Program:  Selecting this allows the user to exit 
Patchit.

Display Menu:
Erase Screen:  Selecting this causes all data display 
windows to be cleared.

Redraw Screen:  Selecting this causes any data that has 
been recorded by Patchit to be redisplayed in the data 
display windows.  Data recorded on channels that have not 
been enabled for display will not be displayed.  If you 
have recorded data directly to the disk (see above, 
Sample:Parameters:Number of Records/Record to Disk) then 
Patchit will not be able to refresh the screen.

Sample Menu:
Go:  Selecting this causes Patchit to begin acquiring 
data.  Stimuli will be generated on any enabled output 
channels and data will be acquired on any enabled input 
channels.  Simultaneously.  This process may be 
interrupted by hitting a key.

Continue:  Selecting this causes Patchit to begin 
acquiring data from the record at which it had been 
previously interrupted.  The user has the option of 
continuing from a record earlier than that at which data 
acquisition was previously interrupted.  That is, if you 
interrupted the data acquisition cycle after record #8 
because of a big glitch in the recording (due to a power 
line spike of course) you could continue recording at 
record #6, overwriting records 6 - 8 with new data.

Parameters:
Number of Records/Record to Disk:  Selecting this allows 
the user to specify the number of records that Patchit 
will record.  Patchit records data in blocks that are 
called "records".  A record can contain multiple 
channels of data.  The number of records is effectively 
limited by memory.  If you select a value and Patchit 
finds that there is insufficient memory on your 
computer, then Patchit will complain and reset the 
value.  If you need to record such large amounts of 
data, you should enable Record To Disk.
		When Record to Disk is enabled, Patchit will store each 
record as it is acquired to a disk file.  When you begin 
sampling data, Patchit will prompt you for the name of 
the file into which the data will be saved.  Prior to 
writing each record to this disk file, Patchit will 
check that there is sufficient disk space available.  
You will be warned if there is not.
Record Length:  Selecting this option allows the user to 
specify the length of a record (in milliseconds).  Each 
record is limited in size to a maximum of ~32000 points.  
The number of points is equal to ((the number of input 
channels) * (the length of the record)) / (the sampling 
rate).  The number of points in the record is shown 
here.  If you choose a value for the length of the 
record that exceeds the maximum number of points 
allowable, or the amount of memory available, Patchit 
will complain and reset the value.  You will need to 
choose a shorter record length, a greater sampling 
interval or fewer channels of input.
Sampling Int:  Selecting this option allows the user to 
specify the sampling interval at which Patchit will 
record data (in milliseconds).  This value plays a role 
in determining the size of the record and is limited 
(see Length of Record, above).  If you choose too small 
a value, Patchit will complain and reset the value.  If 
this happens, choose a larger value, decrease the record 
length or decrease the number of input channels.
Note:  Due to the design of certain data 
acquisition boards, under certain conditions 
Patchit may use a smaller sampling interval 
than you have selected.  This should not 
affect the size of the memory block described 
above, but the sampling interval could be 
smaller than the board could handle.  This 
could cause the program to lock up, a full 
computer reboot might then be necessary.  
Always test your parameter files before using 
them for critical recording sessions!
Inputs:  Selecting this option determines which channels 
of input will be used and displayed during a data 
acquisition cycle.  The items on this menu correspond to 
the available input channels (up to 16, depending on 
your data acquisition board).  During data acquisition, 
data will only be recorded on an input if it is enabled 
here.
Note:  Due to the design of certain data 
acquisition boards, under certain conditions 
Patchit may have to temporarily use more input 
channels than you have selected.  These 
unwanted channels will be stripped away once 
the data has been recorded, but can have two 
effects.  1) The amount of memory available 
for a data acquisition cycle may be reduced.  
2) The increased number of channels may cause 
the sampling interval used to be smaller than 
you have selected.  This sampling interval 
could be smaller than the board could handle.  
This could cause the program to lock up, a 
full computer reboot might then be necessary.  
Always test your parameter files before using 
them for critical recording sessions!
  x Input x:  Selecting this item allows the user to 
control the settings for this input.
  Recording:  Selecting this toggles the 
enabled/disabled state of this output.  Data will be 
recorded on an input during a data acquisition cycle 
only if it is enabled here.  Enabling/disabling an 
input will also automatically turn on display of 
this data - you can turn this off below.
  Display:  Selecting this toggles the 
enabled/disabled state for whether or not data on 
this channel will be displayed.  Data can only be 
displayed if this channel is enabled for input 
(obviously).
  Okay:  Selecting this causes any changes that you 
have made to the state of this input to be saved.
  Cancel:  Selecting this causes any changes that you 
have made to the state of this input to be 
discarded.
  Okay:  Selecting this causes any changes that you 
have made to the state of the inputs to be saved.
  Cancel:  Selecting this causes any changes that you 
have made to the state of the inputs to be discarded.
Output:  Selecting this option allows the user to 
determine which channels of output will be used during a 
data acquisition cycle and the default value that will 
be output by these channels at all other times. There 
are entries on this menu for all of the available analog 
output channels (2) and one binary output consisting of 
14 separate TTL outputs.  The exact number of outputs 
depends on your specific data acquisition board.  Note 
that an output will only be used during a data 
acquisition cycle if it is enabled here.  Specifying 
outputs waveforms is described on the 
Sample:Parameters:Stimulus menu, below.
  x Output x:  Selecting this option allows the user to 
enable or disable whether this analog output (D/A 
converter) channel will be used during a data 
acquisition cycle. and set the default output value 
for this channel.
  Recording:  Selecting this toggles the 
enabled/disabled state of this output.  This channel 
of ouput will only be used during a data acquisition 
cycle if it is enabled here.
  Default Value:  This allows the user to set the 
default value used for this analog output.  This 
value is specified in user units.  This value is 
output on this output at all times (except during 
data acquisition cycles, if the channel is enabled 
for output).  Note that values entered for the 
stimulus descriptors (see below, 
Sample:Parameters:Stimulus:D/A Channel X) are 
absolute values and are not relative to this holding 
potential.
  Okay:  Selecting this causes any changes that you 
have made to the state of this output to be saved.
  Cancel:  Selecting this causes any changes that you 
have made to the state of this output to be 
discarded.
  Binary Output:  Selecting this option allows the user 
to enable or disable whether the binary (TTL) output 
will be used during a data acquisition cycle and set 
the default output value for this channel.
  Recording:  Selecting this toggles the 
enabled/disabled state of this output.  This channel 
of output will only be used during a data 
acquisition cycle if it is enabled here.
  Default Value:  This allows the user to set the 
default state for the binary (TTL) output.  This 
value is expressed as a 14 bit hexadecimal value.  
Each bit in this hexadecimal value corresponds to 
the default logic state of the 14 binary output 
channels.  In most cases the default state of these 
outputs will be zero (0) unless you have a device 
whose trigger uses negative logic (i.e. a falling 
edge trigger).  The default value is output on the 
binary output port at all times (except during data 
acquisition cycles, if the channel is enabled for 
output).
  Okay:  Selecting this causes any changes that you 
have made to the state of this output to be saved.
  Cancel:  Selecting this causes any changes that you 
have made to the state of this output to be 
discarded.
  Okay:  Selecting this causes any changes that you 
have made to the state of the outputs to be saved.
  Cancel:  Selecting this causes any changes that you 
have made to the state of the outputs to be 
discarded.
Delay Time:  Selecting this option allows the user to 
specify the delay time (in seconds) between recording 
sessions.  This value is the amount of time the program 
waits between each record.  During data acquisition 
cycles, this value is counted down on the screen.  A 
value of 0 will NOT cause the records to be acquired 
immediately after each other.  There is a small amount 
of overhead time that Patchit requires between each data 
acquisition cycle.
Display Options:  Selecting this brings up a menu that 
allows you to specify how data will be displayed by 
Patchit.
  Real-Time Display:  Selecting this toggles the 
enabled/disabled state of this option.  If this is 
enabled, then data will be displayed as it is 
acquired.  Note that this is only implemented for the 
Tecmar Labmaster family of boards (not for the Data 
Translation DT2821 family, yet - sorry!).  NOTE that 
displaying data in real time takes a lot of time, so 
you may find that you get overrun errors if you 
have too high a sampling rate.  One way that might 
prevent this from happening is to not connect the 
points on the display (i.e., disable Connect the 
Points, below), since drawing lines takes longer than 
drawing points.  Alternatively, you can increase the 
sampling interval in order to give poor Patchit more 
time to draw.
  Show all pts in record:  If this is enabled then 
Patchit will display all of the data points for a 
given record on the screen.  That is, if there are 
more data points in a record than there are pixels 
(horizontally) in the data display area then Patchit 
will show multiple Y points for each X point.  If 
this is disabled then Patchit will only display one Y 
point for each X point.  Disabling this feature 
causes Patchit to draw faster.
  Connect the points:  If this is enabled then Patchit 
will connect the data points on the screen with 
lines.  This causes the display of data to look 
nicer, but significantly slows the display of data.
  Auto-Erase (Storage):  If this is enabled then the 
screen will automatically be cleared whenever data is 
acquired or whenever a new parameter file is loaded.  
If this is disabled, then the screen will only be 
cleared when you manually clear it (or whenever a 
parameter file is loaded).
  Okay:  Selecting this causes any changes you have 
made to the display options to be saved.
  Cancel:  Selecting this causes any changes you have 
made to the display options to be discarded.
Record Comments:  Selecting this toggles the state of 
this feature.  When this is enabled, you will be 
prompted for a comment when you save data to a disk 
file.  The comment can be of any length and is useful 
for recording pertinent facts about the data.
Stimulus:  Selecting this option allows the user to 
control the output stimulus waveform(s) during data 
acquisition.  Patchit controls two different types of 
outputs, analog (D/A) and binary (TTL).  The stimuli 
that can be generated on these channels are different 
and will be described separately.  Selecting one of the 
options on this menu allows the user to specify the 
output waveform for the selected channel.  If the output 
channel for which you wish to describe the waveform is 
not enabled, you will be warned.
		Output waveforms are described by events, these events 
can occur at any time during the data acquisition cycle.  
Existing events occurring on this output channel are 
listed in chronological order, in a box shown at the 
bottom of the screen.  Events may be added to, changed, 
or deleted from this list using the menu.  Events are 
described by event descriptors.  The event descriptors 
are different for analog and binary outputs.
x (D/A) Channel x:  This allows the user to configure 
the analog output waveform for this output channel.  If 
this channel is not enabled for output, you will be 
warned.  It can be turned on using Sample:Outputs:X 
Output X:Use Channel.  The event descriptor control 
menu has five items:
  Add Event:  This allows the user to add an event to 
the event list (and thus to the output waveform on 
this channel).  The event will be added to the list 
in its proper chronological order.
  Change Event:  This allows the user to change an 
existing event in the event list (and thus the 
output waveform on this channel).  The user will be 
prompted for which event to change.
  Both Add Event and Change Event bring up 
the event menu:
  Format:  An event can be either a step or a ramp.  
A step is an instantaneous (well, as good as the 
hardware can do) change in the output state at the 
given time.  A ramp causes the output to change 
state in a linear or ramp-like fashion starting at 
the given time.  The next two items on this menu 
differ depending upon the format for the event that 
is selected:
 For Step events the next two items are:
  Level:  The amplitude to which the output will be 
stepped at the time of the event.
  Incmt:  The increment by which the output 
amplitude will be changed during each occurrence 
of the event (note that the event may not occur 
during each record (see Event Occurs, below).
 For Ramp events the next two items are:
  Level, Starting:  The amplitude from which the 
ramp will start at the time of the event.
  M = Slope:  The slope (in user units/millisecond) 
of the ramp.
  Time:  The time (in milliseconds) at which the 
event is to occur.
  Delta T:  The increment (in milliseconds) by which 
the time of the event is shifted during each 
occurrence of the event (note that the event may 
not occur during each record (see Event Occurs, 
below).
  Event Occurs:  This allows you to specify when the 
event will occur from record to record.  The event 
can occur:
  Every Record,
  On a single record only
  For a range of records
  On Odd records only
  On Even records only
  Every nth record, from record
  Note that if this event has an increment parameter 
(either voltage or time) then that parameter will 
only increment each occurrence of the event.  e.g., 
if the event occurs on odd records only, then the 
parameter will only increment on odd records.
  Okay:  Selecting this causes any changes that have 
been made to this event to be saved.
  Cancel:  Selecting this causes any changes that 
have been made to this event to be discarded.
  Delete Event:  This allows the user to delete an 
event from the event list (and thus from the output 
waveform for this channel).  The user will be 
prompted for which event to delete.
  Erase All Events:  This allows the user to delete 
all events in the event list (and thus the output 
waveform for this channel).  If this channel is 
enabled for output and there are no events for it, 
then the output will be the default output amplitude 
(set by Outputs:x Output x:Default Value).
  Okay:  This exits the event descriptor control menu 
for this output channel.
Binary Output:  This allows the user to configure the 
output waveforms for the binary output.  If the binary 
output channel is not enabled for output, you will be 
warned.  It can be turned on using 
Sample:Outputs:Binary Output:Use Channel.  The event 
descriptor control menu has five items:
  Add Event:  This allows the user to add an event to 
the event list (and thus to the binary output 
waveform).  The event will be added to the list in 
its proper chronological order.
  Change Event:  This allows the user to change an 
event in the event list (and thus the binary output 
waveform).  The user will be prompted for which 
event to operate upon.
Both Add Event and Change Event bring up the event menu:
  Hex value:  This is the value in hexadecimal (up to 
3FFF) which is to be output on the binary port at 
the time of the event.  Each of the up to 14 TTL 
outputs are controlled by a bit from this value.  
To output the logic level "1" on binary channel 0, 
the value in hexadecimal is 1.  To output the logic 
level "1" on binary channel 1, the value in 
hexadecimal is 2. Oh, go look up hexadecimal 
numbers somewhere else.
  Time:  The time (in milliseconds) at which the 
event is to occur.
  Delta T:  The increment (in milliseconds) by which 
the time of the event is shifted during each 
occurrence of the event (note that the event may 
not occur during each record (see Event Occurs, 
below).
  Event Occurs:  This allows you to specify when the 
event will occur from record to record.  The event 
can occur:
  -  Every Record,
  -  On a single record only
  -  For a range of records
  -  On Odd records only
  -  On Even records only
  -  Every nth record, from record
Note that if this event has a Delta T parameter 
(time increment) then that parameter will only 
increment each occurrence of the event.  e.g., 
if the event occurs on odd records only, then 
the parameter will only increment on odd 
records.
  Okay:  Selecting this causes any changes that have 
been made to this event to be saved.
  Cancel:  Selecting this causes any changes that 
have been made to this event to be discarded.
  Delete Event:  This allows the user to delete an 
event from the event list and thus from the binary 
output waveform.  The user will be prompted for 
which event to delete.
  Erase All Events:  This allows the user to delete 
all events in the binary output's event list (and 
thus the binary output waveform).  If the binary 
output is enabled for output and there are no events 
for it, then each of the individual TTL outputs will 
be set to its default (TTL) value (this is set by 
Sample:Outputs:Binary Output:Default Outs).
  Okay:  This exits the event descriptor control menu 
for the binary output.
Okay:  This exits the Stimulus control menu.
Okay:  Selecting this causes any changes that you have 
made to the parameters to be saved.
Cancel:  Selecting this causes any changes that you have 
made to the parameters to be discarded.

Pulse Generator Menu:
Go:  Selecting this causes Patchit to begin acquiring data 
in "pulse generator" mode.  In this mode, stimulus will 
be generated on one enabled output channels and data will 
be acquired on one input channel.  Simultaneously.  This 
process may be interrupted by hitting the space bar or 
the ESC key.  The analog output for this function is 
constrained to a simple square pulse on the selected 
output channel.  The pulse width is set at one half of 
the length of the record (see below).  The pulse is 
preceded and anteceded by a time equal to one quarter of 
the length of the record (the pulse has a 50% duty 
cycle).  While the pulse generator is active, the menu 
bar displays the amplitude of the current pulse and the 
range of pulse voltages that can be selected with the 
function keys.  The initial amplitude of the pulse is 
+10.   This can be changed by using the function keys.  
Pressing any of the keys from F1 to F10 causes the 
amplitude of the pulse to be changed on the next pulse to 
a voltage from +10 to +100 (F1 = 10, F2 = 20, F3 = 
30...).  ALT, CTRL and SHIFT modify the range of voltages 
that can be selected with the function keys.  SHIFT-F1 
through SHIFT-F10 generate pulses from -10 to -100,  in -
10 increments.  ALT-F1 through ALT-F10 generate pulses 
from +50 to +500 in +50 increments.  CTRL-F1 through 
CTRL-F10 generate pulses from -50 to -500 in -50 
increments.  Typing the "0" (zero) key causes the pulse 
to have an amplitude of 0.

Parameters:
Record Length:  Selecting this option allows the user to 
specify the length of the record (in milliseconds) used 
for the pulse generator.  This is the duration of the 
each pulse generator cycle, the pulse width is one half 
of this duration.  Data recorded during the pulse 
generator cycle is stored in blocks known as records.  
Each record is limited in size to a maximum of ~32000 
points.  The number of points is equal to (the length of 
the record) / (the sampling rate).  If you choose a 
value for the length of a pulse generator cycle that 
exceeds the maximum number of points or amount of 
memory, Patchit will complain and reset this value.  You 
will need to choose a shorter event length or a greater 
sampling interval.
Sampling Int:  Selecting this option allows the user to 
specify the sampling interval (in milliseconds) at which 
data is recorded during a pulse generator cycle.  This 
value plays a role in determining the size of the memory 
block allocated and is limited (see Length of Record, 
above).  If you choose too small a value, Patchit will 
complain and reset the value, if this happens, choose a 
larger value or decrease the length of the pulse 
generator cycle.
Note:  Due to the design of certain data 
acquisition boards, under certain conditions 
Patchit may use a smaller sampling interval 
than you have selected.  This should not 
affect the size of the memory block described 
above, but the sampling interval could be 
smaller than the board could handle.  This 
could cause the program to lock up, a full 
computer reboot might then be necessary.  
Always test your parameter files before using 
them for critical recording sessions!
Input Channel:  Selecting this option allows the user to 
specify the channel that will be used for input during a 
pulse generator cycle.  It is on this channel that 
analog data from an experimental preparation will be 
acquired and displayed.
Note:  Due to the design of certain data 
acquisition boards, under certain conditions 
Patchit may have to temporarily use more input 
channels than you have selected.  These 
unwanted channels will be stripped away once 
the data has been recorded, but can have two 
effects.  1) The amount of memory available 
for a pulse generator cycle may be reduced.  
2) The increased number of channels may cause 
the sampling interval used to be smaller than 
you have selected.  This sampling interval 
could be smaller than the board could handle.  
This could cause the program to lock up, a 
full computer reboot might then be necessary.  
Always test your parameter files before using 
them for critical recording sessions!
Output Channel:  Selecting this option allows the user to 
specify the channel that will be used for output during 
a pulse generator cycle.  It is on this channel that the 
voltage pulse will be generated when Pulse Generator:Go 
is selected.
Delay Time:  Selecting this option allows the user to 
specify the delay time (in seconds) between pulse 
generator cycles.  This value is the amount of time the 
program waits between each cycle.  A value of 0 here 
will NOT cause the records to be acquired immediately 
after each other.  There is a small amount of overhead 
time that Patchit requires between each pulse generator 
cycle.
Display Options:  Selecting this brings up a menu that 
allows you to specify how data will be displayed by 
Patchit during pulse generator cycles.
  Real-Time Display:  Selecting this toggles the 
enabled/disabled state of this option.  If this is 
enabled, then data will be displayed as it is 
acquired.  Note that this is only implemented for the 
Tecmar Labmaster family of boards (not for the Data 
Translation DT2821 family, yet - sorry!).  NOTE that 
displaying data in real time takes a lot of time, so 
you may find that you get overrun errors if you 
have too high a sampling rate.  One way that might 
prevent this from happening is to not connect the 
points on the display (i.e., disable Connect the 
Points, below), since drawing lines takes longer than 
drawing points.  Alternatively, you can increase the 
sampling interval in order to give poor Patchit more 
time to draw.
  Show all pts in record:  If this is enabled then 
Patchit will display all of the data points for a 
given record on the screen.  That is, if there are 
more data points in a record than there are pixels 
(horizontally) in the data display area then Patchit 
will show multiple Y points for each X point.  If 
this is disabled then Patchit will only display one Y 
point for each X point.  Disabling this feature 
causes Patchit to draw faster.
  Connect the points:  If this is enabled then Patchit 
will connect the data points on the screen with 
lines.  This causes the display of data to look 
nicer, but significantly slows the display of data.
  Auto-Erase (Storage):  If this is enabled then the 
screen will automatically be cleared between each 
pulse generator pulse (data acquisition cycle).  If 
this is disabled then the screen will not be cleared 
until you manually clear it with the F5 key.
  Okay:  Selecting this causes any changes you have 
made to the display options to be saved.
  Cancel:  Selecting this causes any changes you have 
made to the display options to be discarded.
Okay:  Selecting this causes any changes that you have 
made to the parameters to be saved.
Cancel:  Selecting this causes any changes that you have 
made to the parameters to be discarded.

Config Menu:
Hardware Config:  Selecting this option allows the user to 
specify the type of data acquisition board in use and its 
configuration.  When this option is selected a menu 
appears and the user can select among the data 
acquisition boards that Patchit supports.  At present 
there are two families of boards that are supported, the 
Data Translation DT2821 series and the Tecmar Labmaster 
series.  The user also has the option of selecting "No 
Board", this allows you to try out Patchit on a computer 
that has no data acquisition board installed.  When one 
of these board families is selected, another menu appears 
from which the user can select the specific type of board 
that is installed the hardware settings of that board.  
These options are described further below:
  Family Member:  Selecting this option allows the user 
to specify the exact type of data acquisition board 
that is installed in the computer.  This selection 
allows Patchit to take advantage of the features of 
that specific board (i.e. number of input channels 
etc.).
  Base Address:  Selecting this option allows the user to 
specify the base address (in hexadecimal) of the data 
acquisition board that is installed.  It is imperative 
that this value match that on the board (see your 
board's manual).  If it is incorrectly set, Patchit 
will be unable to communicate with the board.
  DMA Channel(s):  Selecting this option allows the user 
to select the DMA channel(s) that the program and 
hardware will use.  Again, the value selected here must 
match the configuration of the board.
Note: At present the second DMA channel is NOT 
used by Patchit for the DT2821 series boards 
and DMA is not used at all for Tecmar 
Labmaster series boards (even the Labmaster 
DMA..., yes, I know, I know...).
  Interrupt:  Selecting this option allows the user to 
select the interrupt channel that the program and 
hardware will use.  This value should match the 
configuration of the board.
Note: This setting doesn't matter since 
Patchit doesn't use this interrupt presently.
  A/D Format:  (Labmaster Only) Selecting this option 
allows the user to specify the data format used by the 
data acquisition board for it's A/D converter.  This 
can be either Two's Complement or Binary.  This value 
must match the configuration of the board.  The default 
format for Patchit (and Tack) is two's complement.
  Trigger Src:  Selecting this option allows the user to 
specify whether Patchit will use an internal or an 
external trigger.  For internal trigger (the normal 
mode), Patchit will start its own data acquisition 
cycle.  In order for this to work properly on the 
DT2821 series boards the Binary Output 1, Channel 7 
must be connected to the External Trigger input.  For 
external trigger, a falling-edge TTL trigger will start 
the data acquisition cycle.  For a DT2821 series board, 
the trigger should be applied to the external trigger 
input.  For a Tecmar Labmaster the trigger pulse should 
be applied to the binary input port B, Bit 2 (B2).
  Okay:  Selecting this causes any changes that have been 
made to the configuration of the data acquisition board 
to be saved.
  Cancel:  Selecting this causes any changes that have 
been made to the configuration of the data acquisition 
board to be discarded.

Graphics Display:  Selecting this option allows the user 
to specify the type of graphics display installed and the 
display resolution that Patchit should use.  Normally, 
the graphics autodetect setting should be used.  For a 
given display type to be used, the requisite display 
driver file (they have the extension ".bgi") MUST be 
present in the same directory as Patchit.
  Display Type:  Selecting this option allows the user to 
select a graphics display type.  Twelve settings are 
available.
Note:  If your computer does not support the 
display type that you have selected, you may 
well crash the program when you try to switch 
display types.
  Resolution:  Selecting this option allows the user to 
select a display resolution for the selected display 
type.  Note that some display types have only one 
available resolution.
Note:  If your computer's display adapter does 
not support the resolution that you have 
selected, you may well crash the program when 
you try to switch display resolutions.
  Okay:  Selecting this option causes any changes that 
have been made to the graphics display type and 
resolution to go into effect.
  Cancel:  Selecting this option causes any changes that 
have been made to the graphics display type and 
resolution to be canceled.

Outputs Menu:
This menu controls aspects of the channels of output 
available on your data acquisition board.
  x Output x:  This allows the user to control aspects of 
the selected analog output.  The name of the output 
will appear on this menu.
  Name:  This allows the user to specify a useful name 
for this analog output channel.
  Units:  This allows the user to specify the units 
used for this analog output channel.
  Attenuation:  This option allows the user to set the 
attenuation factor for the analog output.  This value 
allows Patchit to correctly set it's analog outputs 
to the proper values which correspond to those needed 
at the external hardware (e.g. an amplifier).  The 
value entered here is the factor by which Patchit's 
output will be divided in order to compensate for any 
attenuation or amplification at the external 
hardware.  For the Dagan model 8900 amplifier which 
has a command potential input which can be scaled by 
-10:1 or -20:1, the value entered into Patchit would 
be -10 or -20 for these two scale factors, 
respectively.  Generally you should use the largest 
attenuation factor you can use in order to scale down 
any noise which might enter your amplifier riding on 
the command voltage.  In my case, using the -20:1 
attenuation factor yields an effective command 
voltage range at the amplifier of +/- 500 mV (for a 
board with D/A converters with a range of +/- 10 V, 
attenuated by a factor of 20).  This value is 
critical and MUST be properly set in order for 
Patchit to output accurate voltages.
  Okay:  This causes any changes that you have made to 
the state of this analog output to be saved.
  Cancel:  This causes any changes that you have made 
to the state of this analog output to be discarded.
  Okay:  Selecting this option causes any changes that 
have been made to the output configuration to go into 
effect.
  Cancel:  Selecting this option causes any changes that 
have been made to the output configuration to be 
canceled.

Inputs Menu:
This menu controls aspects of the channels of input 
available on your data acquisition board.
  x Input x:  This allows the user to control aspects of 
the selected input.  The name of the input will appear 
on this menu.
  Name:  This allows the user to specify a useful name 
for this input channel.
  Units:  This allows the user to specify the units 
used for this input channel.
  Gain:  This allows the user to set how Patchit will 
determine the gain for data on this channel.  Four 
options are available.
  Not Set in Patchit:  Selecting this indicates that 
the gain will not be set by Patchit for this data.  
If this gain option is set for this channel and data 
on this channel is saved to a file and then loaded 
into a data analysis program, the data analysis 
program will have to prompt you for the gain.  It is 
usually advantageous to set the gain in Patchit, 
using one of the other gain modes.
  Set Gain Right Now:  Selecting this causes Patchit 
to prompt you for the gain right now.  This gain 
mode is best suited for circumstances in which the 
gain on an input is not likely to vary often.
  Prompt for Later:  Selecting this causes Patchit to 
prompt you for the gain on this input channel when 
the data is saved to file.  This gain mode is best 
suited for circumstances in which the gain might 
change frequently.  Note that if you select this, 
you will still be prompted for the default gain on 
this channel so that Patchit can label its axes 
semi-appropriately.
  Read from Amplifier:  This causes Patchit to 
determine the gain for this channel by reading it 
from a telegraph on your amplifier.  This will only 
work if your amplifier has gain telegraphs (voltage 
outputs that correspond to the gain setting on the 
amplifier), and if the amplifier is supported by 
Patchit.  Note that it is extremely easy for me to 
add more amplifiers if you let me know the proper 
settings.  If you select this option you will be 
prompted for the type of amplifier that is connected 
to this input channel, and will be prompted for the 
input channel into which the gain telegraph is 
plugged.
  Filter:  This allows the user to set how Patchit will 
determine the filter setting for data on this 
channel.  Four options are available.
  Not Set in Patchit:  Selecting this indicates that 
the filter setting will not be set by Patchit for 
this data
  Set Filter Right Now:  Selecting this causes Patchit 
to prompt you for the filter setting right now.  
This filter mode is best suited for circumstances in 
which the filter setting on an input is not likely 
to vary often.
  Prompt for Later:  Selecting this causes Patchit to 
prompt you for the filter setting on this input 
channel when the data is saved to file.  This filter 
mode is best suited for circumstances in which the 
filter setting might change frequently.  Note that 
if you select this, you will still be prompted for 
the default filter setting on this channel.
  Read from Amplifier:  This causes Patchit to 
determine the filter setting for this channel by 
reading it from a telegraph on your amplifier.  This 
will only work if your amplifier has filter 
telegraphs (voltage outputs that correspond to the 
filter setting on the amplifier), and if the 
amplifier is supported by Patchit.  Note that it is 
extremely easy for me to add more amplifiers if you 
let me know the proper settings.  If you select this 
option you will be prompted for the type of amplifier 
that is connected to this input channel, and will be 
prompted for the input channel into which the filter 
telegraph is plugged.
  Invert:  Selecting this toggles the enabled/disabled 
state for whether or not data on this channel will be 
displayed inverted (upside-down).  This feature has 
been implemented for amplifiers (such as the Dagan 
8900) that have a signal that is inverted (i.e. 
upside-down) relative to the desired convention for 
that signal.  If a channel of data is configured to 
be displayed inverted, then ONLY the display of this 
data will be inverted.  The raw data is recorded as 
it is sampled from the analog signal.  If you need to 
invert a channel for display, then the gain at which 
this data was recorded should be given a negative 
value.
  Scale Factor:  Selecting this causes Patchit to 
prompt you for a value by which to scale (multiply) 
the displayed data.  This setting affects only the 
display of the data, the raw data is unaffected.  
Inverting the display of a channel could also be done 
here by setting this value to -1, but setting invert 
(above) would cause the display to be faster.
  Offset:  Selecting this causes Patchit to prompt you 
for a value by which to offset vertically the 
displayed data.  This value is in the range +1.0 to -
1.0.  +1.0 causes the data to be drawn offset upward 
by half the display height, -1.0 causes the data to 
be drawn offset downward by half the display height, 
and 0.0 causes the data to be drawn as it is 
recorded.  Intermediate values cause intermediate 
offsets.  This value affects only the display of the 
data, the raw data is unaffected.
  Okay:  This causes any changes that you have made to 
the configuration of this input to be saved.
  Cancel:  This causes any changes that you have made 
to the configuration of this input to be discarded.
  Okay:  Selecting this option causes any changes that 
have been made to the input configuration to go into 
effect.
  Cancel:  Selecting this option causes any changes that 
have been made to the input configuration to be 
canceled.

Colors:  When this option is selected a color 
demonstration window appears and a menu appears from 
which the user can select the colors of the various 
components of the Patchit screen.  The various components 
are the menu bar, status line, popup boxes and data 
window.  For menus, the user can control the background, 
text, frame and select letter colors.  For the status 
line, the user can control the background and text 
colors.  For popup boxes, the user can control the 
background, text and frame colors.  For the data window, 
the user can control the background, frame and axis 
colors as well as the colors for all available channels 
of data.
Menus:
Status Line:
Popup Boxes:
Data Window:  
	When the user selects one of these menu options, another 
menu appears from which the user can select the color 
for the elements of the windows (i.e. frame color of 
popup window).  Clicking on an element will select the 
next available color for that element, this will be 
shown in the color demonstration window.  Typing the 
select letter of that element will do the same.  Holding 
the SHIFT key down while typing the select letter of 
that element will select the previous color for that 
element.  Select Okay when you are done setting the 
colors.
Use Defaults:  When this option is selected, the colors 
of all of the elements of the Patchit display revert to 
their default settings.
Okay:  Selecting this option causes any changes that have 
been made to the color scheme to go into effect.
Cancel:  Selecting this option causes any changes that 
have been made to the color scheme to be canceled.

Font:  Selecting this option allows the user to specify 
the font that will be used by Patchit.  For all but the 
default font, the requisite font file (they have the 
extension ".chr") MUST be present in the same directory 
as Patchit.  An example of some text written in the 
selected font is displayed.
  Font:  Selecting this option allows the user to select 
the font family that will be used by Patchit.  Eleven 
font families are available.  The default font is a 
bit-mapped font, the others are stroked (outline) 
fonts.
  Height:  Selecting this option allows the user to set 
the height of the font that will be used by Patchit.  
If the selected font family is the default, bit-mapped 
font, the height and the width must be the same.
  Width:  Selecting this option allows the user to set 
the width of the font that will be used by Patchit.  If 
the selected font family is the default, bit-mapped 
font, the height and the width must be the same.
  Okay:  Selecting this option causes any changes that 
have been made to the font to go into effect.
  Cancel:  Selecting this option causes any changes that 
have been made to the font to be canceled.

Sounds:  Selecting this option allows the user to control 
aspects of the sounds that Patchit generates during its 
operation.  These are described below:
  Sounds:  Selecting this option toggles the state of 
whether Patchit will generate sounds.  When this is 
disabled Patchit will make no noise.
  Type:  Selecting this option allows the user to select 
the type of sound generation that Patchit will use, 
these are:
  Single Tone:  Patchit will always generate a tone of 
the specified frequency and duration (see below) for 
each data acquisition cycle.
  Rising Scale:  When the first record is acquired, 
Patchit will generate a tone of the specified 
frequency and duration.  For the next and each 
succeeding record, the tone generated will be of a 
successively higher frequency.
  From A/D:  Patchit will generate a tone for each 
record based on the value of a portion of the data.  
When this is option is selected the user is prompted 
for the channel of data from which to record the 
value and is then prompted for a value from 0 to 1.  
This value tells Patchit from where in the record (0 
is beginning, 1 is end) to read the value of the data 
on which to base the sound.
  Frequency:  Selecting this option allows the user to 
specify the frequency (in Hz.) of the tone.  If the 
sound type is "Single Tone", this is the frequency of 
that tone.  If the sound type is "Rising Scale", this 
is the frequency generated for the first record.  If 
the sound type is "From A/D", this is the frequency of 
the lowest A/D value, for this sound type, the user is 
also prompted for a frequency corresponding to the 
highest A/D value.
  Duration:  When this option is selected the user is 
prompted for the duration (in msec) of the tone.
  Test:  When this option is selected, Patchit 
demonstrates the tones that will be generated during 
given the currently selected options.  If the tone type 
is "From A/D", the demonstration plays the high and low 
frequency values over and over.
  Okay:  When this option is selected, you leave the 
sounds menu.

Miscellaneous:  Selecting this option allows the user to 
control several very important aspects of Patchit's 
operation.  These are described below:
  XMS Data Storage:  Enabling this feature allows Patchit 
to use memory accessed via the XMS specification in 
order to store data acquired before writing it to disk.  
XMS memory is memory above the 1 MB boundary on PC-AT 
class computers (80286 and above class 
microprocessors).  This memory can only be accessed if 
you have installed the XMS driver HIMEM.SYS (supplied 
free of charge by Microsoft), or a compatible XMS 
driver (e.g. Desqview's QEMM memory manager) in your 
config.sys file.  The use of XMS allows Patchit to 
store data above the conventional memory area, which 
allows more room for Patchit to work.  This feature 
need not be disabled unless you suspect a problem or 
else have other needs.
  Time Correction: This enables/disables a feature that 
causes Patchit to correct for time lost during data 
acquisition cycles.  During data acquisition cycles, 
Patchit disables system interrupts, which stops the 
system clock from being updated.  As a result of this, 
the system time will slip.  If Time Correction is 
enabled, then Patchit will correct for this time 
slippage.  NOTE that when Patchit was run under OS/2 I 
ran into problems with this feature (data file time 
stamps got set wrong).  So, that is why this feature 
can be enabled/disabled.  So, check it out carefully if 
you are running under a multitasking environment (but I 
have had no probs under Win 3.1).
  Startup Prm File:  Selecting this option allows the 
user to specify the name of a parameter file to load 
whenever Patchit is started.  This feature allows the 
user to load a customized parameter set at startup.  If 
this file is not available at startup, Patchit will use 
a default set which may not be correct for your 
experimental configuration! (in particular the Output 
Scaling will almost certainly be wrong).
  Okay:  Selecting this causes any changes that have been 
made to the items on this menu to be saved.
  Cancel:  Selecting this causes any changes that have 
been made to the items on this menu to be discarded.

Write Config File:  Selecting this option causes the 
current configuration data to be written to the 
Patchit.cfg configuration file.  All items that are 
controlled on the config menu are stored in this file as 
are all pulse generator parameters.


Conclusion
	I hope that you understand all of the features that I 
have described here and that Patchit serves you well.  I 
would appreciate your comments on the program and manual.  
I always want to know about bugs in my program and will 
endeavor to fix them as speedily as is possible.  I also 
would value your suggestions for new features and ways to 
improve this program.  I try to thoroughly test all 
features and be sure that everything works properly, but I 
am not responsible for any loss of data or damage caused 
by this program.  I can be reached at the following 
addresses:

	George B. Grant
	38 Banks St. #2
	Somerville, MA  02144

	ggrant@husc.harvard.edu		(e-mail)
	george@mander.berkeley.edu		(e-mail)
	72722,3152				(CompuServe address)



Appendix:	
Hardware Configuration:
Data Translation DT2821 Family Boards:
Analog Outputs:  Patchit uses both Analog Outputs 
on the DT2821.
Analog Inputs:  Patchit uses all analog inputs on 
the DT2821.  Note the weird channel sequence used 
for DT2821 family boards with less than 16 inputs!
Binary Outputs:  Patchit uses the two Binary Output 
ports on the DT2821 for binary (TTL) trigger 
outputs.  Two of these are put to special use by 
Patchit.  Binary Output Port 1, Channel (bit) 7 
and Binary Output Port 1, Channel (bit) 6, go to 
logic low and logic high, respectively, at the 
beginning of a record and return to logic high and 
logic low, respectively, at the end of a record.  
These are useful for triggering oscilloscopes.
Triggering:  If you do not need an external 
trigger, you should connect the DT2821's external 
trigger input to Binary Output Port 1, Channel 
(bit) 7.  This will allow Patchit to operate 
properly.  If you plan to use an external trigger, 
it should be connected to the external trigger 
input (instead of Binary Output Port 1, Channel 
7).  In order to use an external trigger, you must 
enable it in Patchit (see: Config:Hardware 
Config:Data Translation DT2821:Trigger Src.

Tecmar Labmaster Family Boards:
General:  The following connections must be made 
for Patchit to operate properly:
Source5-Out5-Start Convert
Gate5-Out4
Analog Outputs:  Patchit uses both Analog Outputs 
on the Tecmar Labmaster.
Analog Inputs:  Patchit uses all analog inputs on 
the Tecmar Labmaster.
Binary Outputs:  Patchit uses two of the Parallel 
I/O ports on the Tecmar Labmaster for binary (TTL) 
trigger outputs.  These are Ports C and A.  
Patchit numbers these binary outputs from 0 to 15.  
Patchit outputs 0-7 correspond to Port A, bits 0-7 
and Patchit outputs 8-15 correspond to Port C, 
bits 0-7.  Two of these binary outputs are put to 
special use by Patchit.  Outputs 15 and 14 (C7 and 
C6) go to logic low and logic high, respectively,  
at the beginning of a record and return to logic 
high and low, respectively, at the end of a 
record.  These are useful for triggering 
oscilloscopes.
Note: If you have a Labmaster DMA, ports A and C 
come configured as inputs (except Port C, bits 4-
7).  If you want to use all sixteen binary outputs 
that Patchit offers, you will need to change a 
setting on the Labmaster DMA motherboard (if you 
choose not to do this, you will be limited to four 
binary outputs, 15-12).  The change that you need 
to make to the Labmaster DMA motherboard is to 
reconfigure the rest of ports A and C for outputs 
(this change will NOT affect pClamp).  Reseat 
chips USS1, USS2 and USS4 so that they are 
inserted in rows 2 and 4 (in the same orientation 
as chip USS3).  Refer to your Labmaster DMA manual 
for this.
Triggering:  An external trigger pulse should be 
applied to the binary input port B, Bit 2 (B2).  A 
rising edge trigger is expected (i.e., going from 
logic low to logic high).  In order to use an 
external trigger, you must enable it in Patchit 
(see: Config:Hardware Config:Tecmar 
Labmaster:Trigger Src).
