Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

32 Digital lines read simultaneously

I have a following question:

A this time i can read one single port of NI6507 configured as input, enough faster
for my input signal (I read up to 10 Khz TTL square wave on single line), with the following
instruction DIO_err = DIG_In_Port(1, 0, a%). But unfortunately i must read 32
digital lines simultaneously whose maximum frequency is 2.5 KHz.
I need some instruction that it allows me to read 32 inputs simultaneously,
because i have seen in some experiments that if i use the instruction DIG_In_Port
i can't read the 2, 3 and 4 ports at the same time of the 1 port.

My sytem is configured as below:


Pentium 3
Windows NT os
NI6507
I drive the ni6507 with Visual Basic 6.0 and daq32.dll.

Thanks.
0 Kudos
Message 1 of 5
(3,784 Views)
Hi,

What is probably happening is that the ports are being reset. The 8255 chip used in the NI 6507 has 4 chips and if you read from a port on a chip before you configure the other ports on the chip, all the chip's ports will reset. I included a link to a knowledge base describing this below. However, you should be able to do the following:

iStatus = DIG_Prt_Config(iDevice, iPort0, iMode, iDir);
iStatus = DIG_Prt_Config(iDevice, iPort1, iMode, iDir);
iStatus = DIG_Prt_Config(iDevice, iPort2, iMode, iDir);
iStatus = DIG_Prt_Config(iDevice, iPort3, iMode, iDir);

iStatus = DIG_In_Prt(iDevice, iPort0, &iPattern);
iStatus = DIG_In_Prt(iDevice, iPort1, &iPattern);
iStatus = DIG_In_Prt(iDevice, iPort2, &iPattern);
iStatus = DIG_In_Prt(iDevice, iPo
rt3, &iPattern);

I haven't tried this code but it should do the trick. Let me know if this helps or not and I'll try testing it out on my board. Have a good day.

Why Do All My Digital I/O Ports Reset When I Configure One Port?
http://digital.ni.com/public.nsf/websearch/3E25A9780F2C48B986256120005AF098?OpenDocument

Ron
Message 2 of 5
(3,784 Views)
Hi Ron, unfortunately I have previously did that You say, in my program I have already used DIG_Prt_Config
I have put this instruction (for each port obvious)
in the "form load sub" (I use Visual Basic) and I use DIG_In_Prt for read the state of each port (I have put this instruction in one command button).
Say You that I must repeat all instruction (DIG_Prt_Config + DIG_In_Prt) for each read-cycle?
Say me more.


Now i have found one example program named DIsingleBufHandshake8255.
Because the nunmber of event that i need to capture are 4096 and I have a strobe signal I have used this example.
I have configured the card as follow: iStatus% = DIG_SCAN_Setup(1, 1, 4, 0, 0) (where 4 is the groupsize) but I have seen that the groupsize is maximum = 2
, if I put one number > of 2 one error was generated despite the help about this instruction say:

"groupSize selects the number of 8-bit ports in the group.
Range: 0 through 2 for most devices.
0 through 8 for the DIO-96."

at the end I are able to read only two ports simultaneously. ( i need to read 4 ports simultaneously= 32 bit)

Can You help me?

Thanks
0 Kudos
Message 3 of 5
(3,784 Views)
Hi,

Sorry for the late reply. To answer your first question, you shouldn't need to repeat the instruction for each read cycle. Only once at the beginning but all ports together.

To answer your second question, it seems odd that it won't allow you to configure a larger groupsize than 2. Try running this first example code I found but adjust the group size to 4 to see if it works. The second example might be better since the author designed it with a PCI-DIO-96 with a group size of 8. That should help.

Using DAQ Event 8 to Send a Message When a Digital Pattern is Matched in Visual C++
http://venus.ni.com/stage/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3E22F56A4E034080020E74861&p_node=DZ52334&p_submitted=N&p_rank=&p_answer=&p_
source=Internal

Using Multiple DAQ Events with an NI 6508 (DIO-96) Device
http://venus.ni.com/stage/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3E6FD56A4E034080020E74861&p_node=DZ52319&p_submitted=N&p_rank=&p_answer=&p_source=Internal

Ron
0 Kudos
Message 4 of 5
(3,784 Views)
Hi Ron, I reading now (09/02/2003) Your answer, but unfortunately I�m not able open the link that You have displayed in Your message.

Thanks anyway.
0 Kudos
Message 5 of 5
(3,784 Views)