Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble communicate with rs232 serial to usb port

Solved!
Go to solution

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...

0 Kudos
Message 1 of 7
(3,370 Views)

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?

greetings from the Netherlands
0 Kudos
Message 2 of 7
(3,352 Views)

Thanks for your attention 

 

 

 

 

 

0 Kudos
Message 3 of 7
(3,346 Views)

@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 

 

 

 

 

0 Kudos
Message 4 of 7
(3,345 Views)

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...

greetings from the Netherlands
0 Kudos
Message 5 of 7
(3,341 Views)

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;;

0 Kudos
Message 6 of 7
(3,339 Views)
Solution
Accepted by blacktea

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

greetings from the Netherlands
Download All
0 Kudos
Message 7 of 7
(3,329 Views)