Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial communication

Hello,

I would do serial communication with USB 6008 to read the values.

How can I do it? Thank you,

0 Kudos
Message 1 of 10
(2,432 Views)

The short answer is you probably can't. Consider instead buying a cheap USB to Serial converter and using the VISA Serial code that you have in that VI.

 

The long answer is you shouldn't. It might be possible to "bit-bang" a serial communication using analog outputs, but if you want to communicate with an RS232 or similar device, you'll be relying on it not transmitting high voltages - RS-232 is defined for voltages between +3->+25V, and -3->-25V as the two signal values. So if you receive a 25V volt input, you might have problems.

 

You definitely can't. The 6008 can only output positive voltages (0-5) as either analog or digital, so you can't produce something below -3V, which is required for RS-232. Purchasing level conversion hardware is probably as expensive as just a USB->Serial converter, so definitely don't bother.


GCentral
0 Kudos
Message 2 of 10
(2,410 Views)

So, How can I do? I don't understand the solution that you proposed.

0 Kudos
Message 3 of 10
(2,406 Views)

Even in Visa ressource name, I don't find any USB or COM port. And, what is the solution to establish serial communication? and why I can't use NI USB 6008? Normally, it should work because it has serial communication!

0 Kudos
Message 4 of 10
(2,404 Views)

You need to buy a new device, perhaps something like the following: https://www.amazon.com/TRENDnet-Converter-Installation-Universal-TU-S9/dp/B0007T27H8 (first result for a Google search of 'serial to usb converter'). I haven't used this device or ever tried it, but it gives you an idea of what I mean. Obviously you don't have to buy this one or use Amazon, these are very common.

 

When you plug that into a USB port, then typically your device manager will show a new COM Port, which can then be selected in the drop down menu in LabVIEW.

comPort.png

comPort2.png


GCentral
0 Kudos
Message 5 of 10
(2,395 Views)

OK, I will see that! and for the program can you look if it's correct. Just to solve the problem of the code too! and how to connect the RS 232 with the NI USB 6008? because it doesn't have USB port!!

0 Kudos
Message 6 of 10
(2,393 Views)

For the purposes of Serial communication, the answer is always to read the manual of the device you want to communicate with.

 

Typically, the manual will specify either a single value for Baud Rate, Parity, Data Bits, etc, or specify a default value, and a method to change them. You must make sure that the values you use in LabVIEW are the same as the values expected by the device.

Next, you should check the behaviour of the device. At the moment, your code will "sort-of" work, only if the device immediately begins sending data, and never stops.

You may have to send a command to request a data value, in which case you will need to use "VISA Write" with the appropriate message.

If your device sends results separated by some termination character, you should specify the termination character for the "Configure Serial Port" VI, and then use VISA Read with a large number of bytes (perhaps 100). It will return once it reaches the termination character. In this case, no "Bytes at Port" is required.

If it does not send a termination character, it's possible to use a While loop and the Bytes at Port value, but you must manually code some method of detecting that a message is complete and then stop the While loop (inside the existing While loop).

All of these things depend on your device.

I'd suggest opening a new question in the general LabVIEW board, and attaching the manual in PDF form, along with information about the desired output (probably a single number, or an array of numbers?) and any required configuration values (maybe you need to send some information to the device when you start your program, for example, a channel if it is an oscilloscope, a start command if it streams data, etc). If you don't know these values, the manual will help me or others ask appropriate questions to move us in the right direction.


GCentral
0 Kudos
Message 7 of 10
(2,386 Views)

My device is generator. I would read the signal from the generator, and after in the serial communication: show the counters values plus the voltage for each incrementation. That's all!

0 Kudos
Message 8 of 10
(2,384 Views)

@cbutcher wrote:

For the purposes of Serial communication, the answer is always to read the manual of the device you want to communicate with.

...

I'd suggest opening a new question in the general LabVIEW board, and attaching the manual in PDF form, ...


It depends from device to device. To get anywhere, you need the (or part of the, or one of the, depending on device) manual specifying communication parameters, commands and formats.

Knowing what the device does "it's a generator" - what does this mean, what does it generate (probably power, but I don't know), how is it controlled, what are its message formats, etc etc - these are all going to be in documentation. If you can attach it, that's the best option. If not, then a part number and manufacturer would allow readers to search the internet to try and find the manual, but this implies that your time to find the manual is more valuable than the readers' time to do the same. Although frequently readers will do this, it shows that you don't believe our time is valuable (maybe it isn't, but it's not nice to point that out 😛 )


GCentral
0 Kudos
Message 9 of 10
(2,370 Views)

It's power generator. This is its name:

EA-PS 3150-04 B

I will open new discussion in Labview community

0 Kudos
Message 10 of 10
(2,367 Views)