logo2.bmp (22582 bytes)

 

Low Cost Automated Testing

Home

FT-100a Functional Tester

Custom-Designed Test Systems

Feedback

Application Note #:  AN-0100-07

Subject:   Storing Waveforms in the FT-100
Date Issued:   May, 1995
Product(s):   FT-100, FT-100a

 

Many times it would be beneficial to capture and store a waveform (or continuously changing DC voltage) to be viewed or analyzed later, either by the test program or the operator. A digital storage oscilloscope (DSO) can accomplish this very easy. With the FT-100 controlling the scope through the RS-232 port, waveforms may be downloaded and analyzed as needed. The only problem with this scenario is that most DSO's are relatively expensive and aren't always available when needed.

This application note describes a simple FT-100 software routine that may be used to capture a waveform and optionally store it on disk. The waveform is stored in an ASCII format that is recognized by most graphing, spreadsheet, and data analysis programs. Once captured, the waveform can be analyzed by the FT-100 just as easily. This routine is very flexible and can be easily modified for each given application.

The FT-100 could never compete with a high-speed DSO, but for some limited applications, the ability to store and analyze a waveform, coupled with all the other features of the FT-100, gives you a very inexpensive method of data analysis. For many tasks, a high-priced DSO cannot be justified, but the ability to record a waveform could make the test job a lot easier and more thorough.

Possible Applications

- Low frequency audio analysis.
- DC pulse-width measurements.
- RC time-constants - This could be used to roughly read a capacitor or resistor value.
- Waveform comparisons.
- Power supply rise and fall time.
- Low-frequency distortion analysis.
- Switch "bounce" characteristics.
- "Peak" voltage measurements.

Features

- 12-bit analog input.
- Any expansion module analog input line may be used for the waveform input.
- Triggering may be from any of the following sources:
       Analog input line (trigger voltage may be set).
       Digital input line (can be any digital input line, including those in the main unit).
       Trigger polarity may be positive or negative (for analog or digital trigger inputs).
- 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.
- Waveform may be stored on a floppy disk. Data is stored in ASCII format that is readable by
   most data analysis programs and spreadsheets.
- Waveform may be stored in an array for analysis by the FT-100 program.
- Normally, several thousand data points can be stored (up to over 60,000!).

Limitations

Because the FT-100 was not designed specifically to be a digital oscilloscope, there are some limitations that you must keep in mind before, and during, implementation of this routine:

- Only analog I/O Expansion Modules may be used for the waveform input. The main unit cannot
   be used.
- The smallest sample speed allowed is 42
msec. per sample.
- The time between each sample is always in increments of around 2.8
msec.
- During waveform recording, the FT-100 cannot perform other tasks.

How the Waveform Capture Routine Works

The real work is done inside the assembly subroutine to maximize speed and efficiency. When keying in the assembly routine data statements, be very careful! It is very easy to key in an incorrect data number. After the program loads in the assembly subroutine, the parameters for the waveform capture routine are set. Your particular application will most likely determine how and when these parameters should be set. The parameter information is passed to the assembly routine by placing the information in a given section of RAM (through POKE commands). After all the parameter information is placed in RAM, the assembly subroutine can be "called" at any time. The assembly subroutine stores the waveform in memory and returns to the main program.

After the waveform data has been stored in memory, it can then be stored to a disk file, sent out the serial port, or saved in an array for processing and analysis within the FT-100. In order to save the information in an array, place the following set of commands after the SYS command that calls the assembly subroutine (Note: If an array is used to store the data, it must be dimensioned at the beginning of the program.):

BEG_ADDR=DATA_SEG*16     'Address in RAM of the beginning of the data
S1 = F_SCALE/((1+(RES*15))*256):S2 = REF*(F_SCALE/2) 'Voltage scaler multipliers
FOR X=0 TO (SAMPLES-1)
A(X) = S1 * (PEEK(I+BEG_ADDR)+PEEK(I+BEG_ADDR+1)*256) - S2
INC I : NEXT

There are several commands that calculate and process information to be placed in the FT-100 operating system. These appear confusing, and probably don't make much sense, but they are necessary for the assembly routine to operate most efficiently.

When keying in this program, the comments may be omitted as you see fit. They are there only to help clarify the program operation.

WAVE_1 'Program Name
     PROG_LEN= 170  'Number of bytes in assembly program
'
'--- Test for enough memory to load in 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         'Total available memory
     IF PROG_LEN>MEM_FREE THEN BEEP:CLS:DISP:DISP "INSUFFICIENT":DISP "MEMORY!":END
'
     MEM_DATA = MEM_FREE - PROG_LEN 'Memory available for data storage
'
'--- Read in assembly routine & store in memory ---
     PROG_SEG=INT (STR_BEG/16)+1:PROG_OFF=0
     ADDR=PROG_SEG*16
     FOR X=0 TO PROG_LEN:READ D:POKE (X+ADDR),D:NEXT 'Load assembly program
'
'----------------- Assembly Program DATA statements ----------------------
     DATA 1EH,2BH,0D2H,8EH,0DAH,0BEH,74H,1
     DATA 0FFH,34H,46H,46H,8BH,0CH,46H,46H
     DATA 8BH,1CH,46H,46H,8AH,14H,46H,8BH
     DATA 2CH,46H,46H,8AH,24H,46H,8BH,3CH
     DATA 8EH,0DFH,2BH,0FFH,5EH,8AH,0C7H,0EEH
     DATA 0B0H,1EH,0FEH,0C8H,75H,0FCH,0F6H,0C3H
     DATA 1,75H,29H,0F6H,0C3H,2,75H,45H
     DATA 0E8H,11H,0,89H,5,0E2H,2,1FH
     DATA 0CBH,47H,47H,8BH,0C6H,2DH,1,0
     DATA 75H,0FBH,0EBH,0ECH,8AH,0C7H,0EEH,42H
     DATA 0B0H,10,2CH,1,75H,0FCH,0ECH,8AH
     DATA 0E0H,4AH,0ECH,0C3H,51H,0E8H,0ECH,0FFH
     DATA 8BH,0C8H,0E8H,0E7H,0FFH,0F6H,0C3H,80H
     DATA 74H,0BH,3BH,0C5H,73H,0F2H,2BH,0E9H
     DATA 73H,0EEH,59H,0EBH,0C6H,3BH,0C5H,76H
     DATA 0E7H,3BH,0CDH,0EBH,0F3H,51H,52H,8AH
     DATA 0D4H,8AH,0CCH,80H,0E1H,7,0B4H,1
     DATA 0D2H,0E4H,0B1H,4,0D2H,0EAH,0ECH,22H
     DATA 0C4H,8AH,0E8H,0ECH,22H,0C4H,3AH,0C5H
     DATA 74H,0F9H,8AH,0E8H,0F6H,0C3H,80H,75H
     DATA 2,32H,0C4H,3CH,0,75H,0ECH,5AH
     DATA 59H,0EBH,8DH
'-----------------------------------------------------------------------------------
'
'----- Set variables before calling the waveform capture subroutine -----
' (NOTE: There are no checks for correct data form. All alpha characters
' MUST be capital letters. This should be no problem since the
' input information is created in your program.)
'
     ANA_IN$ = "AB6" 'Analog input line used to input waveform
     SAMPLES = 1000 '# of sample of data to store
     TIME_DEL = 100 'Time delay between each sample (msec)
     TRIG$ = "AB6" 'Trigger source -(analog, digital, "" = none)
     TRIG_POL = 0 'Trigger polarity (0=pos, 1=neg)
     TRIG_V = 2.5 'DC trigger voltage (volts) <optional>
'
'
'---- Place information in memory locations for waveform capture routine to use ----
'
' Set the location for the beginning of data storage
     DATA_SEG=INT(PROG_SEG+(PROG_LEN/16)+1)
     POKE 17EH,(DATA_SEG-(INT(DATA_SEG/256)*256))     '(LSB) Storage segment
     POKE 17FH,DATA_SEG/256                         '(MSB)
'
      POKE 176H,(SAMPLES-(INT(SAMPLES/256)*256))      '(LSB) # of samples
     POKE 177H,SAMPLES/256                      '(MSB)
'
     COUNT = INT((TIME_DEL-42.2)/2.79611+0.5)+1
     POKE 174H,(COUNT-(INT(COUNT/256)*256))          '(LSB) Delay between each sample
     POKE 175H,COUNT/256                             '(MSB)
'
     ANA_MOD = ASC(MID$(ANA_IN$,2,1))-41H      'ANALOG MODULE# (0-7)
     DL=PEEK ((ANA_MOD-1)*2+14H)               'DL, DH = Module configuration data
     DH=PEEK ((ANA_MOD-1)*2+15H)
     RES = (DL AND 80H)/80H                    'Analog Resolution (0=8-BIT, 1=12-BIT)
     REF = (DL AND 40H)/40H                    'Analog Reference (0=0V, 1=+/-V.)
     F_SCALE = 5+((DH AND 8)/8*5)              'Full-scale analog voltage
'
     POKE 17AH,(ANA_MOD*16) OR (DL AND 0FH)        'Set Analog in/out address
     POKE 179H,(VAL(RIGHT$(ANA_IN$,(LEN ANA_IN$-2)))-(2*(DH AND 7)))-1 'Analog line#
'
' ----- Set up the trigger information -----
     TRIG=TRIG_V
     IF REF=1 THEN TRIG=TRIG+F_SCALE:F_SCALE=F_SCALE*2
     X = ((256*((RES*15)+1))/F_SCALE)*TRIG
     POKE 17BH,(X-(INT (X/256)*256))            '(LSB) Trigger Voltage
     POKE 17CH,X/256                            '(MSB)
'
     TRIG = 0
     IF TRIG$="" THEN GOTO L0                         'No trigger
     IF TRIG$=ANA_IN$ THEN TRIG=TRIG OR 1:GOTO L0     'Analog trigger
'
     TRIG=TRIG OR (ASC(MID$(TRIG$,2,1))-41H)16)
     LINE_NUM = VAL(RIGHT$(TRIG$,(LEN(TRIG$)-2)))     'Digital trigger line#
     X = ((LINE_NUM-1)/8)-(DL AND 0FH)
     PORT = INT X                                     'Ttrigger port#
     LINE = (X-INT X)*8                               'line# in the digital port
     POKE 17DH,(PORT*16 OR LINE)                      'Digital trigger port# & line#
'
L0:  TRIG=TRIG+(TRIG_POL*80H)              'Trigger polarity
     POKE 178H,(TRIG OR 2)                 'Trigger source
'
'
'-------- Test for enough memory to store waveform ----------
     IF MEM_DATA < (RES+1)*SAMPLES THEN BEEP:CLS:DISP "INSUFFICIENT":DISP "MEMORY!":END
'
     SYS PROG_SEG,PROG_OFF 'Call the assembly subroutine
'
' At this point the waveform is in memory. If the waveform is to be saved to the disk,
' use the following routine:
'
     BEG_ADDR=DATA_SEG*16             'Address in RAM of the beginning of the data
     S1 = F_SCALE/((1+(RES*15))*256): S2 = REF*(F_SCALE/2)   'Voltage scaler multipliers
     OPEN "TRACE",OUT                  'Open the disk file
     FOR I=0 TO (SAMPLES-1)
     STORE S1 * (PEEK(I+BEG_ADDR)+PEEK(I+BEG_ADDR+1)*256) - S2
     INC I : NEXT
     CLOSE                             'Close the disk file
'
/

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.

go to
Frequently Asked Questions
go back to
Application Notes
go to
Home Page

 

Home

FT-100a Functional Tester

Custom-Designed Test Systems

Feedback

Y-tek, Inc.    851 Seton Court, Suite 1B, Wheeling, IL 60090        Phone: (847) 436-9835

Y-tek, FT-100 and FT-100a are trademarks of Y-tek, Inc. and may not be reproduced in any way without express
permission from Y-tek, Inc.  Any questions regarding this web site should be directed to
info@Y-tek.com