01-03-2022 07:58 PM
Hi All,
I am trying to communicate with a device that use RS485 using Labview 2018.
i manage to control the device by using visa write. but I am not manage to get any respond by visa read. As I need to get the data from the device for data report.
is there any mistake on my source code?
thanks in advance!
01-03-2022 09:08 PM
As any other experienced LabVIEW user says, do not use bytes at the port, instead, if your device has some sort of termination character, let VISA take care of waiting for that termination character to appear.
Please share your RS485 device programming manual.
BTW, you've already sequenced the order of operations using error wires, no need for a flat sequence structure.
This is a good article to learn VISA usage - https://labviewwiki.org/wiki/VIWeek_2020/Proper_way_to_communicate_over_serial
01-03-2022 09:14 PM
Also your Flat Sequence Structure is superfluous.
In fact if you ever find yourself reach for a Sequence Structure, stop and think about it.
Chances are you do not need it at all and if you still think you do, come here and ask questions.
If this day and age the Sequence Structure (Flat or worse yet Stacked) should be deprecated and still available only for backwards compatibility with old code.
01-03-2022 09:15 PM
Thanks for your feedback,
can help to explain more on the termination character?
here i attached the manual of the device
01-03-2022 09:55 PM - edited 01-03-2022 09:57 PM
Oh my what a horrendous communication protocol. It seems somewhat Modbus like yet more convoluted...
What do these companies have against industry standards? Why must they reinvent the wheel?
01-03-2022 10:12 PM
Looks like somebody made a VI for another instrument from same manufacturer
https://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Instrument-interface/td-p/2249024
01-04-2022 04:11 AM
@RTSLVU wrote:
Oh my what a horrendous communication protocol. It seems somewhat Modbus like yet more convoluted...
What do these companies have against industry standards? Why must they reinvent the wheel?
I wouldn't call it horrendous. Complicated yes and very much on the barebone level of the microprocessor programming inside the device. Someone was using either a very constrained low power CPU with little memory available or porting a design from such a device to this hardware.
A SCPI interpreter is fairly complex to write and can take up more memory than what some 8 bit CPUs can allow, if you have a poor compiler to work with. This protocol can be implemented in a few kB of code even with a horrendously inefficient compiler.
Interfacing it from a C program is almost trivial if you just make the structures match to your specific C compiler. In LabVIEW it is only a little bit more complicated when you use the Flatten To String and Unflatten from String functions. In Python you need the ctypes library.