LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help using 2 ports on the PCI-6503 at the same time.

I use CVI 5.0 and Traditional DAQ library.

Here is what I am trying to do:

1)write a pattern to port PA and hold
2)wait for a second
3)read a bit from port PB

The problem I have is that when I go to read the bit on port PB the data on port PA does not remain as set. I need PA to stay set as I read the bit on PB. I would put this in a loop and change PA then read PB, etc...

This is my first experience with NI DAQ devices. It seems like I need to pre configure the ports then do the reads and writes in my loop. I'm just not sure which functions to use for this.

Here is what I am doing now which clears PA upon the PB read:

//Write current pattern to port PA
error = WriteToDigitalPort (1, "0", 8, 1, p
attern);

//Delay for appropriate amount of time for "match found" bit to possibly set
Delay(.0025);

//Read bit from test port PB bit 0
error = ReadFromDigitalLine (1, "1", 0, 8, 1, &lum_bit);
0 Kudos
Message 1 of 2
(3,003 Views)
Greetings,

The digital I/O chip used on the PCI-6503 is the 8255 PPI. With this chip, anytime a port is configured, all of its ports are reset. Thus, it is important to configure all of the ports that you will use before you write any data to them. The functions you are using are part of the Easy I/O for DAQ library. Each of these functions performs a configuration each time it is called. You will need to use the DIG_Prt_Config function to configure the device's ports at the beginning of your program. You can then call the DIG_In_Prt, DIG_In_Line, DIG_Out_Prt, and DIG_Out_Line functions throughout your application without the ports being reset.

Good luck with your application.

Spencer S.
0 Kudos
Message 2 of 2
(3,003 Views)