                   Audiometer Panel Control Program
                          04/10/97 -med



Overview:

The audiometer panel control program is a simple PC based program 
to control the Fonix Digital Audiometer through the RS232 port. 
It is provided as an example of the control that is available and 
to provide a programming example for those wishing to write their 
own control programs.

The Audiometer control panel program requires that the FRYERS 
driver be loaded in the computer first since it uses FIPP 
commands to control the audiometer. For detailed descriptions of 
the RS232 commands, please refer to the Audiometer FIPP command 
reference provided in a separate document.

The audiometer is controlled through the RS232 port by sending a 
control packet (Set Control Panel Registers) command with the 
Computer control bits turned on. It is possible to control only 
one side of the audiometer by enabling a single control bit, but 
keep in mind that there may be conflicts with shared functions 
such as Pulse and Warble. 

This document does not describe the basic operation of the Fryers 
FIPP protocol. Refer to the Fryers documentation for a full 
description of the operation of the protocol and the Fryers 
driver.


Operation:

To use the Audiometer control program, you will need an IBM AT 
compatible or better computer with a mouse installed and a 
serial port to communicate with the audiometer. The default 
operation is to talk to the audiometer through COM1. If you wish 
to use COM2, use "APAC 2" instead. You will also need the latest 
FRYERS.COM program for MSDOS or FRYERS32.DLL for Win95/NT. 
It should have been included with this program disk. 

The MSDOS version of the program is APAC.EXE. The Win95/NT 
version of the program is APAC32.EXE. To use COM2 under Windows, 
you will need to add the definition to the program file 
properties "APAC32 2", or you can run the program from an MSDOS 
prompt by entering "APAC32 2".

On the display you will see various boxes. At the top center of 
the display is the version and copyright notice. Under this is a 
box which may or may not contain messages. It is used to indicate 
errors should they occur.

Under the message box you will find the frequency box. Change 
the frequency dial on the audiometer, and the selector bar in 
the frequency box should follow the frequency setting on the 
audiometer. If it does not, make sure that the computer switch 
in the single line box at the bottom of the display is Off. 
If it still does not work, check the message box at the top 
of the display if you see any error messages, you may have a 
communication problem, or the audiometer is not properly 
configured for RS232 operation. If you are still having trouble, 
follow the trouble guide found on the Fryers program disk to see 
where the problem might be. 

Move the mouse cursor to the frequency box and click on the 1000 
number. Notice that nothing happens. This is because the 
audiometer is not yet under computer control. Below the 
frequency box at the bottom of the display you will find the 
Computer On/Off box. Click the mouse on the ON selection. 
Now try to clock on the 1000 selection in the frequency box 
again. This time, it should be selected. now use the up/down 
arrows on the keyboard. Notice that the frequency selection will 
go up and down with the arrow keys.

Set the frequency selector to 1000. Now click the mouse cursor on 
the left line next to the 2000 selection. Notice that the 
frequency selector bar is now split, the right (designated by the 
"R") at 1000, and the left (designated by the "L") at 2000. This 
shows the ability to operate at split frequencies. Now click the 
cursor on the 4000 selection. Notice that both selection bars are 
once again on the same frequency indicating that the audiometer 
is once again operating in the phase synchronous single frequency 
mode.

At the top of the frequency bar you will notice that there are 
two boxes on either side. These show the currently selected 
frequency for the two channels. I was going to allow editing on 
the boxes, but ran out of time. The frequency can be set in 
increments of 1Hz through the RS232 port. The actual frequency at 
higher frequencies will be rounded to the nearest whole integer 
value since actual resolution is variable with the frequency 
range. Refer to the Audiometer FIPP documentation for calculation 
of the actual available frequencies.

The left and right levels can also be changed like the frequency. 
You will find a single line box next to the level selection box 
indicating the current level. As with the frequency, I was going 
to allow editing of the level, but ran out of time. Through the 
RS232, the level can be controlled in 0.1dB increments. This is 
true over the whole range of available levels. The maximum 
allowed level is determined by the calibration limits of the 
selected transducer. 

You can also select the desired transducer and Simulator option 
by clicking the mouse on the associated selection within the 
appropriate box. 

Also note that there are single line Warble, Pulse, TlkFwd (talk 
forward), and OutRev (output reverse) boxes provided to control 
the associated functions. 

On the 120HL version of the audiometer there is a 10dB boost 
switch which replaces the output reverse switch. This switch is 
not provided on the computer display, but the output reverse 
selector box is still operational. The output reverse function is 
still available inside the audiometer, there are just no external 
switches available to control the function.


Program description:

The control program was written using Turbo Pascal form MSDOS. 
The 32 bit version was written with Delphi. The program uses 
Object Oriented Programming and some assembler. There are options 
available to compile for either MSDOS or Windows. It should be 
noted that the Windows mechanism is very simplistic. This is 
because of the compatibility with MSDOS limits it to text 
operation. Generating fancy Windows style dialog boxes and such
is an exercise left for the application programmer since they will 
want to implement their own specific application interface anyway.

The code is primarily provided as a programming example and not 
as a full application. 

The operation is tied to the AudCom object. There are currently 
only four primary public interface items. "InitRS232" which 
selects the com port and enables the FIPP operation. "Cmd" which 
is used to send a command to the audiometer. "Fail" which is used 
to find out if there was an error, and "CmdCheck" which is used 
for background processing of commands.

Commands are given to the audiometer through the single command 
interface "Cmd". The command is referred to by it's reference.
As an example, to reset the audiometer you would give the command 
"Cmd(DoReset)".



Background/Foreground processing:

If foreground processing is selected "SetForeGround(true)", which 
is the default,then as each command is sent to the audiometer, 
the program will stop and wait for the response before 
continuing. This insures that the command will be sent and 
responded to before the program continues, but there is a slight 
reduction in speed since the program must wait for the audiometer 
to respond before it can continue. 

If you select background processing "SetForeground(False)" the 
send command will not wait for the response. Instead it will 
return to the calling routine to allow the program to continue. 
This can cause some problems if the command was a Get data 
command since the data will not yet have been received. In that 
case, you must use the "CmdCheck" method to wait for the response 
to come back. For Set data type commands this is not normally a 
problem. 

If the response has not been received by the time that a new 
command is given, the program will wait for the response to come 
back before sending the new command. 



Other factoids:

The audiometer requires mostly different commands than the 
hearing aid test equipment for which the Fryers protocol was 
originally designed. As such, an entirely new set of commands 
were developed which start at 0x1000 to get them out of the way of 
potential future test equipment commands. The exceptions are 
DoReset, Get Command Status, and Get Version. These commands are 
shared with the base Fryers FIPP command set so that the computer 
can identify the equipment that it is attached to. For ease of 
programming, the three commands will respond with or without the 
0x1000 prefix. As an example, the Get Version command will respond 
to cmd number 28, or cmd number 0x101C. This allows programmers 
who like to work from tables to be able to add the 0x1000 prefix 
to the command later. 


History:  09/16/92 -med original
          04/10/97 -med revised

<eof>

