logo2.bmp (22582 bytes)

 

Low Cost Automated Testing

Home

FT-100a Functional Tester

Custom-Designed Test Systems

Feedback

Application Note #:  AN-0100-03

Subject:   Analog Bar Graph
Date Issued:   February, 1995
Product(s):   FT-100, FT-100a

 

Sometimes it is very convenient to be able to "see" a voltage change by using a bar graph. This simulates an analog meter and is often helpful when setting a voltage and especially when a voltage must be tuned for either maximum or minimum value. The following is a very simple routine that will display a voltmeter bar graph on the FT-100 LCD display. The first part of the routine is for setup purposes and should be placed near the beginning of your main program (before you call the subroutine METER). Any time you wish to use the bar graph, simply set up the input parameters for the subroutine and use the command CALL METER. The subroutine is set up to return only when the NO pushbutton is pressed.

The routine is very simple, and you should have no trouble customizing it for your particular applications. Be very careful to copy all commands and data statements exactly. The comments are only to clarify the routine and may be left out.

METER2 'Program name
'
     PROG_LEN=100              'Number of bytes in assembly program
'
'------ See if there is enough memory to load in assembly program ------
     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)
     IF LAB_BEG<(STR_BEG+PROG_LEN)+16 THEN BEEP:CLS:DISP:DISP "NOT ENOUGH":DISP " MEMORY!":END
'
     PROG_SEG=INT (STR_BEG/16)+1:PROG_OFF=0:ADDR=PROG_SEG*16    'Address for assemby routine
'
     FOR I=0 TO PROG_LEN:READ X:POKE (I+ADDR),X:NEXT            'Load in the assembly routine
'
     SYS PROG_SEG,PROG_OFF               'Call the assembly routine (set up LCD characters)
'
'---- These Data statements are the assembly routine ----
     DATA 199,6,108,1,118,4,187,45
     DATA 0,178,72,182,7,185,8,0
     DATA 154,104,10,0,192,138,194,230
     DATA 7,254,194,154,104,10,0,192
     DATA 46,138,7,230,135,67,226,232
     DATA 254,206,117,225,203
     DATA 16,16,16,16,16,16,16,0
     DATA 24,24,24,24,24,24,24,0
     DATA 28,28,28,28,28,28,28,0
     DATA 30,30,30,30,30,30,30,0
     DATA 31,31,31,31,31,31,31,0
     DATA 16,16,16,31,0,0,0,0
     DATA 1,1,1,31,0,0,0,0
'-------------------------------------------------------
'
'
' This section sets up the parameters for calling the METER subroutine. These
' parameters may be set anywhere in your program as long as they are set prior
' to calling METER. Be sure parameters are within their limits, also V_MIN must
' be less than V_MAX.
'
     LINE=9        'LINE is the analog input line in module A (9-16)
     V_MIN=0       'V_MIN is the low end of the voltage scale to be displayed (0-10)
     V_MAX=10      'V_MAX is the high end of the voltage scale to be displayed (0-10)
'
     CALL METER    'Call bar graph display subroutine. This command can be anywhere.
'
     END
'
'
'---------- Bar graph voltmeter display subroutine -----------
'
'   This subroutine should be place in a location where it will not interfere with your
'   main program, such as at the end of the main program.
'
METER: CLS:CURSOR 2,1:DISP CHR$ 6;"------+------";CHR$ 7    ' This section sets up
       DISP RIGHT$ (STR$ V_MIN,(LEN STR$ V_MIN-1));         ' the voltmeter scale
       V$=RIGHT$ (STR$ V_MAX,LEN STR$ V_MAX-1)              ' on the LCD display.
       DISP TAB (16-LEN V$);V$                              ' It could be changed
       INCR_S=(V_MAX-V_MIN)/75:INCR_L=INCR_S*5              ' to suit your needs.
       CUR=1:PTR=1
'
L6:  V_OLD=V
L5:  IF NO THEN RETURN             'If NO is pressed, get out of subroutine
     V=AA(LINE)                    'Read analog input line (Note: Change for different module)
     IF V=V_OLD THEN GOTO L5       'If voltage reading is same as last reading, do nothing
'
     CURSOR 4,1:DISP V;TAB 11;"volts";        'Display voltage (Character display)
'
'--- See if voltage is within scale of meter
     IF V<V_MIN THEN CLS 1:DISP CHR$ 127;:GOTO L6
     IF V>V_MAX THEN CURSOR 1,1:FOR I=1 TO 15:DISP CHR$ 5;:NEXT:DISP CHR$ 126;:GOTO L6
'
'--- Display bar graph of voltage
     VV=V-V_MIN:CURSOR 1,1:CUR=1
L7:  IF VV>INCR_L THEN DISP CHR$ 5;:VV=VV-INCR_L:INC CUR:GOTO L7
     DISP CHR$ (INT (VV/INCR_S));
     FOR I=CUR TO 15:DISP " ";:NEXT
     GOTO L6
/

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 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