Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send digital pulse - USB-6509

Hi Alex,

 

I cleaned up my VI so that it's a lil bit easier to follow and now only monitoring the two ports (one channel for all lines). This is what I want to write to the file:

 

"4/7/2009 1:49:38 PM Dev 6509 /port 0 /line 0 MAIN 1 Response 1"

"4/7/2009 1:49:38 PM Dev 6509 /port 0 /line 1 MAIN 2 Response 2"

 

I have the timestamp on the outside of the loop so I know when the command (DO) was sent. On each line I am trying to append when the unit responds (DI). I placed the case structure inside a for loop to scan all iterations and only output when the line goes high. I think I have something wrong because it doesn't enter the for loop. How can I use the case structure only? Without the for loop, I get an error stating "The type of the source is 1-D array of unsigned word [16-bit integer (0 to 65535)] [numFlags=0x0]. The type of the sink is boolean (TRUE or FALSE)." I still have the waveform chart branched off the same line to see my output and I do see the DI from each unit.

 

Thanks in advance. Attached is my updated VI.

 

Henry

0 Kudos
Message 21 of 26
(2,140 Views)

Hi Alex and All,

 

So I managed to get my VI to output which main unit responded and writes it to the txt file. Is there a way not transpose the response from the case statements and get it out of the for loop because I am seeing multiple responses? I am trying to get one command DO and one response DI on the same line like my previous post. This is the response that I am seeing now:

 

4/7/2009 1:49:38 PM Dev 6509 /port 0 /line 0 

MAIN 1

MAIN 1

MAIN 1

Response 1

Response 1

Response 1

4/7/2009 1:49:38 PM Dev 6509 /port 0 /line 1 

MAIN 2

MAIN 2

Response 2

Response 2

 

Check out vi and progress.

 

Thanks,

Henry

0 Kudos
Message 22 of 26
(2,128 Views)

If you only want one response, you'll have to write outside of the while loop or provide some other conditional to make sure you haven't already written a value.

 

To get your output to write on one line of your file, you will have to build one array of everything you want on that line and write it to the spreadsheet file all at once.  This means you will probably want to use the first option from above.

 

Good luck!

Alex Person
NI-RIO Product Support Engineer
National Instruments
0 Kudos
Message 23 of 26
(2,108 Views)

Sorry for bringing this post out of the dead, but how do I send another digital pulse before the first pulse is complete?

 

What I would like to do this time is send a pulse for 500ms on one line P0.0, wait 1ms later and pulse P0.1 for 500ms. This will cycle through all the channels that I have available on the USB-6509 module. Please see the attached jpg for the general idea of what I want. The VI that I have attached waits 500ms +1ms before pulsing the second line (top line of the picture).

 

Is it even possible to do with the USB-6509? Thanks for your help in advanced.

 

-Henry

 

Download All
0 Kudos
Message 24 of 26
(1,664 Views)

Anyone?

0 Kudos
Message 25 of 26
(1,582 Views)

Howdy Henry!

 

One way you could generate that output would be to divide the code into three steps:

 

1. Have a for loop cycle through each of the channels with 1ms delay to set them high in sequence.

2. Have the program delay for (500 - #channels) milliseconds while the channels are held high.

3. Have a for loop cycle through each of the channels with 1ms delay to set them low in sequence.

 

Since the USB-6509 uses software timing to control the DIO your output will likely not be perfectly spaced at 1ms intervals due to the operating system.  One millisecond is the smallest time interval that can be approximated for a time delay in the program.

Barron
Applications Engineering
National Instruments
0 Kudos
Message 26 of 26
(1,533 Views)