01-28-2021 03:56 PM
Hello All,
I am new to the Labview. I am trying to communicate my hardware using serial port connection and trying to read values by entering specific command. It would be really helpful if someone can give me a broader idea how I would can able to do that.
Ex: if I type SNU? , in that situation I should get a response from hardware about the serial number.
Thanks in advance,
01-28-2021 03:57 PM
Do you know how to do this without LabVIEW?
01-28-2021 04:33 PM
Nope! Not really.
01-28-2021 04:53 PM
Look at Crossrulz' VIweek presentation.
Then look at Help >> Find Examples..... and serial port. I find the NI examples aren't the best, but if you look at them as a starting point and pay attention to the tips Crossrulz gives, it will fix the little problems those examples have.
The basic concept is:
1. Connect your PC to the device with the correct kind of cable. (straight through vs. null modem)
2. Open/configure/initialize the serial port with the correct settings of baud rate, data bits, stop bits. Also handshaking control if need, but that is becoming rarer. See if you need to set the termination character for Reads and what character it is. (Read the manual.)
3. Do a VISA Write to send the command. Pay attention to the device's communication manual as you probably need to append a carriage return or line feed, or maybe both to the end of the message you write.
4. Do a VISA Read and get your data.
5. When done, do a VISA Close.
If doing this repeatedly Do 2 before the loop, 3 and 4 in a loop, and 5 after the loop.