LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling Stopwatch in Program using Serial DTR/DTS/RTS

Solved!
Go to solution

Hi, 

 

 

I have a device which I have attached to my PC using a RS232 to USB connection. It is a 9 port pin serial push button type device. Pin 4 is the DTR with a resistor in the circuit. Pin 7 is the RTS with the switch, and Pin 6 is the DSR for the circuit.

 

I'd like to set the DTR to High, and set the RTS to low, and read the DSR state of the device in my Labview program.

 

What I'd like to build is a simple stopwatch in my program. This stopwatch should execute when the main program starts, and be continuously reading the DSR state of my com device. When it changes it should stop the stopwatch. 

 

Can someone guide me with this?

 

I've attached my program thus far, and need some help. The program right is now is just executing vibratory motors through an Arduino MEGA.

 

Thanks!

0 Kudos
Message 1 of 5
(2,748 Views)

*Update

 

So I was able to get it working to a point where Elapsed time shown stops and displays when the User pushes the switch.

 

I'd like to make the program more robust.

 

1.) How can I sync it so that the timer elapse stopwatch only begins when I select a value on any of the motors greater than 0 Hz at default? Then when the DSR state changes it will stop and show me a time?

2.) The use of multiple VISA devices makes it such that it takes a while before the motor actually starts kicking in the COM port for the Arduino, this is adding to the time that is being shown when the button is pressed. How can I optimize and remove this delay? Is it possible?

 

 

Thanks!

0 Kudos
Message 2 of 5
(2,740 Views)

Few more updates...I'm not quite there yet..

 

What I need to do is make the program only record the time between when a motor comes on, and when the user pushes the button changing the DSR state to 'Unasserted'. I think this would affectively give me the reaction time it took between the two events...

 

Alternatively, I was thinking of perhaps having a separate elapsed time counter from the start of the button, and then stop and spit out the time it took for the motor to actually turn on (since there is a delay from when the program turns on to actually communicating with the device. So I need to effectively subtract this time out of the equation when the user is told to be ready and press the button.

 

Can someone please help me?

0 Kudos
Message 3 of 5
(2,723 Views)

Hi fubag,

 

Currently the LabVIEW Interface for Arduino is only supported via www.ni.com/arduino.  I recommend posting your questions on the discussion forums there;  I suspect you will get more responses.  

Josh B
Applications Engineer
National Instruments
0 Kudos
Message 4 of 5
(2,692 Views)
Solution
Accepted by topic author fubag

Thanks, I haven't had much luck getting responses from that Community Discussion form.

 

However, I think I solved my own questions, just needed extra time.

0 Kudos
Message 5 of 5
(2,680 Views)