LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I know is the computer talking to the device??

Hi everyone,
 
Same as the subject, I connect the Mettler Toledo AL104 Balance to the computer using a 9-pin serial rs232 cable. I'm using the sample vi from LabVIEW( Basic Serial Write and Read). I turn off the read part and tried these write commands..... "Z", Z, *Z, "Z"\r\n, Z\r\n, and *Z\r\n.... the Z is to zero the balance. But it didn't work. Do anyone know how I test is the device communicating with the computer??
 
Thanks!!
0 Kudos
Message 1 of 8
(3,567 Views)
Well, you can verify that the com port itself is working with a loopback but it's pretty hard to determine exactly why a serial instrument is not working the way you expect . You could have the com settings incorrect (baud rate, parity, etc.), have the incorrect cable (null modem or straight through), sending the incorrect command, or terminating the command incorrectly. Take it one step at a time and double check everything. If you are using a straight through cable, swap to a null modem and vice versa. Before trying anything in LabVIEW, try using Hyperterminal to eliminate the possiblity you have something wrong with the code. Double check the manual for correct com settings.
0 Kudos
Message 2 of 8
(3,558 Views)

I only have COM1 and ASRL1::INSTR in the computer. I tried both with having other setting in the device the same as the one in labview... etc...9600bd, 8bit/no parity, and XON/XOFF, and I also used the volt meter to make sure there is nothing wrong with the rs232 cable. The command Z is an example code I got from the Instruction manual. I've tried Z, "Z", *Z, Z\r\n, "Z"\r\n, *Z\r\n (variations of inputs) but none of them work.

I saw there is a loopback.vi online, however it was written in labview5.1 and I can't open it in labview 8.1. I can't find any loopback example under help either. Can anyone show me how to write a loopback vi??  and do I need to short pin 2 and pin 3 in order to run it?

thanks!!

0 Kudos
Message 3 of 8
(3,552 Views)

Yes, a basic loopback test just requires you to short pins 2 and 3. You don't need to write anything. You can simply run the basic example. Enable the write and read and whater you send will be received. You can also just open Hyperterminal and just start typing. As I said, this only verifies that the com port of the pc is working. It does not verify anything else.

I would strongly suggest that you do most of your initial debugging with Hyperterminal and try the opposite type of serial cable. The instrument manual should explain what type of cable is required but sometimes a manual skips this vital piece of information. The advantage of using Hyperterminal is that if you continue to have problems with that, you can contact the vendor and explain what is going on. Every vendor should be familiar with Hyperterminal but many will have never heard of LabVIEW. The use of LabVIEW also requires that you have properly installed NI-VISA.

0 Kudos
Message 4 of 8
(3,548 Views)

Hi Dennis,

I know this sounds silly, but what is a Hyperterminal and how do you run it?

0 Kudos
Message 5 of 8
(3,541 Views)
Hyperterminal is the terminal emulation program that has shipped with every version of windows that I can remember. It's located at Programs>Accessories>Communications.
 
Since it sounds like you are a beginner with RS-232, when I talk about the different types of serial cables, there are two basic types - null modem and straight through. A straight through is just what it sound like. Pin1 at one end of the cable is connected to pin 1 at the other, pin 2 to pin 2, etc. A null modem swaps some pins. The most basic (where no hardware handshaking is used), swaps pins 2 and 3. You should determine the type you hve with an ohmmeter and compare that to what is in the manual.
0 Kudos
Message 6 of 8
(3,538 Views)

I believe for Mettler Toledo you need to wirte the following: (Zero the balance only works if the wight display is within 2% of the scale capacity --- I suggest you try TI (Tare Immediately).

You write TI + CReturn+ Line feed constant.

 

This should work and tare your balance.

 

Hope this helps.

0 Kudos
Message 7 of 8
(3,523 Views)

Thanks Dennis and Jaime, I am indeed a beginner using LabVIEW ( I've only control the speed of a motor board using a DAQ board... so pretty much I have no idea how to use this software... espeically using the rs232 cable ...) I'm now out of town and won't be back on campus till thursday,  I'll definitly do what you guys suggested, I really hope it works, and I'll keep you guys updated!!!!

 

Thanks a lot!!

0 Kudos
Message 8 of 8
(3,499 Views)