Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send digital pulse - USB-6509

Hi Anita,

 

Thank you for your help. Does the while loop with elapse time have any effect on the DO lines as we continously monitor the inputs? As I run the program, I am only seeing 4-10ms output pulse on each DO line? My computer is Intel Core2/ 2.4GHz/ 2GB RAM so I don't think it's the system that slowing down the program that much.

 

Best regards,

Henry

0 Kudos
Message 11 of 26
(2,796 Views)

Hi Henry,

            The elapsed time VI isn't going to affect your program in that way- it's just going to simply control how long that while loop runs for.  What you should be seeing is Port0Line0 output a high for 2 seconds, then wait and read your digital lines for 60s.  You should then see the same thing happen for Port0Line1 and so on.  Can you please explain how you are seeing your signal only go high for a limited amount of time? How are you verifying this output?  Thanks!

 

0 Kudos
Message 12 of 26
(2,784 Views)

Hi Anita,

 

Thank you for your support and response. I am using an Agilent Oscilloscope MSO6014A 100MHz / 2GSa/s monitoring the first 16 DO lines. The attached picture shows a DO pulse of 3ms on D4 using the two while loops. I am consistently getting 3 to 6ms outputs and was wondering how changing the two loops effect my outcome. From your explanation earlier and looking at the diagrams, it shouldn't have any affect.

 

I ran your program and change the second while loop to 5 seconds to repeat the DO faster. Attached are scope captures showing the two small pulses every five seconds and the pulse width. I don't know what I am doing wrong.

Download All
0 Kudos
Message 13 of 26
(2,777 Views)

Hi Henry:

 

If you're running the program as it was posted last, you should definitely not be seeing such a short output.  One thing you can do is go back to the program I pointed to (this will help simplify what the program is doing) and check the response of each output.  The way it's set up, you should see each digital line go high for  two seconds and move to the next line.  Let us know how that goes and we'll continue looking into the issue.

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

Hi Alex,

 

Before I left work on Friday I ran your version of VI so that I can test over the weekend. In the long run, I wouldn't mind the short pulse followed by the long two seconds pulse but that is just fine tuning my program. I will look into Anita's program on Monday morning and see why it's not working.

 

Thanks for the late night response.

 

Henry

0 Kudos
Message 15 of 26
(2,748 Views)

While troubleshooting Anita's VI, I noticed that I only get a response on each DO while I highlight the excution. However when I do this, it slows down the program and extends the 2seconds HI on the DO to about 4-5 seconds long. I don't know if that information is helpful, but wanted you guys to know. Will dive more into this issue tomorrow.

 

Thanks, 

Henry

0 Kudos
Message 16 of 26
(2,736 Views)

For the elapse time function that Anita suggested, the auto reset function does not work for the first while loop that outputs the DO line high. As I ran the program and probed the "Time has elapsed" output, the condition always remain true, hence the 2-6 ms output that I am seeing on the digital scope. The "automatically reset after time target" is selected and should reset the function to false for the next iteration of the while loop.

 

The part that I am not understanding is the second while loop does reset to false after reaching the 60sec elapsed time, but not the first. Could this be a bug in multiple elapsed time.vi running inside a for loop? I just wanted to point that out so you guys can check that out.

 

I used the tick count(ms) function and probed the time has elapsed output to verify this issue. Attached is the updated vi to show what I did.

 

Thanks for all your help.

 

Henry

0 Kudos
Message 17 of 26
(2,711 Views)

Hey Henry:

 

Not sure why the loops are acting differently but you should be able to force the proper behavior by adding a shift register as shown in the attached picture.

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

Thank you Alex,

 

I like your idea of the shift register to force the reset of the elapse time function. From my posting and troubleshooting the elapse time function, I decided to stick with tick count function along with a greater or equal to function to set my time limits. This way, when I need to debug or troubleshoot any issues I can change the time limit on the front panel while the VI is running rather than waiting the full 60secs or stopping to changing the time parameters.

 

My next question is logging the DI on a graph and recording the data to the same txt file. Since I have to read functions in two different while functions, is it possible to combine the output into one graph? I have two graphs, one inside each loop to display any DI line high but the x-axis are independent of each other. This is a bit confusing for me if I want to figure when the DI line went high on two timelines. I tried putting it outside of the loop, but it always remain at 0. I think the reason why the graph and my log file stays at 0 is becuase that is the last value of the while loop when the time expires. My DI lines triggers high for a few milliseconds and then turns off. Is there a way to log the data if I see it go high at any point?

 

Is it better to monitor DI lines as "one channel for each line" or "one channel for all lines?" I don't understand the difference between the two.

 

 

0 Kudos
Message 19 of 26
(2,643 Views)

Hi Henry:

 

You can write to file when you see a high value just by using a case structure in the while loop.  What do you want to write to the file (all of the line values, a timestamp, etc.)?

 

For the digital input, I would set it to one channel for all lines so that you can choose to read an entire port and not worry about specifying the lines.

Alex Person
NI-RIO Product Support Engineer
National Instruments
Message 20 of 26
(2,625 Views)