Home
New Customers
Help
News
FAQ
Products
Papers
Links
Software
About FTA
Sales

Debugging Sequencer Programs

The Fta32 Sequencer is used on the FTA2000 and other FTA instruments to provide automated instruction sequencing. Sometimes these programs do not do what you wished them to do. This note will guide you through debugging your program.

Logs

The very first thing you want to do is inspect the information the program is presenting to you as part of its natural operation. There are two logs which are always generated:

  • The Sequencer generates an Event Log which is displayed in the middle of the screen. Since the log can become quite long, it has a scroll bar on its right side to move up (back) and down (forward) in the log. You want to inspect this first, before doing anything else, to see if the Sequencer is doing what you wanted. Many issues are resolved by careful inspection of the log. Even if it does not give you the cure, at least it will tell you where the problem is.

  • The Fta32 program generates another log whenever a trappable error (see below) is detected. Such errors occur when Windows realizes the software instruction of the FTA software can not be executed as written. These are more fundamental than simply writing the wrong thing in the Sequencer program. The trappable error log is written to a disk file with the name Fta32.err in the application directory (i.e., the directory containing the main program). You can inspect this file with Notepad, but it may not make a whole lot of sense to you. However, it is useful to FTA and should be sent as an e-mail attachment.

Both of these logs are stored in disk files in the application folder. The Event Log has a name tied to your Sequencer program name and is shown on the Sequencer tab. The error log is always called Fta32.err.

Trappable Errors

A trappable error is an error the operating system can catch in such a manner that it avoids large-scale damage such as crashing the program or shuitting down the system. This does not mean the function being performed will continue as if nothing happened -- it will fail, but the failure will be limited to it. Trappable errors have numbers and descriptions.

The following is a list of trappable errors specific to the automation hardware in FTA2000 and FTA4000's. These errors occur when the host computer can not communicate with the hardware in the instrument for some reason.

  • LINK_E_ALREADYOPEN
    0x80040200 -2147220992
    "Port already open"

  • LINK_E_BADPORT
    0x80040201 -2147220991
    "Can't open port"

  • LINK_E_PORTSETUP
    0x80040202 -2147220990
    "Can't setup port (SetCommState)"

  • LINK_E_TIMEOUT
    0x80040203 -2147220989
    "PC104 not talking"
    Make sure instrument is turned on 10 seconds before Fta32 program starts

  • LINK_E_BADMESSAGE
    0x80040204 -2147220988
    "Unrecognized message from PC104."
    "PC104 didn't report position"
    "PC104 didn't return byte"

  • LINK_E_PC104
    0x80040205 -2147220987
    "PC104 Reports Error: %s", szBuf)
    Note: Power On is an error if the VB program sees it. It should occur before the VB program is started.

  • LINK_E_PORTCLOSED
    0x80040206 -2147220986
    "Serial Port not open"

  • LINK_E_BADWRITE
    0x80040207 -2147220985
    "Serial Port write failure"

The following error looks like one of the above, but is actually from a different source. It is, however, an "automation" error (a Windows term meaning some components can not talk to one another) and so it has the long negative number like the above errors. Note the middle digits are different than the link104/PC104 automation errors. This error has nothing to do with communicating to the instrument's robotics; it is entirely within the computer and the frame grabber.

  • -2147467259
    "Frame grabber failure"

The following are some common errors that can occur with the operation of the Windows program.

  • Error:70 in Fta32, Permission denied in Movie FileItem. You want to rename this file but a second copy is already open, so that would create confusion with the other user or other instance. If it is not obvious that a second copy is open, perhaps it was not closed correctly in the Sequencer's Close Movie instruction.

  • Error:91 in Fta32 Object variable or with block variable not set. This means that an object was referenced that did not exist, although it was supposed to exist. A common situation is when a Movie form is supposed to exist, but doesn't. More particularly, the errror occurs when one part of Windows can not find the object in another part, in another window. The object reported in the error message is often not the problem. Instead it is normally part of a larger object which does not exist, and happens to be the first thing referred to in this larger object. Look for improper Open Movie execution.

  • Error:3051 in DAO.Workspace. The Microsoft Jet database engine can not open the file <file name>. It is already opened exclusively by another user or you need permission to view its data. This message is worded a little strange, but basically you must be able to write to the same folder as you open the database (Movie) file from. A common situation is when you attempt to open a Movie from a CDROM. You can not write to the CDROM, so DAO will not let you actually open the file. You must copy it to the hard drive where you can open it. If you continue to have trouble, make sure you have write priviledges to the folder you are trying to use.

  • Error:3356 in DAO.DbEgine. You attempted to open a database that is already opened exclusively by user 'admin' or machine. Try again when the database is available in Database CompactAccessDatabase. This means two people (actually, two programs) are trying to use the same file. Perhaps the first program was supposed to close the database but did not. FTA Movies and Sequencer programs are all Data Access Object (DAO) databases. Look for improper Close Movie execution.

Problem Areas: Opening Movies

When you take a Movie it is opened in a new Window. The Sequencer wants to give commands to this new Window for analysis or storage. It must establish a communications link (through the operating system) before it can expect these commands to be executed. (This is actually more difficult than it sounds.) You must use an Open Movie instruction to establish this window-to-window communication. The problem occurs when the Movie window is partially, but not completely, opened. Then commands can fail. The Open Movie Sequencer instruction has an optional parameter for a time out. You have the following options:

  • Use the Open Movie with no timeout specified. Open Movie will constantly query the new Window if it is ready for instructions. Normally it will answer truthfully and the instruction (say, analyze an image) is OK. However, if the Movie is never opened (say the Movie was never triggered), the Open Movie instruction will never complete and the Sequencer program will hang here.

  • Use the Open Movie with a timeout specified. Open Movie will constantly query the new Window if it is ready for instructions. Normally it will answer truthfully and the instruction (say, analyze an image) is OK. However, if the timeout is reached before the Movie Window replies it is ready, the Sequencer will Abort the Movie. This will generate a partially complete Movie. The Sequencer program will continue but the current Movie may have no useful analysis.

  • Precede Open Movie with a Wait instruction of the expected duration of the Movie (plus a little extra to spare). Then use Open Movie with a short timeout. All valid Movies will be ready before the Open Movie instruction is executed. This is the safest and best way. The only disadvantage is that an obviously failed Movie takes as much time as a good one.

The Open Movie instruction generates an Event Log entry when it executes. There is a seperate entry if a timeout occurs while waiting for the Movie to open.

Problem Areas: Close Movie

You must have a Close Movie for each Open Movie in your Sequencer program. Close Movie is when all data is permamently stored on disk. Even if you do not want to Save Movies As..., you must have a Close Movie to free the resources used in taking the Movie.

Problem Areas: Movie Name and Path

The saved Movie name can be specified both within the program and externally through the serial interface. This can become a bit complicated because of the following options:

  • Specify the name only within the Sequencer program. An index, if specified, will be post-fixed (and then incremented) to each Movie. The remainder of the path will be the current directory (typically the application directory).

  • Specify the name only on the AutoRun tab. The index, assumed to start at 1, will be post-fixed (and then incremented) to each Movie. The remainder of the path will be the current directory (typically the application directory).

  • Specify a complete path in any of the above two situations, instead of using the current directory.

  • Specify any or all of the following three externally through the external interface: the Movie name, a partial path, or a complete path. If the externally provided names do not include a Movie name, that can be specified within the Sequencer program or from the AutoRun tab.

Previously the name specifications required that no extraneous spaces be included and that any name already existing matching the specified name indeed match in case also. These conditions are now relaxed. For example, the following is now satisfactory (to illustrate both problems):

specified:

c:\program files\ fta32\ data\ mysample

already existing:

C:\Program Files\Fta32\data\mysample

With the new code, the already existing path would be recognized to be the same as the specified path and no new path would be generated.

When the Close Movie instruction executes, it generates an Event Log entry if it saves the Movie. It will say "Saved Movie: <your movie name>". It will also generate an Event Log entry saying it closed the movie (whether or not it was to be saved).

Problem Areas: Location of 'Save Movie As' within Sequencer Program

This instruction resets the Movie index counter whenever it is executed. If it is included within a loop, the Index will be reset each time. You may want it outside the loop.

An event log entry is made by the Save Movie As instruction when it executes. This tells you the base name of the movies, as decoded by the Sequencer logic.