| This application note
describes a very simple method of capturing and
storing eight lines of digital information, much
like a digital logic analyzer. No additional
hardware is necessary, and to keep the routine
simple, only the main FT-100 unit is used for the
digital input as well as the trigger source. Once
the digital information is captured and stored in
memory, you are free to treat the data as your
needs dictate. The data may be stored on a disk
file, printed out, downloaded to a computer, or
analyzed for specific features and later
discarded.
Features
- Uses no
additional hardware. Main FT-100 unit is used for
all capture and trigger functions.
- Several triggering options are available:
- No triggering (free running)
- Digital Input Line (main unit only)
- Logic Word matching
- Externally gated data
- Trigger polarity may be positive- or
negative-going
- Number of samples recorded may be specified,
and is limited only by the amount of available
memory in the FT-100. (The routine
indicates the available memory.)
- Time between each sample is programmable.
- Data may be stored on a floppy disk
- Data may be stored in an array for analysis by
the FT-100 program.
- Normally, several thousand data samples can be
stored (up to over 60,000!).
Limitations
- Only 8 lines of
data are captured.
- The only Digital Input Port used to capture
data is PA10.
- The smallest sample speed allowed is 8 msec. per sample.
- The time between each sample is always in
increments of around 2.8 msec.
- If data is externally gated in, the recycling
time is about 11.6 msec.
- During data capture, the FT-100 cannot perform
other tasks. The FT-100 will remain in the
assembly routine until all
the data is captured.
- All timing is based on the microprocessor
crystal, and may not be accurate enough for some
very high-accuracy
applications.
- Externally gated data relies on a software
trigger. This causes a small delay between the
trigger and the captured data
(usually less than one msec.).
- All internal interrupts are enabled during data
capture. If this is a problem, disable interrupts
using the DINT command prior
to calling the assembly subroutine.
To maximize speed,
the data is captured and stored by an assembly
subroutine. The accompanying program READ's and
POKE's each assembly byte into the FT-100 memory.
Triggering is also done inside the assembly
subroutine. All input information is passed to
the assembly subroutine through specified, and
fixed, RAM locations. The data is captured and
placed in RAM beginning at the RAM location
indicated by BEG_ADDR. All data is stored in byte
format (binary) as input from the Digital Input
Port (PA10), and may be retrieved by using the
PEEK command.
Once the assembly
routine has been "poked" into memory
and the input parameters "poked" into
their designated RAM locations, the assembly
subroutine may be called by using the SYS
command. Any time you wish to capture and store
digital data, simply call the subroutine. The
input parameters, as well as the assembly
program, will remain in RAM and will not be
changed as long as the main program remains
running. If the program is stopped or ends, the
information will still remain in RAM, and may be
accessed directly (in the Direct Command mode).
If a different program is loaded into the FT-100,
anything previously in RAM memory will not be
valid.
CAPTURING
DIGITAL DATA
Once
the assembly subroutine is poked into memory, it
may be called anytime, using the SYS command. The
actual memory location of the assembly subroutine
is indicated by the variables PROG_SEG and
PROG_OFF. Prior to calling the assembly
subroutine, the input parameters must be
established and passed to the subroutine through
the designated RAM locations. Once the parameters
are placed in RAM, they will remain valid and
need not be reset unless your program changes a
value. Following are the input parameters and a
description of each:
| TIME_DIV - |
Delay
time between each sample, measured in
microseconds (ms.). This variable may be
any value between 8 and 65535. If the
external trigger line is used to latch
each sample, TIME_DIV is not used. |
| SAMPLES - |
Number
of samples of data to be captured and
stored. This variable may be any value
between 1 and 65535. |
| TRIG$ - |
Trigger
source. This is a string variable
that tells the program which trigger
source to use. There are several
triggering options available: |
|
No trigger - |
Free running.
Captures data instantly with no waiting.
TRIG$ = "" to indicate no
triggering. |
|
Digital Input Line
- |
A
transition on the designated digital
input line will trigger the data capture.
Any digital input line in the main FT-100
unit may be used (including PA10).
TRIG$ = "LAxx". (LA41 - LA80).
(NOTE: TRIG$ cannot be of the
form: "LAx,y")
|
|
Logic Word - |
May be any 8-bit
word. The digital input port PA10 is
constantly sampled, looking for the
designated "Logic Word". When a
match is found, the capture routine is
triggered. TRIG$ may be set to any string
value that is equivalent to a numerical
value of 0 to 255.
Examples: TRIG$ = "134", TRIG$
= "0FCH",
TRIG$ = "10110010B"
If a variable is used: TRIG$ = STR$
(VAR1) |
|
External Latch - |
Latches one sample
(8 bits) at each transition of the
external trigger line. The main unit
external trigger line is used to gate in
one logic word of digital information.
TRIG$ = "EXT".
(See "LIMITATIONS" for more
information about external triggering) |
| TRIG_POL
- |
Trigger
polarity. Set to zero (Ø) for trigger on
positive-going transition. Set to one (1)
for negative-going transition. (Not used
for "Logic Word" triggering).
|
ACCESSING
THE DATA
The digital
data is stored in RAM beginning at the location
indicated by the variable BEG_ADDR. The data may
be accessed by using the PEEK command. Data is
stored in binary format, just as it is read from
Digital Input Port PA10. The program listing
shows a method of storing the data on a disk
file. What you choose to do with the data after
it is captured is completely up to you. The data
will remain valid in RAM until more data is
captured.
When keying
in this program, the comments may be omitted.
They are there only for clarification. Also, use
care when entering the DATA statements (assembly
subroutine). They must be exact for the
subroutine to function properly.
LOGIC_1
'Program Name
'
PROG_LEN= 93H 'Number of
bytes in assembly subroutine
'
'---- Find location in RAM to place assembly
routine ---
LAB_BEG=PEEK 45+(PEEK
46*256)+((PEEK 47+(PEEK 48*256))*16)
STR_BEG=PEEK 59+(PEEK
60*256)+((PEEK 61+(PEEK 62*256))*16)
MEM_FREE =
LAB_BEG-STR_BEG-16
'Free memory available for assembly program
PROG_SEG=INT
(STR_BEG/16)+1
PROG_OFF=0
ADDR=PROG_SEG*16
'
'--- Test for enough memory ---
IF PROG_LEN>MEM_FREE
THEN BEEP:CLS:DISP "INSUFFICIENT":DISP
"MEMORY!":END
'
FOR I=0 TO PROG_LEN:READ
X:POKE (I+ADDR),X:NEXT 'Load assembly program
'
'----------------------------- Assembly Program
-----------------------------
DATA
006H,02BH,0FFH,0FCH,0BEH,077H,001H,08AH
DATA
014H,046H,08BH,01CH,046H,046H,08BH,02CH
DATA
046H,046H,08BH,00CH,046H,046H,0FFH,034H
DATA
007H,0F6H,0C7H,040H,074H,00EH,0F6H,0C7H
DATA
020H,075H,044H,0E4H,004H,03AH,0C3H,075H
DATA
0FAH,0EBH,02EH,090H,0F6H,0C7H,020H,074H
DATA
026H,051H,02AH,0F6H,08AH,0CFH,080H,0E1H
DATA
007H,0B4H,001H,0D2H,0E4H,0ECH,022H,0C4H
DATA
08AH,0E8H,0ECH,022H,0C4H,03AH,0C5H,074H
DATA
0F9H,08AH,0E8H,0F6H,0C7H,080H,075H,002H
DATA
032H,0C4H,03CH,000H,075H,0ECH,059H,0E4H
DATA
004H,0AAH,0E2H,002H,007H,0CBH,08BH,0C5H
DATA
02DH,001H,000H,075H,0FBH,0EBH,0F0H,051H
DATA
08AH,026H,080H,000H,080H,0E7H,080H,0B1H
DATA
004H,0D2H,0EFH,059H,00AH,0E7H,080H,0CCH
DATA
004H,088H,026H,080H,000H,08AH,0C4H,024H
DATA
0FBH,0E6H,005H,08AH,0C4H,0E6H,005H,0E4H
DATA
006H,0D0H,0E0H,073H,0FAH,0E4H,004H,0AAH
DATA 0E2H,0EBH,0EBH,0C8H
'---------------------------------------------------------------------------------------
'
'----- Set Input parameters before calling the
Digital Capture subroutine -----
'
TRIG$ = "LA41"
'Trigger line ("EXT"=external,
""=none)
SAMPLES = 1000 'Number
of samples of data to store
TIME_DIV = 150 'Time
delay between each sample (msec)
TRIG_POL = 0 'Trigger
polarity (0=pos, 1=neg)
'
'----- Test for enough memory to store waveform
-----
MEM_DATA = MEM_FREE -
PROG_LEN
'Memory available for data storage
IF MEM_DATA<SAMPLES
THEN CLS:BEEP:DISP "INSUFFICIENT":DISP
"MEMORY!":END
'
'---- Place Input parameters in memory locations
for Digital Capture subroutine to use
'
DATA_SEG=INT(PROG_SEG+(PROG_LEN/16)+1)
'Location for data storage
POKE
17EH,(DATA_SEG-(INT(DATA_SEG/256)*256))
'(LSB) STORAGE SEG.
POKE 17FH,DATA_SEG/256
'(MSB)
'
POKE
17CH,(SAMPLES-(INT(SAMPLES/256)*256))
'(LSB) Number of
samples
POKE 17DH,SAMPLES/256
'(MSB)
'
COUNT=INT((TIME_DIV-8.1)/2.8114+0.5)+1
POKE
17AH,(COUNT-(INT(COUNT/256)*256))
'(LSB) Sample delay
POKE 17BH,COUNT/256
'(MSB)
'
'----- TRIGGER INFO -----
IF TRIG$=""
THEN POKE 179H,0:GOTO L0
'No trigger
'
IF TRIG$="EXT"
THEN POKE 179H,(60H OR (TRIG_POL*80H)):GOTO
L0 'External trigger
'
IF
LEFT$(TRIG$,1)="L" THEN GOTO L1
'Line trigger?
POKE 179H,40H:POKE
178H,VAL TRIG$
'Word trigger
GOTO L0
'
' ----- LINE TRIGGER -----
L1: TR_LINE =
VAL(RIGHT$(TRIG$,(LEN(TRIG$)-2)))
'Trigger line#
TR_PORT = INT
((TR_LINE-1)/8)
'Trigger Port#
POKE 177H,TR_PORT-5
X=(TR_LINE-1)/8
POKE 179H,((X-INT X)*8)
OR 20H OR (TRIG_POL*80H)
'
L0: SYS PROG_SEG,PROG_OFF
'Call assembly routine to capture data
'
BEG_ADDR=DATA_SEG*16
'Location of the beginning of the stored data
'
' At this point the captured digital information
is in memory (in binary format)
' beginning at memory location BEG_ADDR. If the
waveform is to be saved to a disk file,
' use the following routine:
'
'----- Store captured digital information to a
disk file (optional) -----
'(Note: If SAMPLES is larger than 32767, two
loops must be used)
OPEN
"DIGITAL.DAT",OUT
FOR I=0 TO (SAMPLES-1)
STORE PEEK(I+BEG_ADDR)
NEXT
CLOSE
/
NOTICE:
Every effort has been made to insure the accuracy
of the information contained in this document,
however
Y-tek is not responsible for any consequences
resulting from erroneous or inaccurate
information.
|