LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is this a hardware interfering?

Solved!
Go to solution

Hello,

 

I worte a program (please see in attachment) to acquire data by serial ports (RS232) from two instruments--one is a force sensor and another is a position sensor. When I connected those two instruments directly to my desktop by RS232, the data looked good. But when I connected those two instruments to USB ports on my laptop by RS232-USB adaptors, there was then a lot of noise for both data. Someone told me that it was due to the hardware interfering. Since I know little about hardware, could anyone please tell me if that really a hardware interfering or any problems with my code? Why it worked well on desktop and is there any way to fix it? Thanks a lot!

0 Kudos
Message 1 of 7
(3,568 Views)
Solution
Accepted by topic author dreamxin

Your code looks fine with one exception.  You should convert the error terminals on the loop border to shift registers.  That way, any error that happens will be propogated to the next loop.  The way you have it, if an error occurs, it will be lost on the next loop iteration and you will never know about it.

 

You aren't the first person that has complained about USB to Serial converters messing up their program.  The only suggestion I have is to go back to the serial port, or maybe buy another brand of USB-Serial converter.

 

 

Edit:  Just noticed that you do not have any Wait funtion in your loop.  This will cause 100% CPU usage, and this may be what is causing your problem because the OS doesn't have time to tend to the USB properly.  This is just a guess.  Put in a small delay (Wait function), say 10mS.  See if that fixes your problem.  Even if it doesn't, keep the delay in there.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 7
(3,558 Views)

Thanks a lot!

0 Kudos
Message 3 of 7
(3,543 Views)

Did the Wait function fix the problem?  Or did you go back to the serial port?

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 7
(3,534 Views)

I tried on desktop and laptop several times by adding the wait function. For desktop, it was ok in the range from 10 ms to 200 ms. I did not try longer time, but I think it will be still OK. On the laptop, the noise might be reduced a little bit, but the data still looked ugly. Going back to serial ports may be the only way. Just one more question: will the mini PC board for serial ports work better than the USB on laptop? Thanks!

0 Kudos
Message 5 of 7
(3,491 Views)

@dreamxin wrote:

one more question: will the mini PC board for serial ports work better than the USB on laptop? Thanks!


There is only one way to find out.  Try it.  USB requires more overhead from the OS.  So I am guessing serial would be better.

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 7
(3,488 Views)

I will try, thanks again!

0 Kudos
Message 7 of 7
(3,478 Views)