Programming
the FT-100a

Table of Contents
(click
on desired topic or scroll down to read entire text)
Programming the FT-100a is
very simple, intuitive, and does not require a
software engineer. Although the
programming structure is simple, it is also very
powerful. The language was tailored after the BASIC
computer language, and in fact, most of the commands are
identical. Even a beginner, with little or no real
programming experience, should be quite proficient in
constructing FT-100a test programs in short order.
And don't forget, Y-tek provides free technical
support. Whenever you need help, just pick
up your phone.
The intent of this brief
introduction to FT-100a Programming is not to teach you
how to program, nor does it cover all aspects of FT-100a
programming. It is merely an exposure to the
simplicity of the programming language, including several
examples.
Programs are initially
loaded into the FT-100a as an ASCII text program.
This is a text file that can be generated using a simple
word processor or text editor. Programs may be
loaded into the tester through either the IBM compatible
floppy disk drive or the RS-232 communications port.
Once the ASCII program has
been loaded into the FT-100a, it will be processed and
compacted, and then may be SAVED as a
"compacted" program. The compacted
format is smaller, more efficient, and loads
faster. If a program is to be edited, even after it
has been "compacted", it may be LISTED as an
ASCII program. This will regenerate an ASCII file from
the compacted format, then send it out the serial
port. Line numbers will be placed on each program
line, but the FT-100a does not require line numbers when
loading in an ASCII program.
Once the program is
loaded, pressing the START pushbutton will immediately
begin program execution.
Programs are written, and
executed, one statement at a time. Line numbers are
not required and are ignored when the ASCII program is
loaded in. Each line must be followed by a carriage
return (this is usually the ENTER key on the terminal or
computer). When the program is started, it will
begin executing the first statement. Upon
completion of the first statement, it will immediately
begin the next, and so on until the end of the program or
an END statement is reached. More than one
statement may be placed on a line, separated by a colon
(:). If there is more than one statement on a line,
the first statement is executed, then the next, and so
on.
As with all programming
languages, syntax is very important. The FT-100a
has a very thorough error indicator that will quickly
flag all syntax errors, indicating the exact location of
the error.
Following are just a few
of the syntax features:
Program Name
- First line of program. Identifies the program on
the FT-100a display.
Comments - Comments can be placed
anywhere in the test program.
Labels
- Used to mark the location of a given program line.
Variables - Numeric and String
variables are fully supported.
Arrays - Arrays of unlimited dimensions
are allowed.
I/O References - Input/Output lines (and
ports) are addressed directly and treated just like
variables. No I/O conversions necessary.
Functions - There are many built-in
numerical and string functions.
Number Formats - Numbers may be input or
displayed in many different formats: Integer,
Floating Point, Exponential, Binary, Hexadecimal,
etc. All number format conversions are automatic.
The following operator
types are supported by the FT-100a programming language:
Arithmetic
Operators - Example: VAR1 = 3.4 + VAR2 / 9.6
Logical (Boolean)
Operators - AND, OR, NOT, NAND, NOR, XOR.
Examples: IF A=B AND C>D THEN GOTO L1
IF (A=5 OR B=6) AND C=7 THEN X=1
Comparison
Operators - "=",
"<>",
">",">=","<","<="
String Operators
- Strings may be joined, end to end, by using the plus
(+) operator.
Example: A$= "ABC" + "DEF" Result is:
A$= "ABCDEF"
One of the most powerful
features of the FT-100a programming language is the
ability to address and process input/output information
just like a variable. All input and output
operations are performed and configured automatically by
the FT-100a. Number conversions are taken care of
as well. This makes programming input and output
operations extremely simple and versatile.
I/O Address
designators
I/O lines are addressed
through a "self-writing" designator: {I/O
type}{module}{reference}
{I/O type} - P - Digital Port , L - Digital
Line, A - Analog line, etc.
{module} - The main unit is always
module "A". The external modules are designated
as B - H.
{reference} - The individual I/O line
within the module.
Digital Ports
- Digital ports consist of eight lines which may be
addressed individually (see Digital Lines) or as an 8-bit
port. The ability to input, output, and process
port information as one entity can be very
convenient. Additionally, the FT-100a has several
commands that allow bit manipulation.
Digital port references
begin with the letter "P", followed by the
module designator (A-H), then the port# reference.
Reading and Setting
Digital I/O Ports - Digital I/O ports are handled just
like variables.
Examples: PA1 =
3AH 'Set output
port #1 in main module to 3AH
PC4 = VAR1 'Set output port PC4
to value in variable VAR1
Digital Lines
- Digital ports are made up of eight individual
lines. Each line may be addressed separately,
allowing individual control of any single digital line.
Digital line references
begin with the letter "L", followed by the
module designator (A-H), then the line reference.
Digital lines may be referenced in one of two ways: (1)
line number, or (2) port number and line number (1-8)
within the port, separated by either a comma or colon.
Reading and Setting
Digital I/O Lines - Digital I/O lines are also handled
just like variables. Reading a digital line will
yield a value of either "1" or "0".
Digital Line references
using variables - Variables or numeric expressions may be
used to reference digital lines as either individual line
numbers or as line numbers of a designated port#.
Examples: LA34 = 1
'Set line 34 in the main module to one (+5 volts)
IF LB3,2 = 0 THEN END
'Lines treated just like variables
Analog I/O
- Analog input and output information is handled the same
as a variable. The main module's analog range is
either 0-10 volts or +/-5 volts, depending on the setting
of the ANALOG command.
Analog line references
begin with the letter, "A", followed by the
module designator (A-H), then the analog line number.
The main module is always "A".
This is true for input as well as output analog lines.
Examples: AA2 = 3.4
'Set analog line# 2 of the main module to 3.4 volts
AC4 = AD12 +
AA3
'Read and set just like variables
AB(VAR1) = AD(VAR2) 'Analog I/O
referenced by variables
External Trigger
- The FT-100a main unit has one 8-bit digital input port
that has an external trigger line. This trigger
line may be used to latch the port information coincident
with an external trigger event, much like an oscilloscope
trigger. The polarity of the trigger is
programmable, and can be reset through program
commands. If the external trigger capability is not
needed, the digital input port may be used like any other
input port.
The variable voltage
supply is a special analog output that can serve as a
power supply for the unit connected to the FT-100a.
This programmable supply is regulated, can handling up to
one amp of current, is overload protected, and can be set
to any voltage between 0 and 10 volts with a resolution
of about 39.2 mv. The variable supply output may be
set and read like a variable, with its own fixed name,
SUPPLY. Although this line is capable of high
current output, it may also be used as a general purpose
analog output.
Syntax: SUPPLY {voltage}
or: SUPPLY =
{voltage}
Examples: SUPPLY 4.5
'Set the variable voltage supply to 4.5 v.
SUPPLY = VAR1 'Set the var volt
supply to value of variable VAR1
Normally a program flows
from one statement to the following statement, but often
it is desirable to have the flow of the program broken
and "jump" to a different location.
Frequently, there is a need to repeat a segment of a
routine many times within a program. The following
commands are used to accomplish these tasks.
| GOTO
- |
Causes the program to
immediately jump to the indicated label.
Example: GOTO
LABEL1
'Immediately jump to LABEL1 |
| CALL
- |
Subroutine
"call". Similar to GOTO, but
each subroutine has a RETURN statement to direct
the program back to the location immediately
following the CALL statement. Subroutines
are small programs, within a larger program, that
can be used many times. Subroutines provide
a very efficient method of repeating given tasks.
Example: CALL
SUB1
'Immediately jump to SUB1 |
RETURN
or RET - |
Command to instruct the program to return to the
location after the original CALL statement. |
FOR/NEXT,
LOOP/ELOOP - |
(Note: FOR and LOOP are exactly the same, as are
NEXT and ELOOP.They may be used
interchangeably.) These statements are used
to "block in" a section of the program
and go through the given block of program
commands a given number of times. This
ability is a very efficient way of performing a
task many times with a minimum of
programming. The initial FOR (LOOP)
statement sets a variable to a given value and
defines the maximum value for the variable within
the loop. Each time a NEXT (ELOOP)
statement is encountered, the variable is
incremented by one and compared to the maximum
value. If it is less than or equal to the
maximum value, the program will "loop"
back to the statement just after the FOR (LOOP)
statement and go through the loop again.
When the loop variable is larger than the maximum
value, the program will not "loop"
back, but instead continue through to the next
statement after the NEXT (ELOOP) statement.
Example: FOR VAR1 = 4 TO
12
'Loop through routine 9 times |
The IF/THEN statement
evaluates a condition and executes commands if the
condition is "true". If the comparison
expression is evaluated as "true", all commands
following THEN, on the same line, will be executed.
If the comparison is "false", the program
"falls through" the IF/THEN statement and
begins execution of the following command. Any
expression that evaluates to a number that is non-zero
will be declared as "true".
Syntax: IF {comparison
expression} THEN {conditional commands}
The comparison expression,
in its simplest form, is one expression compared to
another. However, multiple comparisons may be made
within the same IF/THEN statement by using Boolean
operators. Any of the expressions within the
comparison expression may be unresolved as well.
String expressions may be compared as well as numerical
expressions.
The conditional commands
following THEN may be any valid program commands.
Since more than one command can be placed on a line
(separated by a colon), several commands can follow
"THEN", and will be executed if the comparison
is "true".
Example: IF VAR1 = VAR2
THEN BEEP
(If the variable VAR1 equals variable VAR2, the command
BEEP will be executed.)
Example: IF A > B THEN
VAR1=A:VAR2=B
(If the variable A is larger than B, the variable VAR1
will be set to the value of A and variable VAR2 set to
value of B.)
Example: IF
((3.4+VAR1)/256 = VAR2) OR (PA2 < 34H) THEN PA1 =
VAR2+VAR1
(Multiple comparisons may be made within the same IF/THEN
statement.)
The FT-100a may be
operated in a "single-step" mode to assist
while writing and debugging programs. While the
"single-step" mode is enabled, the FT-100a will
execute one command or statement and halt (with an
audible "beep"). Pressing the CONT
pushbutton causes the next command line to be executed.
The line number is displayed on the LCD screen.
Single-step mode is
enabled and disabled through the "single-step
command". This command may be issued as a
"direct" command or it may be incorporated as a
program command. When the program is in a
"single-step" wait state, the operator may
communicate with the FT-100a via the keyboard or through
the serial communications line, and may read and even
alter I/O lines, variables, etc. Selectively
enabling and disabling single-step mode within a program
can make debugging large programs much easier.
Single-step Commands:
SS ON -
Turn "on" single-step mode of operation.
Single-step will remain "on" until disabled by
an "SS OFF" command.
SS OFF -
Disable single-step mode of operation. Single-step will
remain disabled until turned "on" by another
"SS ON" command.
After the test program has
been developed and debugged, it may be "saved"
on a floppy disk, or downloaded to another computer
through the serial communications port. Saving the
program to a floppy disk may be done from the front panel
pushbuttons or as a "direct command" (command
issued through the keyboard or serial communications
port). Programs can be saved as an ASCII text file,
or a "compacted" program. Many programs
can be stored on one floppy disk, making it very easy to
change test programs frequently.
|