Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQPad 6507 and VB6

Trying to configure and write to two ports as outputs on daqpad 6507 using vb6.

First use DIG_SCAN_Setup (iDevice%,iGroup%,iGroupSize%,
iPortList%(0),iDir%)to configure ports.

idevice=1 'from MAX
igroup=1 'arbitrary def
igroupsize=2 'num of ports
iportlist(0)=0, iportlist(1)=1 'for ports 0 and 1. This is APA and APB respectively.
idir=1 'for output port.

This executes without error and if it is called again indicates config already has taken place. Call with group size 0 to "unconfig"

So far so good. Now use _Block_Out(iDevice%, iGroup%, piBuffer%(0),ulCount&)

piBuffer(0)=15 '(0xF)
piBuffer(1)=255 '(0xFF)

for data output of 0xFFF. this executes without error also. Then call
DIG_Block_Check(iDevice%, iGroup%, ulRemaining&)


ulRemaining& initially=1

in a loop but the problem is that ulRemaining stays=1 forever. Also trying to read inputs on ports 3 and 4 wired to these port 0 and 1 outputs using DIG_Block_In. Always returns zero and has same ulRemaining issue as DIG_Block_Out.

Appreciate any help. Thank you, Rick Beauchaine
0 Kudos
Message 1 of 2
(3,256 Views)
Hey Rick,


I think that you should be good to go, however I am posting a response just so that there is an answer up in case someone has the same problem in the future.



The reason that we are seeing this behavior is that these calls set up the DAQPad for handshaking. If you do not provide the appropriate handshaking signals, then the board will not output any data and will never reach a ulRemaining of zero. If you are not looking to do handshaking, then you should use the following shipping example

C:\Program Files\National Instruments\NI-DAQ\Examples\VBasic\Do\DOonePort.VBP

If you are looking to do handshaking, here is an example is written in C, but the calls are the EXACT same, just a slightly different syntax. The file that you want to look a
t in the ZIP file is DOsingleBufHandshake8255.c.

Link to 8255 example program
http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3EB5F56A4E034080020E74861&p_node=DZ52320&p_source=External


Also, if ulRemaining is returning 1 forever, perhaps we should check our handshaking signals. For good information on connecting the signals, we can refer to the DIG_SCAN_Setup documentation in the Traditional NI-DAQ Function Reference Help.

Traditional NI-DAQ Function Reference Help
C:\Program Files\National Instruments\NI-DAQ\Docs\nidaqpc.chm

Another great resource for handshaking signals is the user�s manual.

DAQPad User�s Manual
http://www.ni.com/pdf/manuals/321724b.pdf

Best regards,

Justin T.
0 Kudos
Message 2 of 2
(3,256 Views)