

                                  FBAT program                
                                  01/22/02 -med

        The files included are:

             FBAT.TXT    - This file 
             FBAT16.EXE  - FBAT program file (a 16 bit MSDOS program)
             FBAT32.EXE  - 32 bit version of FBAT for Windows
             SETME.BAT   - Batch file to setup a 6500 or FP40
             LABEL.BAT   - Batch file to send a label
             LABEL.TXT   - Sample label file  
             USERID.BAT  - Batch file to send a label plus user ID
             USERID.TXT  - Sample label plus user ID file 
             CONVERT.EXE - Curve data conversion program
             CONVERT.TXT - Documentation for CONVERT program 
             LDECODE.EXE - Label data conversion program
             LDECODE.TXT - Documentation for LDECODE program 
              
             FBAT.PAK   - Sources, archived, contains the following:
               FBAT16.PAS   - source to MSDOS FBAT program 
               FBAT32.DPR   - source to 32 bit FBAT32 program
               FBAT32.RES   - 32 bit version resource file
               FSUNIT.PAS   - Source to FBAT common interface unit
               FCUNIT.PAS   - Source to FBAT communication unit
               FRYEREGS.INC - Register definitions
               CONVERT.PAS  - Source to CONVERT.EXE
               LDECODE.PAS  - Source to LDECODE.EXE

               (Use UNPACK.EXE to unpack the sources from the archive.)

        16 Bit Version:
        To run the FBAT16.EXE program, you will also need the file 
        FRYERS.COM. The FRYERS.COM driver must be installed prior to 
        using a program that uses it to talk to the Frye Electronics 
        instrumentation.  See the Fryers documentation for further 
        information on the usage of the FRYERS.COM driver.

        32 Bit Version:
        To run the FBAT32.EXE program, you will also need the file 
        FRYERS32.DLL. The FRYERS32.DLL driver must be either in the same 
        directory as the FBAT32 program, or in the Windows main 
        directory. See the Fryers documentation for further information 
        on the usage of the FRYERS32.DLL driver.

        Note: CONVERT.EXE and LDECODE.EXE are MSDOS programs, but they 
        will run as is in any version of Windows since they do not need 
        to access hardware directly.

        The main purpose of the FBAT32 program is to provide backwards 
        compatibility for old programs that used the FBAT control method. 
        We recommend that you use the FRYERS32.DLL in Windows95 or 
        WindowsNT where possible because the FBAT32 program is slow. This 
        is due to Windows which can take from 0.25 to 1.0 seconds to run 
        a FBAT command (caused by attaching and detaching the COM port).


                                        1


        Program Usage:

        The FBAT program is provided as a sample program using the RS232 
        communications between a Frye Instrument and the PC to control a 
        Fonix 6500 or FP40 instrument. The FBAT program will send one 
        command to the instrument from the MSDOS command prompt. It can 
        be used with a MSDOS batch file to send multiple commands for an 
        extended setup or control operation.

        Note that the FBAT program is designed for use with all 
        instruments in all possible modes of operation. Some RS232 
        commands may not be available on all instruments or in a specific 
        mode on the instrument. For more information on the commands 
        available and their use with specific Frye instruments, refer to 
        Fryers and FIPP documentation, and the related appendix for your 
        instrument.

        Large data arrays such as a label or curve frame can be sent to 
        the instrument from a file rather than entering the data on a 
        command line. File names must start with a letter. Numbers are 
        assumed to be an immediate data value.

        Requirements:

        The FBAT program requires an IBM PC or compatible computer. You 
        will also need a serial port assigned to COM1, COM2, COM3, or 
        COM4.  The FBAT32 program requires Windows 95 or Windows NT. 

        To run the FBAT16 program on a 16 bit MSDOS computer:

        1. Connect the instrument to the PC's RS232 port. 
        2. Run FRYERS.COM program to load the RS232 driver into the PC. 
        3. Turn on the instrument and configure it for normal operation.

        To run the FBAT32 program on a Windows based computer:

        1. Connect the instrument to the PC's RS232 port. 
        2. Turn on the instrument and configure it for normal operation.

        An example batch file SETME.BAT is provided which uses the FBAT 
        commands to setup a 6500 or FP40 to an initial state. The program 
        assumes that there is a 6500 or FP40 instrument attached to the 
        COM1, COM2, COM3, or COM4 port. 
           
        The FBAT program will allow you to send any command to the 
        attached instrument. It does not check for the validity of the 
        command within it's context. Thus it is possible to send a 
        command which has little meaning in the context of the FBAT 
        program or to the instrument to which it is being sent. 







                                        2


        Source Code:

        The FBAT16 program was written in Turbo Pascal. The source is 
        provided in the files FBAT16.PAS, FSUNIT.PAS and FCUNIT.PAS. 
        If you wish to modify the program, you will need Turbo Pascal 
        version 6.0 or Borland Pascal version 7.0 to compile the programs. 

        The FBAT32 program uses the FBAT32.DPR, FBAT32.RES, FSUNIT.PAS, 
        FCUNIT.PAS and FRYEREGS.INC source files, it is compiled using 
        Delphi version 2.0. Note that the two versions share two files, 
        FCUNIT and FSUNIT. These files contain the program source code. 
        The other files are used to provide the needed stuff for the 
        different compilers. The FCUNIT and FSUNIT are the important 
        source files.


        FBAT16.EXE and FBAT32.EXE

        The FBAT or FBAT32 program sends commands to the attached Frye 
        instrument from the MSDOS command line. In Win95/98/NT/ME/2K/XP
        even though you are at a MSDOS command prompt, it can still run 
        32 bit programs (they are called console programs).

        For 16 bit MSDOS the command is given as:

          "FBAT16 [-Cn] [-In] [-Tn] [-F Rfilename] cmd [count data]" 
        or
          "FBAT16 [-Cn] [-In] [-Tn] [-F Rfilename] Sfilename" 

        For 32 bit Windows then command is given as:

          "FBAT32 [-Cn] [-Tn] [-F Rfilename] cmd [count data]" 
        or
          "FBAT32 [-Cn] [-Tn] [-F Rfilename] Sfilename" 

        The items in brackets [] are optional (to be discussed later). 
        'cmd' is the command number to be sent to the instrument, 'count' 
        is the number of data words to be sent, and 'data' is the actual 
        data. The components of the command should be separated by a 
        space. If the count value is zero, no data needs to be provided. 
        If no count value is given, the count is assumed to be zero. 
        Refer to the FIPP documentation for the command numbers and 
        format of the data sent and received. 

        Note: Options (those items in brackets []) must be given first in 
        the command line (immediately after 'FBAT') before the 'cmd' or 
        Sfilename values. The 'cmd' or Sfilename entry must be given.

        Commands may be given in ASCII form, or in hexadecimal. Hex 
        numbers must be preceded with a dollar sign "$". 
        Example: $100C





                                        3


        If a filename is given (Sfilename) instead of a command number, 
        it is assumed that the indicated file contains a command sequence 
        in ASCII numbers. One line per number. This allows large commands 
        to be sent that would not otherwise fit on a single MSDOS command 
        line.

        The "-F filename" is an optional receive filename. If a command 
        option of "-F" is encountered followed by a space, followed by a 
        filename. The response from the instrument will be placed into a 
        text file of the given name (any existing file of the same name 
        is overwritten). The data is given as an absolute decimal number 
        of the array of words returned by the instrument. Post processing 
        of the returned data will most likely have to be done to properly 
        interpret the resulting data. FBAT simply provides and ASCII file 
        transport for the command packets, it does not interpret the 
        actual command packets (except for labels).

        The "-Cn" is an optional COM port command specifying the comport 
        to use, where 'n' specifies a COM port number between 1 and 4 (or 
        1 to 9 for FBAT32).  There should be no space between the C and 
        the number. If the "-Cn" option is not given COM1 is assumed to 
        be the port to use. If a valid fryers driver is not found on the 
        specified port, an error message will be generated and the 
        program will be terminated.

        For 16 bit version only:
          The "-In" is an optional IRQ interrupt number that can be   
          specified for use with the selected COM port. The number should     
          be between 0 and 15. If no number is given, the default   
          interrupt for the COM port will be used. There should be no   
          space between the 'I' and the number in the command.
         
        The "-Tn" is an optional delay that may be added to the poll 
        time-out function. By default, if a command is not returned 
        within five seconds from the time it is sent, or if a poll is not 
        being received from the instrument, the program will be 
        terminated. This time can be changed with the 'Tn' command. There 
        should be no space between the 'T' and the number in the command.

        The default delay is five seconds. For most commands this is 
        sufficient. There are some commands which may require a longer 
        time period. An example would be a standard pure tone sweep 
        request with noise reduction set to 16. This can take up to 3 or 
        4 minutes to complete. In such cases, the poll time-out delay can 
        be adjusted with the "-T" command. The time is given in 0.055 
        millisecond 'ticks'. As an example, the default delay is 5.5 
        seconds, or a value of 100. 

        Note: items in brackets [] are optional items. Don't use the 
        brackets in the command, they are only used in the description to 
        indicate that the item is optional.





                                        4


        Text commands:

        If the data is large, or is to be derived by computer, the 
        command can be read from a file instead of command line 
        parameters. Instead of specifying the command number, use the 
        name of the file the command is to be read from "FBAT filename". 

        The format of the file must be one number per line, with the 
        command number being the first number in the file followed by the 
        data count on the next line, followed by the individual data 
        elements on each line after that. All data must be given in 
        ASCII form.

        All numbers must be in integer form (no decimal points).


        Numbers:

        Command numbers may be given as decimal or as Hexadecimal. 
        Decimal numbers must start with a number character or a minus 
        sign followed by a number. The number ends with the first non-
        numeric character found.  Hexadecimal numbers start with a '$'. 
        It is not valid to preceded a hex number with a minus sign. The 
        hex number must be valid. The hex number ends on the first non-
        valid hex digit. Valid hex numbers are 0-9 and A-F. 
         

        Labels:

        There are currently as of this writing two label text commands (6 
        and 66). These commands are treated special because they accept 
        text rather than data words. The text can be read either from a 
        file specified in the command (FBAT 66 LabelFile), or it can be 
        entered manually by specifying the command number (FBAT 6 or FBAT 
        66) without any other parameters. 

        If you give the command number, a simple editor will be invoked 
        which will allow you to enter the label information from the 
        keyboard. 

        If you provide a filename after the command number, the label 
        information will be assumed to be in a file of the specified 
        name. The file is to consist of standard ASCII text of one text 
        line per label line to be sent.

        User ID:
        Newer instruments such as the FP35 allow you to upload and save 
        the User ID text that can appear on a label. (In older 
        instruments it has to be done at the factory.) The User ID is 
        accessed as an extended label. Normally a label has eight lines 
        of text. The user ID is found in the label lines nine and ten 
        which can be access via the extended label command (66). An 
        example batch file (USERID.BAT) is included that shows how to 
        load and save a user ID.


                                        5


        LABEL.BAT

        A sample batch file, LABEL.BAT, is provided to show an example of 
        sending a label to the 6500 or FP40. If the instrument is 
        connected to COM1, use the command "LABEL 1". If the instrument 
        is connected to COM2, use the command "LABEL 2" (Note the space 
        between the program name and the number).

        If you add the LABEL.TXT filename to the command: 

          "LABEL 1 LABEL.TXT"

        The label will be read from that file. Otherwise, the default 
        label editor will be used to obtain the data manually from the PC 
        keyboard.


        USERID.BAT

        A sample batch file, USERID.BAT, is provided to show an example of 
        sending a label to the FP35 assuming the instrument is connected 
        to COM1. If you are using COM2, edit the file to use -C2 in the 
        command line. Include the name of the text file that contains the 
        Label and UserID information to be loaded into the FP35.

          "USERID USERID.TXT"

        The Label and UserID will be read from that file and 
        automatically saved in the instrument.


        SETME.BAT

        The SETME.BAT program shows an example of initializing a Fonix 
        6500 or FP40 instrument.  The SETME batch file assumes that a 
        Fonix 6500 or FP40 instrument is attached to the serial port on 
        the PC. 

        If the instrument is connected to COM1, use the command 
        "SETME 1". If the instrument is connected to COM2, use the 
        command "SETME 2" (Note the space between the program name and 
        the number).

        The program will send a series of commands to the instrument. The 
        commands configure the instrument to place it in the pure tone 
        mode with the frequency set to 2000Hz. The amplitude is set to 
        70db. The distortion is set to total distortion. The Gain mode is 
        set on, and Noise reduction is set to 2.








                                        6


        Two support programs are also provided to convert curve and label 
        data from the returned ascii data into a form more easily 
        readable. 


        CONVERT.EXE

        Since the curve data read by the FBAT program is in absolute 
        integer form, it is not easy to use by some programs such as 
        Dbase or Lotus. The CONVERT program has been provided to convert 
        the absolute data read in by the FBAT program into real ASCII 
        text numbers usable by programs that can import ASCII text files. 
        See the CONVERT.TXT file on how to use the CONVERT program.

        LDECODE.EXE

        When a label is read from the instrument, it is in a numeric 
        format which is rather hard to decipher. The LDECODE program 
        converts a label result from the FBAT program into a readable 
        ASCII text file. 

        Use the LDECODE program after using command 86 to read the label. 
        Be sure to provide a filename with command 86 so that the LDECODE 
        program can use it. 
































                                        7


        Label Bitmaps:

        The FP35 allows you to send a bitmap graph to the printer label. 
        An area that is 160 pixels wide by 32 pixels high is available 
        below the normal text in the printed label. 

        You can send a bitmap to the FP35 printer label using the FBAT 
        program. The format is slightly different than the other FBAT 
        commands in order to manage the image requirements. The command 
        is given as shown below. The comport parameter is optional. FBAT 
        will default to COM1. If you are using COM2, you should specify 
         -C2 in the command.

        Example:

         FBAT32 [-Cn] 96 2 0 160 0 TEST.BMP
                   |  |  | |  |  |  |
             com port |  | |  |  |  |
              bitmap cmd | |  |  |  |
                monochrome |  |  |  | 
                         Xpos |  |  |
                            Ypos |  |
                         Dest=Label |
                           Bitmap file 

        The bitmap can be built with the Windows Paint program. For the 
        FP35 bitmap, you must set the Image attributes to; 160 pixels 
        width, 32 pixels Height, Units in Pixels, Color in Black and 
        White (Monochrome). Draw or import the desired graphic image to 
        be placed on the printer label. 

        Once the bitmap image has been sent to the FP35, you can use the 
        Label store command to save the bitmap image to the FP35's 
        permanent memory.

         FBAT32 [-C] 89 1 4

        Note that it is possible to place the bitmap image anyplace on 
        the label, and you can send a larger image if you wish. However, 
        the image data cannot be larger than 990 words. About 7900 pixels 
        for a monochrome image. If all or part of the image is placed on 
        top of existing label text, the image will overwrite that portion 
        of the label text.

        The above example can be found in the file LOADBMP.BAT. Assuming 
        a BMP file named TEST.BMP, use the command as follows:

        If you are using COM1:  LOADBMP TEST.BMP
        If you are using COM2:  LOADBMP -C2 TEST.BMP

        To clear the bitmap image, load the BLANK.BMP image provided. 
        Only one bitmap image can be loaded to the printer label. If 
        another one is sent, it will overwrite the existing bitmap.



                                        8


        Special note:

        If you run the 16 bit version of Fryers in a MSDOS windows of 
        Win95/98, the 32 bit version will not run until you close the 
        MSDOS window that the 16 bit version of Fryers was run in. This 
        is caused by Win95/98 giving the serial port resources to the 
        MSDOS window at the time that the 16 bit Fryers driver asks for 
        the serial port hardware. Windows will leave the serial port 
        hardware attached to the MSDOS window until the window is closed. 

        The reason for this is that Windows doesn't know what the program 
        running in the MSDOS window is doing, so it makes the worst case 
        assumption that the hardware must remain attached to the window 
        until such time as the MSDOS window goes away. 

        Normally this is not a problem, but it can cause concern if you 
        run the 16 bit version and then immediately try to run the 32 bit 
        version in the same window or leave the MSDOS window open in the 
        background. It won't work. 

        The above problem is an interesting side effect of the attempt to 
        maintain reverse compatibility to old MSDOS programs while 
        running under Win95/98. Since you can't run the 16 bit version 
        of FBAT in Win NT/ME/2K/XP, this problem never comes up there.



        History:  06/29/89 -med
                  01/19/92 -med
                  04/01/92 -med
                  11/16/92 -med
                  10/04/93 -med
                  09/27/94 -med
                  04/13/95 -med
                  05/01/97 -med 
                  06/19/00 -med 
                  01/22/02 -med
        <end>


















                                        9
