Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Help needed: Digital IO with 6537

Hello,

 

I am new to LabView Digital IO so my question probably sounds a bit simple to most of you guys here. Anyway here is what I need to do.

 

I have a PXIe 6537 card which we want to use to read digital data. The flow chart goes like

 

1. Check line PFI 2 to see if we have a low. If not, keep checking.

2. If PFI 2 has a low, go ahead read 1 sample data of 32 bits from Port 0-3. (i can read a static data with no problem)

3. After read data, generate Reset on PFI 3 (a pulse low).

4. Repeat step 1 to 3...

 

With all the info on the 6537 programming, it's quite overwhelming to me. Can anyone give me some suggestion on how to do the timing and how to set those channels?

 

Any help would be greatly appreciated!

 

Thanks

 

Harry

0 Kudos
Message 1 of 20
(5,434 Views)

Hi Harry, 

 

Have you looked at any of the shipping examples that came with LabVIEW?  I would suggest starting there, and in specific the Read Dig Chan-Int Clk-Dig Ref.vi.  This can be found by going to Help»Find Examples»Hardware Input and Output»DAQmx»Digital Measurements.  

 

As noted in the VI description, this VI will take a finite number of samples once an external reference trigger has been detected, which would be your PFI2. Take a look at the example and how it works and see if you can use it as a jumping off point for your project.

 

Regards,

 

Kyle S 

Regional Account Manager
NI
0 Kudos
Message 2 of 20
(5,347 Views)

Kyle,

 

It's you again! You gusy get any credits from answering questions here? If so let me know I will be more than happy to do that!

 

Anyway back to my questions... Yes I've been studying those examples but they are not that straightforward, or because of my lack of training in these topics. At the beginning, I tried to use the "Handsharke timing" as essentially my application matches this timing: 1. wait for trigger indicating data's ready; 2. read data from channel; 3. send out reset/acknowleadge pulse to DUT; 4. repeat...  But I found these problems:

 

1. In the Handshacking Input 8255.vi, there is no external trigger been applied, then how it knows the data is ready?  I would intuitively think there should be wiring terminal on the DAQmx Timing vi, but there is not. Do i have to use Daqmx trigger property node to set things up?

 

2. In terms of hardware connection, on my testing board the PFI2 is connected to DUT request line, and PFI3 is connected to reset DUT. But in the help doc, it says 6537 has default trigger on PFI0 and even on PFI1. Do i have to change my hardware connection or i can change these by some other property node?

 

Can you help me answer these questions? Thanks

 

Harry

0 Kudos
Message 3 of 20
(5,343 Views)

Hi Harry, 

 

It is me!  So the examples you are looking at are for a specific I/O Microcontroller, the 8225.  These examples assume that the handshaking will happen on the same line, which is typical for newer digitial communication.  What you are referring to is more like the older 3 wire handshake that took place in GPIB protocol which is why I mentioned modifying one of the Dig Start examples.

 

If I were to approach this problem I would set up two tasks, a Digital Input and a Digital Output.  On the digital input task I would set up a digital Start Trigger to begin the aquisition.  I would set the timing to be finite and have only one sample to read.  Then use the DAQmx Trigger Property Node to allow the Start Trigger to be Retriggerable.  And finally I would have the read inside a while loop that executes before the second task, the write function.  I have wired up a simple example vi shown in the snippet below.

 

Retriggerable Dig Read.png

 

However with your particular system, I think you would benefit from using one of our Development Zone Examples focused on Handshaking on the 6537.  It may look daunting at first but it has everything that you will need to get your program up and running, along with some extra settings.  Please find the link below and let me know if you have any questions!

 

Continuous Read Digital Channel - Piplelined Sample Clock with Handshaking

https://decibel.ni.com/content/docs/DOC-12377

 

Regards, 

 

Kyle S

Regional Account Manager
NI
Message 4 of 20
(5,331 Views)

Hi Harry, 

 

After looking into this a bit more I realized that I was incorrect in my information on 8255.  This is actually a handshaking protocol that can be used for your DUT.  Please find some of the help documentation I was reviewing below.

 

Handshake (8255) Sample Timing Type

http://zone.ni.com/reference/en-XX/help/371893D-01/6536and6537help/handshaking_timing_type/

 

Default communication terminals, that can be changed with the use of property nodes.

http://zone.ni.com/reference/en-XX/help/371893D-01/6536and6537help/programming_handshake/

 

With the 8255 protocol the steps are:

 

1. 6537 pulls acq line low.
2. Device puts data on bus.
3. Device pulls rec line high.
4. 6537 reads data and then pulls the acq line high
5. Device waits for that high pulse and pulls low its rec.
6. Repeat

 

Does this match your application?  

 

Regards, 

 

Kyle S

Regional Account Manager
NI
0 Kudos
Message 5 of 20
(5,321 Views)

Kyle,

 

Thanks so much for taking time creating this vi!!!  I'll study your example later today and for sure will get back to you with new questions!!!

 

BTW, I'm thinking taking some class of Labview DAQ and stuff. Does NI provide this kind of training? Do you have any recommendation for that? I guess some short class like several days or a week will be best for my schedule. Thanks!

 

Rgds,

 

Harry

0 Kudos
Message 6 of 20
(5,319 Views)

Hi Harry, 

 

Sounds great, just let me know if you have any further questions!  And yes of course we do! We have a ton of LabVIEW/DAQ Core classes that are taught all over the country as well as online.  I have included the link below to get to training portion of our website where you will be able to browse on site facitlities close to you or see when the next online class is being held.  Definitely check it out as it will be a great tool for you moving forward in LabVIEW!

  

http://www.ni.com/training/

 

Regards,

 

Kyle S

Regional Account Manager
NI
0 Kudos
Message 7 of 20
(5,315 Views)

Hi Kyle,

 

I tried your approach (first one with the Sample Clock Timing) yesterday but it had issue with the timing type and DO - it can read but then showing error on writing PFI3. I tried a few times then gave up on using the approach below. In this one, i have to open and close tasks every cycle so i think it probably slows down the IO speed. Can you let me know if you have any comments?

 

0721.jpg

 

Right now seems the reading data part is working although might not be optimal. We need to do some data calculation/processing/plotting at the same time, meaning maybe running 2 threads at the same time? One thread reads data, the other one process the data. Apparentely I don't know much about thread handling in Labveiw, so any quick start suggestion?

 

Thanks for the training info. I will take one for sure.

 

Rgds,

 

Harry

0 Kudos
Message 8 of 20
(5,302 Views)

Hi Harry, 

 

By leaving the create, timing, start, and clear tasks outside of the loop and only calling them once will alleviate this.  Basically take your code and structure it similar to my example above.  You will only need a flat sequence structure for the Read, Wait, and Write DAQmx VI's.  

 

Regards,

 

Kyle S 

Regional Account Manager
NI
0 Kudos
Message 9 of 20
(5,294 Views)

Kyle,

 

As expected, I am having other problems now :). Right now I am ok with collecting data part of the code, but I need to store the data everytime the trigger is set (meaning a new data is available) and later we need to analysis the collected data on both channels. Essentially I need to store the data in an array or two and later save it to a data file so they can be processed or analyzed. Can you give me some suggestion on this? Thanks

 

Rgds,

 

Harry

0 Kudos
Message 10 of 20
(5,253 Views)