test adc24.txt

Warning: if you clip this code into your program, look out for possible html code slipping in.

REM   VAST ADC24 Test Program
REM
REM   Demonstration program to test VAST ADC24 peripheral board.
REM
REM   Author: Steven R. Wheeler
REM
REM   Copyright 1999 Vesta Technology, Inc.
REM   All rights reserved.
REM
REM   Revision history:
REM     6 Aug 1999   First revision.


REM   Include the support routines (presuming revision 4 of VSTB).

INCLUDE "VAST ADC24.TXT"


GLOBAL fvalue AS FLOAT, value AS INTEGER
GLOBAL channel AS INTEGER


REM   Set up for a mode 3 clock

VAST_CLOCK(3)

REM   Initialize board 0 for normal operation, gain =1, 10Hz updates,
REM   24-bit results, unipolar single-ended conversions
Init_VADC24(0, M_Normal, 1, 10.0, 24, 1, 0)

REM   Calibrate each channel with a one-step self-calibration
FOR channel = 0 TO 5
	Calibrate_VADC24(M_Cal_Self, channel, 0)
NEXT

REM   Clear the screen
PRINT "\027[2J"


DO WHILE 1
	REM   Home the cursor
	PRINT "\027[01;01H"

	FOR channel = 0 TO 5
		PRINT "\013\010Channel:", channel
		REM   The worst-case settling time for a full-scale step
		REM   change in inputs is 4x the conversion period. With
		REM   the test setup, discarding 1 reading is sufficient.
		fvalue = AIN_VADC24(channel)
		fvalue = AIN_VADC24(channel)
		value  = fvalue
		PRINT "\009", fvalue, "   "
		PRINT "\009", value, "   "
	NEXT channel
LOOP

 

VestaTech Home

© 2002 Vesta Technology