rpozos@umn-d-ub.D.UMN.EDU (Robert Pozos) (02/27/88)
I hope someone can enlighten me as to what is going on. I have a VAXLAB
system based on the VAXSTATION II/GPX hardware with the LABSTAR
software. I am trying to sample 8 channels of data with a sine-wave
generator set at 10 hz. on channel 0 (first A/D channel). The following
code is what I am using for this. It runs ok, however when I plot the
results of the data acquisition, I see the sine wave on the second
channel (starting at point 2 of the array instead of point 1). IS there
something I am missing about the way the array is mapped in memory?
Perhaps someone from DEC could respond who is familiar with these
products.
Brad Ingersoll
UMD School of Medicine
Dept of Physiology
Duluth MN
PROGRAM TEST
C
INCLUDE 'sys$library:LIOSET.FOR' !LIO$SET_I symbol definitions
INTEGER*2 ADBUF1(numpts+256)
INTEGER device_id !A/D device ID variable
INTEGER clk_ID !clock device ID variable
INTEGER data_length !number of data points read
INTEGER status !status returned by LIO calls
REAL RATE
C Attach to the clock
C Gets a device ID for the KWV and tells LIO to use QIO I/O
C
status = LIO$ATTACH(clk_ID, 'KZA0', LIO$K_qio) !attach to kwv
IF(.NOT.(status)) CALL lib$signal(%val(status))
status = LIO$SET_R(clk_ID, LIO$K_CLK_RATE, 1, rate)
IF(.NOT.(status)) CALL lib$signal(%val(status))
status = LIO$SET_I(clk_ID, LIO$K_FUNCTION, 1, LIO$K_REP_COUNT)
IF(.NOT.(status)) CALL lib$signal(%val(status))
status = LIO$SET_I(clk_ID, LIO$K_TRIG, 1, LIO$K_IMMEDIATE)
IF(.NOT.(status)) CALL lib$signal(%val(status))
C
C Set up the A/D
C synchronous interface (LIO$READ)
C
status = LIO$ATTACH(device_id,'AZA0', LIO$K_MAP)
IF(.NOT.(status)) CALL lib$signal(%val(status))
STATUS = LIO$SET_I(device_id,LIO$K_SYNCH,0)
IF(.NOT.(status)) CALL lib$signal(%val(status))
status = LIO$SET_I(device_id, LIO$K_AD_CHAN, 8,0,1,2,3,4,5,6,7)
IF(.NOT.(status)) CALL lib$signal(%val(status))
status = LIO$SET_I(device_id, LIO$K_AD_GAIN, 8,1,1,1,1,1,1,1,1)
IF(.NOT.(status)) CALL lib$signal(%val(status))
status = LIO$SET_I(device_id, LIO$K_TRIG, 2,
1 LIO$K_CLK_SWEEP, clk_ID)
IF(.NOT.(status)) CALL lib$signal(%val(status))
isamples=numpts*2
do 108 i=1,numfrm
print *,' processing frame number ',i
C
CALL LIB$INIT_TIMER
status = LIO$READ(device_id,ADBUF1,isamples,DATA_length,)
IF(.NOT.(status)) CALL lib$signal(%val(status))
C
CALL LIB$SHOW_TIMER
C
WRITE(1'FRAME)ADBUF1
C TYPE 10
C TYPE 12,FRAME
108 continue
status = LIO$DETACH(device_id, )
IF(.NOT.(status)) CALL lib$signal(%val(status))