04-03-2018 06:59 AM
Hello, i start labview programming from last week and now, I need your help.
i'm trying to communicate with a Thermo/Humidity meter and it composed with rs232port and rs232 to usb converter.
as rs232port and rs232 to usb converter is connected by special unit, it is impossible to disconnect these two.
I attached a softwear that company gave to me and it works fine but it is made by C#.
I need to read data using labview for combine with other data but i have no idea that duplicate this C# program.
Even worth, this instrument does not respond to NIMAX serial read/write process.
I tried every command that NIMAX provide me but result is always same. "VISA : (Hex 0xBFFF0015) Timeout expired before operation completed."
The company that gave me the softwear for instrument just saying "Read data by serial communication of Labview"
So I use serial read & write example, but it doesn't work.
Labview can reconize that there is something at COM port but no data.
I tried Serial Port Monitor example also, but it indicate there is no communication between PC and instrument.
Please help me...
Solved! Go to Solution.
04-03-2018 08:53 AM
04-03-2018 09:45 AM
Thanks for your attention Albert.Geven
according to the softwear from company, it receive 16 buffer array. (from buff[0] to buff[15])
the data that i need to get is calculated from these buffer value.
(Actually, i cannnot understand why there is 16 buffer array)
1. What is the command set that I need to use is just read all 16 buffer array by labview.
after reading, calculation or saving data and repeat these sequence is not a problem.
2. what are the answers to the question above?
except the softwear that company gave to me, I couldn't get any useful message or data from instrument.
i just keep looking "VISA : (Hex 0xBFFF0015) Timeout expired before operation completed." message repeatedly.
I checked port property (baudrate, databits, stopbits......) and there is no problem. even checked with softwear from company.
04-03-2018 09:46 AM
@Albert.Geven 작성:
Hi
So you can communicate with the instrument via the cable that is supplied.
That helps, only other problems are handshaking, baudrate and end characters.
What is the command set that you need to use and what are the answers to the question above?
Thanks for your attention Albert.Geven
according to the softwear from company, it receive 16 buffer array. (from buff[0] to buff[15])
the data that i need to get is calculated from these buffer value.
(Actually, i cannnot understand why there is 16 buffer array)
1. What is the command set that I need to use is just read all 16 buffer array by labview.
after reading, calculation or saving data and repeat these sequence is not a problem.
2. what are the answers to the question above?
except the softwear that company gave to me, I couldn't get any useful message or data from instrument.
i just keep looking "VISA : (Hex 0xBFFF0015) Timeout expired before operation completed." message repeatedly.
I checked port property (baudrate, databits, stopbits......) and there is no problem. even checked with softwear from company.
04-03-2018 10:11 AM
Hi
So the only thing you need to do is to read 16 bytes, but maybe you need to send a command first?
This I found to open the port in C#
for (byte i = 0; i < 16; i++)
{
buff[i] = 0;
}
buff[0] = 0x10;
buff[1] = 0x97;
buff[2] = 1;
// buff[15] = 0x96;
buff[15] = CheckSum(buff);
try
{
// Send the character buffer.
serialPort1.Write(buff, 0, 16);
}
In LabVIEW this would look as building a string of 16 characters With all zero except the first 3 and the last one that has a checksum.
Did you send this?
PS the checksum is like this:
private byte CheckSum(byte[] buff)
{
byte MyCheck;
MyCheck = buff[1];
for (byte i = 2; i < 16; i++)
{
if (MyCheck > buff[i])
MyCheck = Convert.ToByte(MyCheck - buff[i]);
else
MyCheck = Convert.ToByte(buff[i] - MyCheck);
}
return MyCheck;
}
So all you need to do is translate this into LabVIEW and see what happens...
04-03-2018 10:33 AM
hummm...it could be but is it possible to write that kind of array into serial port by labview?
I know almost nothing about about read/write using labview....could you guide me how to input array command?
I though i can input single string line only;;
04-03-2018 11:28 AM
I'll try, but cannot test it.
Attached will be a few vi's to help you out.
The important one is prepare send, this one creates a 16 byte array with checksum.
It uses the checksum vi.
You have to use the VISA send array to send this array to your device and after that read some data.
good luck