LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI-7342 Digital I/O example

Does anyone have an example of reading/writing to the Digital I/O ports on a PCI-7342? (2-Axis Stepper/Servo Controller with Digital I/O) I'm very new to Labview and am having difficulties using the labview environment commands.

Right now I have a simple setup where I have a framed sequence where I do the following in this order:
1. Configure port 1 as output
2. Write $FF to port 1
3. Configure port 1 as input
4. Display value of port 1

Of course, nothing lights up at all. I've tried changing the polarity and the MOMO values, but still no signs of life.

Can anyone help? Examples are preferrable :-}

Thanks,
Jeff
0 Kudos
Message 1 of 4
(2,923 Views)
What do you expect to read when you configure the port as an input - the values when the port was an output? Things do work that way. When you configure the port as an output, you should be able to see whatever you write at the output by using a scope or DMM but once you configure the port as an input, the only thing you'll read is externally applied digital signals. To test, you might want to loop back port 1 to port 2 or bit 0 of port 1 to bit 1 of port 1, etc.

p.s. Framed sequences are not necessary - just use the error in/out connections to enforce data flow. The program will be more readable if you and you should really be monitoring error conditions anyway.
0 Kudos
Message 2 of 4
(2,923 Views)
Dennis,

Good point. At the time, I was thinking that if I wrote to the port then immediately read it, the value would still be there. But now, I see what you mean.

But I still have some problems... Using the attached VI I don't know what the right sequence is for writing to the port. The problem is that the "Set I/O port MOMO" function doesn't seem to have any effect. However, when I flip the bits on the "Set I/O Port polarity" function it outputs to the port!

I though that the polarity function just determined what ON meant(i.e ON=0v or ON=+5V). Is this true? No matter how I set the MOMO, it doesn't seem to have any effect on the output. Only the polarity controls it.

Any ideas?
Jeff
0 Kudos
Message 3 of 4
(2,923 Views)
I can't open your VI becasue I'm still at 6.1 but I'll try to help. The way I understand the motion digital I/O, you should first set the bits of the port with the Set I/O Port Polarity, and then Set I/O Port MOMO should set the data. Do a simple test and set all the bits to be non-inverting. Then use Set I/O Polarity to set the bit values. Change only one bit at a time and if you set bit 0 of Must On to True, make sure bit 0 of Must Off is False. Then reverse the two. I don't know what will happen if both bits are set true.
0 Kudos
Message 4 of 4
(2,923 Views)