01-30-2004, 03:38 AM
Hi All,
I am trying to capture data from an Advantech PCI-1710 DAS card and am having a little trouble. The data I am trying to read resides in two 8-bit wide registers, but I find that only the first one I read is valid (ie I can see it change as my A/D input changes). Here is my full program listing
'A program to validate the A/D capabilites of an Advantech PCI-1710
'DAS card.
CONST b = &HE400 'pci-1710 base address
CONST a2dlow = b + 0 'result low byte
CONST a2dhigh = b + 1 'result high byte
CONST a2drange = b + 2 'channel range
CONST a2dmuxstart = b + 4 'mux scan start channel
CONST a2dmuxstop = b + 5 'mux scan stop channel
CONST a2dcontrol = b + 6 'a/d control bits
CONST a2dstatus = b + 7 'a/d interrupt and FIFO status
CONST a2dinterrupt = b + 8 'clear interrupt
CONST a2dfifo = b + 9 'clear FIFO
OUT a2dmuxstart, 0 'channel 0
OUT a2dmuxstop, 0 'channel 0
OUT a2drange, 4 'range [-10,+10]
OUT a2dmuxstart, 0 'added due to confusion regarding setting
OUT a2dmuxstop, 0 'the gain before the mux channels
OUT a2dcontrol, 0 'disable int and sw trigger
OUT a2dfifo, 0 'clear fifo
OUT a2dinterrupt, 0 'clear interrupt
DO
OUT a2dcontrol, 17 'enable int and sw
OUT a2dlow, 0 'start conversion
WAIT a2dstatus, 8 'wait for interrupt
OUT a2dcontrol, 1 'disable int
PRINT INP(a2dhigh), INP(a2dlow)
PLAY "n0"
PLAY "L64T255"
OUT a2dinterrupt, 0 'clear interrupt
OUT a2dfifo, 0 'clear fifo
LOOP UNTIL INKEY$ <> ""
What I would like to be able to do is read a2dhigh and a2dlow in one operation (they are stored in a 16-bit wide fifo) to see if that fixes the problem. Is there any way to grab 16-bits in one operation using QB? Sorry if this is a simplistic question but I am a QB n00b. Any help would be greatly appreciated...
I am trying to capture data from an Advantech PCI-1710 DAS card and am having a little trouble. The data I am trying to read resides in two 8-bit wide registers, but I find that only the first one I read is valid (ie I can see it change as my A/D input changes). Here is my full program listing
'A program to validate the A/D capabilites of an Advantech PCI-1710
'DAS card.
CONST b = &HE400 'pci-1710 base address
CONST a2dlow = b + 0 'result low byte
CONST a2dhigh = b + 1 'result high byte
CONST a2drange = b + 2 'channel range
CONST a2dmuxstart = b + 4 'mux scan start channel
CONST a2dmuxstop = b + 5 'mux scan stop channel
CONST a2dcontrol = b + 6 'a/d control bits
CONST a2dstatus = b + 7 'a/d interrupt and FIFO status
CONST a2dinterrupt = b + 8 'clear interrupt
CONST a2dfifo = b + 9 'clear FIFO
OUT a2dmuxstart, 0 'channel 0
OUT a2dmuxstop, 0 'channel 0
OUT a2drange, 4 'range [-10,+10]
OUT a2dmuxstart, 0 'added due to confusion regarding setting
OUT a2dmuxstop, 0 'the gain before the mux channels
OUT a2dcontrol, 0 'disable int and sw trigger
OUT a2dfifo, 0 'clear fifo
OUT a2dinterrupt, 0 'clear interrupt
DO
OUT a2dcontrol, 17 'enable int and sw
OUT a2dlow, 0 'start conversion
WAIT a2dstatus, 8 'wait for interrupt
OUT a2dcontrol, 1 'disable int
PRINT INP(a2dhigh), INP(a2dlow)
PLAY "n0"
PLAY "L64T255"
OUT a2dinterrupt, 0 'clear interrupt
OUT a2dfifo, 0 'clear fifo
LOOP UNTIL INKEY$ <> ""
What I would like to be able to do is read a2dhigh and a2dlow in one operation (they are stored in a 16-bit wide fifo) to see if that fixes the problem. Is there any way to grab 16-bits in one operation using QB? Sorry if this is a simplistic question but I am a QB n00b. Any help would be greatly appreciated...