				TOUCH2
			      Version 1.8
	     A Communications Interface Application for the
	Lifescan One Touch(R) II Blood Glucose Monitoring System *

	Copyright (c) 1993, Victor A. Abell, West Lafayette, Indiana
			47907.  All rights reserved.


			    Victor A. Abell
			    1715 Summit Drive
			    West Lafayette, IN 47906
			    (317) 463-6865
			    abe@cc.purdue.edu

This is version 1.8 of an application that provides a communications
interface to the data port of the Lifescan One Touch(R) Blood Glucose
Monitoring System meter.  The application gives access to almost all the
features of the meter that can be manipulated via its data port -- excluded
is support for functions that would disable communications between the
application and the meter.  It provides limited data analysis -- an option
that includes maximum, mean, minimum and standard deviation for check
solution, check strip and normal readings, plus a line graph of the normal
readings.  It processes meter data in either measurement scale -- mg/dl or
mmol/l.


Application requirements
------------------------

An IBM compatible PC with: CGA Monitor (VGA required for graphing)
			   COM (serial) port
			   128K memory
			   DOS 5.0 or 6.0 **
A Lifescan One Touch(R) II meter
A Lifescan data port cable ***

**  The application has been tested under DOS 5.0 and 6.0, but it may work
    under earlier versions.

*** You can obtain a data cable from Lifescan by calling:

		U.S.A:	1 800 227-8862
		Canada:	1 800 663-5521

    Depending on the RS-232 connector leading from your PC's serial COM
    port, you may need a 9 pin (female) to 25 pin (male) adapter, since the
    Lifescan cable has a DB-25 female connector.  A DB-9 to DB-25 adapter is
    available from Radio Shack for about $5.


Documentation
-------------

The TOUCH2 application is driven by simple, character-based menus and is
intended to be self-explanatory.  Thus, there is no additional documenta-
tion except for the following section on customization.


Preparation
-----------

To use TOUCH2 the only preparation you must make is setting the data port
parameters of your meter.  Follow the instructions in your One TOUCH(R)
II manual, particularly the chart on pp. 58, 59 (in my manual, at least.)
You should set your meter to RS-232 mode and 9600 baud.


Customization
-------------

The TOUCH2 application will customize itself from default values, from
directives it finds in a configuration file, or from options on its call.
The default configuration file is TOUCH2.CF in the current directory, but
you may specify an alternate path to the configuration file in the TOUCH2
environment variable.

For example, if you want to use this feature, and you want to store the
configuration file in the root directory of your C: disk in the file
TOUCH2.CF, use the DOS command:

		SET TOUCH2=C:\TOUCH2.CF

You may want to put this in your AUTOEXEC.BAT file.  No particular name
is required for the configuration file; TOUCH2.CF is just an example.

If you always use TOUCH2 from the same directory, putting a TOUCH2.CF file in
that directory is sufficient.  Then you don't need to define the TOUCH2
environment variable.

After you have identified the configuration file, you must create it, using
your favorite text editor.  It must contain text lines of the form:

			<keyword>=<value>

Empty lines and lines that begin with a pound sign (`#') -- comments -- are
ignored.  Case is not significant.  Keywords and values may be specified in
upper, lower or mixed case.  There may be spaces around the equal sign
separator (`=') -- they will be ignored.  Spaces after <value> are assumed
to be part of it.

TOUCH2 recognizes the following configuration file keywords and their
shorthand forms.   It also recognizes any partial keyword that is unique --
e.g., "bau" for "baudrate", but not "ba", since both "baudrate" and
"background" begin with "ba".  The default values are used in the absence
of a configuration file specification.

	Keyword		Value		Significance
	-------		-----		------------

	aftergraph	<string>	Set the printer control string to be
					issued at the end of the graph print
					file to <string>.  Usually <string>
					contains a form feed ASCII character
					(Ctrl-L or ^L) and other codes needed
					to reset the printer to its default
					state.  If this string is not defined,
					TOUCH2 assigns it and the "beforegraph"
					strings to the values for the default
					printer type, EPSON.

					See the Graph Printing section for
						--------------
					more information.

					See the Defining Strings section for
						----------------
					information on how to build a string
					that defines characters.

					The "aftergraph" string may also be
					set with the "-a <string>" option on
					the TOUCH2 call line.

	ag				Shorthand for "aftergraph".

	bar		<string>	Define the character to be used on the
					printed graph for the bar line.

					The default is the IBM printer
					character with the hexadecimal value
					cd (a double horizontal line). 

					See the Defining Strings section for
						----------------
					information on how to build a string
					that defines a character.

					The "bar" character may also be set
					with the "-b <char>" option on the
					TOUCH2 call line.

	baudrate	300, 1200	Set the data port baud rate to one of
			2400 or 9600	these four values.  The default is
					9600.

	br				Shorthand for "baudrate"

	background	COLOR		Set the background color to the COLOR
					value.  The default is BLUE.

					See the Colors section for information
						------
					on color choices.

	bk				Shorthand for "background"

	beforegraph	<string>	Set the printer control string to be
					issued at the beginning of the graph
					print file to <string>.  Usually
					<string> contains printer control codes
					to define 8 lines/inch spacing.  If the
					"aftergraph" string is not defined,
					TOUCH2 assigns it and the "beforegraph"
					strings to the values for the default
					printer type, EPSON.

					See the Graph Printing section for
						--------------
					more information.

					See the Defining Strings section for
						----------------
					information on how to build a string
					that defines characters.

					The "beforegraph" string may also be
					set with the "-B <string>" option on
					the TOUCH2 call line.

	checksum	on or off	Turn dump record checksum verification
					on or off.  The default is on.

					See the Checksum Verification section
						---------------------
					for an explanation of checksums and
					checksum verification handling.

					The checksum verification mode may
					also be turned off with the "-C"
					option on the TOUCH2 call line.

	cksum				Shorthand for "checksum"

	comport		1 or 2		Set the serial communications port
					number to 1 or 2.  The default is 1.

	port				Shorthand for "comport"

	dump		<format>	Set the dump format to raw or
					QuattroPro.

					The raw dump format matches the meter
					dump format.  There is a header line,
					all values are dumped, and all values
					are enclosed in quotation marks.
					
					The QuattroPro dump format contains no
					header line and only date, time and
					meter reading values.  The values are
					separated by commas, but are not
					enclosed in quotation marks.

					The default dump format is raw, but the
					"-r" option on the TOUCH2 call may be
					used to deselect raw format and select
					QuattroPro.

	framesize	7 or 8		Set the data port frame size to 7 or 8.
					The default is 8.

	gmax		<number>	Set the y coordinate value of the
					maximum level line on the graph to
					<number>.  The maximum level line
					provides a visual reference for
					maximum acceptable glucose readings.

					The default is 110 mg/dl or 6.1 mmol/l.

					The maximum level value may also be
					set with the "-G <max>" option on
					the TOUCH2 call line.

	gmin		<number>	Set the y coordinate value of the
					minimum level line on the graph to
					<number>.  The minimum level line
					provides a visual reference for
					minimum acceptable glucose readings.

					The default is 70 mg/dl or 3.9 mmol/l.

					The minimum level value may also be
					set with the "-g <min>" option on
					the TOUCH2 call line.

	graphname	<path>		Set the default graph file path to
					<path>.  The default is TOUCH2.GRF.

	graphtitle	<title>		Set the graph title line to <title>.
					<title> may contain no more than 66
					characters.

					The graph title line may be set with
					the "-t <ttl>" option on the TOUCH2
					call line and with the Title option
					on the dump menu.

					The graph title line normally follows
					a page number in the graph output file.
					The page number may be suppressed using
					the "-P" option on the TOUCH2 call
					line, "pcd=off", or "pgctdisp=off".

	gttl				Shorthand for "graphtitle"

	intersection	<string>	Define the character to be used on the
					printed graph at the intersection of
					the bar and the maximum/minimum level
					lines.

					The default is the IBM printer
					character with the hexadecimal value
					d8 (a single vertical line intersecting
					a double horizontal line).

					See the Defining Strings section for
						----------------
					information on how to build a string
					that defines a character.

					The "intersection" character may also
					be set with the "-i <char>" option on
					the TOUCH2 call line.
	
	ic				Shorthand for "intersection"

	line		<string>	Define the character to be used on the
					displayed and printed graphs for the
					maximum/minimum level lines.

					The default is the IBM printer
					character with the hexadecimal value
					b3 (a single vertical line).

					See the Defining Strings section for
						----------------
					information on how to build a string
					that defines a character.

					The "line" character may also be set
					with the "-l <char>" option on the
					TOUCH2 call line.

	lpp		<number>	Set the number of lines per page on the
					printed graph to <number>.  The default
					is 81, assuming printing at 8 lines per
					inch.  The minimum is 11.

					See the Graph Printing section for more
						--------------
					information.

					The "lpp" value may also be set with
					the "-L <num>" option on the TOUCH2
					call line.

	parity		none, even	Set the data port parity to none, even
			or odd		or odd.  The default is none.

	pgctdisp	on or off	Set the display of the page count in
					the graph file output on or off.  The
					default is on.  The "-P" option on the
					TOUCH2 call line may also be used to
					turn off the display of the page count.

	pcd				Shorthand for "pgctdisp"

	qdumpname	<path>		Set the default QuattroPro format dump
					file path to <path>.  The default is
					TOUCH2.CSV.

	rdumpname	<path>		Set the default raw format dump file
					path to <path>.  The default is
					TOUCH2.DMP.

	startstop	1 or 2		Set the data port start and stop bit
					count to 1 or 2.  The default is 1.

	stst				Shorthand for "startstop"

	text		COLOR		Set the text color to COLOR.  The
					default is YELLOW.

					See the Colors section for information
						------
					on color choices.

	printer		<name>		Set the printer type to <name>.  The
					legal values are EPSON, PCL4 and PPDS.
					(Case is not significant.)

					Setting the printer sets default
					values for the "aftergraph" and
					"beforegraph" printer control strings.
					See the Graph Printing section for more
						--------------
					information.

					The "printer" name may also be set
					with the "-p <name>" option on the
					TOUCH2 call line.

	promptbk	COLOR		Set the text prompt background color
					to COLOR.  The default is RED.

					See the Colors section for information
						------
					on color choices.

					The prompt background color selection
					is ineffective when a graph is being
					displayed; the regular background color
					appears instead.  This is a limitation
					of VGA graphics mode.

	pbk				Shorthand for "promptbk"

	prompttext	COLOR		Set the prompt text color to COLOR.
					The default is BRIGHT WHITE.

					See the Colors section for information
						------
					on color choices.

	ptxt				Shorthand for "prompttext"

	warn		on or off	Enables (on) or disables (off) warnings
					about incompatible display modes when
					TOUCH2 begins execution.  The default
					is on.

					TOUCH2 works best when it can set the
					display mode to TEXTC80.  Other modes
					-- e.g., Hercules monochrome mode --
					may be adequate for some display
					operations, but may result in incorrect
					colors or other display variations.
					If TOUCH2 cannot put the display in
					TEXTC80 mode, it displays a warning
					screen when it begins execution.  This
					directive may be used to enable or
					disable the warning display.

					The display warning mode may also be
					disabled with the "-w" option on the
					TOUCH2 call line.


Colors
------

Color group 1 -- menu background, graph background, and text COLOR values
may be:

  BLACK   BLUE   GREEN   CYAN   RED   MAGENTA   BROWN   WHITE

Color group 2 -- graph background and text COLOR values may be:

  GRAY	          LIGHT BLUE    LIGHT GREEN   LIGHT CYAN   LIGHT RED
  LIGHT MAGENTA   LIGHT BROWN   BRIGHT WHITE

Case is not significant: any of the above COLOR values may be specified in
lower (or even mixed) case.  The space between LIGHT or BRIGHT and the color
word is optional -- e.g., BRIGHT WHITE and BRIGHTWHITE are equivalent.

If one of the colors from group 2 is specified as a menu or prompt background
color, TOUCH2 displays a warning screen, explaining that the color cannot be
used as a background for menus or prompts, and specifying how the color will
be converted to one from group 1 -- e.g., GRAY will be converted to BLACK,
LIGHT RED to RED, etc.  The menu background colors are limited to those
from group 1, because TOUCH2 uses the TEXTC80 video display mode.  That mode
allows 16 text colors, but only 8 background colors.

TOUCH2 may also display a warning screen if it cannot set the display mode
to TEXTC80 -- e.g., you have a Hercules monochrome adapter.  While some
display operations may be correct, others, such a color generation, will
not be.  Both warning screens may be disabled with the "warn=off" directive
or the "-w" option on the TOUCH2 call line.

TOUCH2 imposes another limitation on color choices when it draws a graph.
Since it uses the VRES16COLOR video mode to draw the graph, it cannot display
a separate background color for the prompt.  The regular background color
appears instead.  As slight compensation, the graph background color may be
chosen from either group 1 or 2.


Checksum Verification
---------------------

Data records dumped from the meter contain a checksum that TOUCH2 can
verify to insure that the records it has read match what the meter sent.
As TOUCH2 reads the data record header and each data record, it computes a
checksum from the characters of the record and compares it with the checksum
value in the record that was computed by the meter when it sent the record.

If you get checksum verification error messages, you should check both ends
of the cable that connects your meter to your computer.  A bad connection
might cause some data record characters to be transmitted in error.

A less likely cause is that your computer's communication port is not fast
enough to keep up with the meter speed you have chosen.  This is most apt
to happen if you are using the 9600 baud rate.  You can try reducing the
baud rate via the meter's Baud Rate Mode menu.  Once you have changed the
meter's baud rate, you must tell TOUCH2 about the change, using the
communications parameter change menu or the "baudrate" configuration file
directive.  (You can't use TOUCH2 to change the meter's baud rate, because
that would disable communications between TOUCH2 and the meter.)

Finally, it is possible that your meter or the special circuitry in the
meter cable is malfunctioning, or it is possible that TOUCH2 is not handling
checksums correctly.  Contact Lifescan if you suspect your meter or cable
is at fault; contact me if you think TOUCH2 is the villain.

When TOUCH2 encounters a checksum that can't be verified, it displays the
checksum it computed, the one it received, and the record for which
verification failed.  Subsequent processing depends on the source of the dump
and the key you press.

	*  If you press the ESCape key, the dump operation will be aborted.
	
	*  If a file is the source of the dump records, and if you press any
	   key other than the ESCape key, TOUCH2 will accept the unverified
	   record and continue the dump operation.

	*  If the meter is the source of the dump records, TOUCH2 will
	   discontinue the dump operation and erase whatever dump records it
	   has already stored when you press any key.  It has to take this
	   action because dump data coming from the meter will probably have
	   been lost while TOUCH2 was waiting for you to press a key.

Checksum verification may be disabled with the "-C" option on the TOUCH2
call line, or with the "checksum=off" and "cksum=off" configuration file
directives.


Configuration File Example
--------------------------

The following is a sample configuration file.  It sets the background color
to white; the text color to black; the prompt background to blue; the prompt
text to yellow; maximum (60 mg/dl) and minimum (150 mg/dl) level line values;
the graph title line to my name; and the default dump file name to C:\MYDUMP.

#
# Sample TOUCH2 configuration file
#
bk=WHITE
qdump=C:\MYQPDMP.CSV
text=black
prompttext=yellow
PbK = bLuE
gmin=60
gmax=150
gttl=Victor A. Abell

Note the use of the partial keyword "qdump", legitimate because no other
possible keyword begins with the same characters; the use of lower, upper
and mixed case; and the spaces around the equal sign.

Here is a sample configuration file for a monochrome, Zenith SuperSport
SX PC.  The color choices were selected to give the best contrast between
the prompt line and the text and graphics displays.

#
# Sample TOUCH2 configuration file for monochrome, Zenith SuperSport SX
#
bk=black
text=brightwhite
pbk=white
ptxt=brown


Saving and Reusing Dumps
------------------------

TOUCH2 will write a meter dump to a file in two formats, QuattroPro and
raw.  The default format is raw.

The QuattroPro format contains only meter readings -- no header line -- and
only date, time and meter reading values.  The values are separated by commas,
but are not enclosed in quotation marks.  The default QuattroPro dump file
path is TOUCH2.CSV.

The raw format contains a header line and all information provided by the
meter -- date, time, reading type, reading and checksum.  Values are
separated by commas and enclosed in quotation marks.  The raw format is the
only file input format that can be reused.  The default raw dump file path
is TOUCH2.DMP.

To write a dump file, select the Dump option from the main menu.  From the
file menu select the dump type with `Q'.  If you select the QuattroPro
format, you may then elect to include or exclude check and high readings.
Select the File option from the Dump menu.  (You may also want to specify
a file path different from the TOUCH2.CSV or TOUCH2.DMP defaults.)

To reuse a dump file, select the Dump option from the main menu and the
Read option from the Dump menu.  (You may also have to specify a file
path if the default of TOUCH2.DMP isn't acceptable.)  The file must be in
the raw format -- TOUCH2 won't read a dump file written in the QuattroPro
format.

You may switch from raw to QuattroPro format with the "-r" option on the
TOUCH2 call line.  You may use the "dump=<format>" configuration file
keyword and value to select either format.


Graph Printing
--------------

If you want to print a graph, select the TOUCH2 options that write a graph
to a file -- Dump from the main menu, Graph from the Dump menu and File from
the Graph menu.  Then copy the file to your printer -- e.g., to print a graph
written to the default graph file path, use the DOS command:

	COPY TOUCH2.GRF PRN

You may put a title line on each page of the graph.  The title line may have
no more than 66 characters and it may be defined with the "-t <ttl>" option
on the TOUCH2 call line, with the "graphtitle" or "gttl" configuration file
keyword and associated value, or via the Title option on the dump menu.  The
title line normally follows a page number in the graph output file.  You can
suppress the page number display with the "-P" option on the TOUCH2 call line,
or the configuration file directives "pgctdisp=off" and "pcd=off".

When a graph is written to a file, presumably for printing, TOUCH2 puts a
printer control string at the beginning and end of the file.  The beginning
string ("beforegraph") is supplied to condition the printer for the special
needs of the graph; the ending string ("aftergraph")  is supplied to reset
the printer to its previous state.

TOUCH2 will supply three predefined strings for the EPSON, PCL4 and PPDS
printer protocols.  See the Defining Strings section for information on
			    ----------------
interpreting the following values.

	Printer		String		Value

	EPSON		aftergraph	\f\e@
			beforegraph	\e0\et1\e7

					The "aftergraph" string issues a for
					feed and resets the printer.

					The "beforegraph" string sets 8 lines
					per inch spacing, and selects an IBM
					graphics character set.

	PCL4		aftergraph	\f\eE
			beforegraph	\e&l8D\e(10U\es0p10.00h12.00v0s0bT

					The "aftergraph" string issues a form
					feed and resets the printer.

					The "beforegraph" string sets 8 lines
					per inch spacing, selects the PC-8
					font and defines the parameters of the
					PC-8 font.

	PPDS		aftergraph	\f\e[K\1\0\6
			beforegraph	\e0

					The "aftergraph" string issues a form
					feed and resets the printer.

					The "beforegraph" string sets 8 lines
					per inch spacing.

If you don't want any special strings, set "aftergraph" to the empty string
-- e.g., put this line in your configuration file

	aftergraph=

or use this option on the TOUCH2 call

	-a^@

TOUCH2 expects to print the graph at 8 lines per inch on 11 paper.  Thus,
it sets its lines per page value to 81.  If you change the line spacing or
use different size paper, change the lines per page value with the "lines"
keyword or the "-L <num>" call line option.


Graph Characters
----------------

TOUCH2 writes a bar graph, containing horizontal bars and vertical lines for
the maximum and minimum level lines.  Normally TOUCH2 uses IBM graphics
characters for the bars and the lines.  It uses the double horizontal line
character (hexadecimal cd) for the bar, the single vertical line character
(hexadecimal b3) for the level lines, and a separate character (hexadecimal
d8) where the horizontal and vertical lines meet.  These three characters
may be redefined with the "bar", "line" and "intersection" strings, or with
the "-b <char>", "-i <char>" and "-l <char>" options on the TOUCH2 call.
See the Defining Strings section for more information on how to build a
	----------------
string that defines a character.  Here's an example that uses configuration
file keywords and values to set the bar character to `*', the line character
to `|' and the intersection character to `+':

	bar=*
	intersection=+
	line=|


Defining Strings
----------------

TOUCH2 uses strings in its configuration file and on its call to define
special characters.  Here are the rules it follows:

	*  Non-special characters are taken from a string until a `\' is
	   encountered.

	*  The `\' leads a special character definition.  It may be followed
	   by:

	   \		to define a `\' character

	   e or E	to define an ESCape (hexadecimal 1b)

	   f or F	to define a form feed (hexadecimal 0c)

	   n or N	to define a line feed (hexadecimal 0a)

	   r or R	to define a carriage return (hexadecimal 0d)

	   t or T	to define a TAB (hexadecimal 09)

	   ^		followed by any character in the set [@A-Z] to
			define an ASCII control character -- ^@ produces
			0; ^A, 1; etc.

	   0o		(zero, lower case "oh") followed by 3 octal digits
			to define an octal character value

	   0t		(zero, lower case "tee") followed by 3 decimal digits
			to define a decimal character value

	   hh		two hexadecimal characters that define a single
			character value

Here are some examples:

	\e0		defines a string with the two characters ESCape and
			zero.

	\0o0330		defines the same string -- ESCape and zero.

	\0t0270		defines the same string -- ESCape and zero.

	\e[K\1\0\6	defines a string with ESCape, left bracket, capital
			`K', hexadecimal 1, hexadecimal 0, and hexadecimal 6.

	\f\EE		defines a string with a form feed, an ESCape and a
			capital `E'.
	
	\@		defines a hexadecimal 0 value

These strings may be used as values after keywords in the configuration file
and on the TOUCH2 call.  When used on the TOUCH2 call you should be careful
to avoid using characters that have special meaning to your command
interpreter -- e.g., the vertical bar (`|').


The TOUCH2 Call
---------------

Some options that may be specified with configuration file keywords and
values may also be specified as options on the TOUCH2 call.  The option
indicator is the minus sign (`-') and the option keywords are single
characters.  When the same options are specified both ways, the call
line values apply.

Strings and characters are defined as described in the Defining Strings
						       ----------------
section.  The options include:

	-a <string>	<string> is a string defining the "aftergraph" printer
			control string.

	-b <char>	<char> is a string defining the printed graph bar
			character.

	-B <string>	<string> is a string defining the "beforegraph"
			printer control string.

	-c		selects the inclusion of check and high readings in
			a QuattroPro dump file.  The default is to exclude
			check readings.

	-C		turn off checksum verification

	-g <min>	sets the graph minimum level line value to <min>.
			The default is 70 mg/dl or 3.9 mmol/l.

	-G <max>	sets the graph maximum level line value to <max>.
			The default is 110 mg/dl or 6.1 mmol/l.

	-h		causes the display of "help" (usage) output.  No
			further processing takes place.  TOUCH2 also displays
			the "help" output and stops when it detects an error
			in its options or in the configuration file.

	-i <char>	<char> is a string that defines the printed graph
			intersection character.

	-l <char>	<char> is a string that defines the displayed and
			printed graph intersection character.

	-L <num>	<num> defines the number of lines on the printed graph
			page.  The default is 81.  The minimum is 11.

	-p <name>	<name> defines the printer type -- EPSON, PCL4 or
			PPDS.  The default is EPSON when the "aftergraph"
			printer control string is undefined.

	-P		turns off the display of the page number in the graph
			output file.

	-r		deselects a raw dump file format in favor of
			the QuattroPro dump format.

	-t <ttl>	sets the graph title line to <ttl>.

	-w		disables warnings about display mode.


Comments
--------

Please direct comments to me via e-mail -- abe@cc.purdue.edu.

Vic Abell
June 17, 1993
