LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Communication Problem using hexadecimal

Hi friends;

I have a problem with serial communication.

I want to connect our experiment equipment(TruHeat HF 3010) using labview but I don`t know what is the problem.

Manual says that system communicate with pure binary. And in example, there are all hexadecimal.

I write command hexadecimal(and set display hexadecimal).

I found some document about error which is related with my labview error(frame error).

I tried all of method in here(http://digital.ni.com/public.nsf/allkb/F3E0621CB71AA16786256F970000FC57).

But it remains unsolved.

manual says that baud is 19600. But when I use teraterm, It doesn`t work. It works well in 57600. So, I set baud 57600 in labview.

 

 

0 Kudos
Message 1 of 17
(3,174 Views)

Hi skyhj,

 

write command hexadecimal(and set display hexadecimal).

When you do so you should make the string display mode visible! (Just for documentation and code readability reasons.)

 

manual says that baud is 19600. But when I use teraterm, It doesn`t work. It works well in 57600. So, I set baud 57600 in labview.

"19600" is no common baudrate, but "9600" would be…

When it "works well", then why do you complain about errors?

 

Manual says that system communicate with pure binary.

Then you should disable the TermChar at VISAConfigureSerialPort! Read the (detailed) help for this function!

You should not use BytesAtPort: with "pure binary" messages you need to know the number of bytes to read from your manual!!!

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 17
(3,144 Views)

 

 

When you do so you should make the string display mode visible! (Just for documentation and code readability reasons.)

I arealdy did it.

 

"19600" is no common baudrate, but "9600" would be…

When it "works well", then why do you complain about errors?

 Its not my experiment equipment. when It was operated at that baudrate.

Additionally, The company in my country, there is no one who knows about serial communication.

I have answered from headquater via company in my country. But it`s very restrictive answer.

 

Then you should disable the TermChar at VISAConfigureSerialPort! Read the (detailed) help for this function!

You should not use BytesAtPort: with "pure binary" messages you need to know the number of bytes to read from your manual!!!

I know number of bytes and disable TermChar and already did it. but frame error remains same.

 

 

 Thank you for your respond.

 

0 Kudos
Message 3 of 17
(3,138 Views)

Can you share the manual with us so we can better advise.

 

0 Kudos
Message 4 of 17
(3,131 Views)

I attached manual about serial communication.

Thank you for your kindness.

Download All
0 Kudos
Message 5 of 17
(3,118 Views)

That is no help as it includes no commands..

 

Edited since I missed the page with about the XOR LRC checksum

 

0 Kudos
Message 6 of 17
(3,114 Views)

I`m sorry. I thought that there is a example, so it is enough.

I attached full manual.

Command is written at page 143

checksum is all of that page which I attached before.

0 Kudos
Message 7 of 17
(3,106 Views)

I can't comment on your serial configuration. I'm assuming it is OK because you said it works in other programs. The only thing that may be an issue is with binary data transfer, you have to turn off the termination character. To repeat what GerdW said, DO NOT USE BytesAtPort!!!

 

You need to study Figure 8.8 on page 131 of "5.png". Your VI does not match the data flow of that example. Here is the way I would do it step by step:


1) Write Command  (0x0232640011)
2) Read 1 Byte  (look for an ACK or a NAK)
3) If ACK then Read 1 byte (Header); If NAK then you have an error and you need to deal with it
4) strip out the 3 LS Bits in the header for number of data bytes to follow and add 2
       i.e. total bytes left to read is => # of data bytes in header + Command Byte + Checksum
      
5) Read that amount of bytes
6) Send the Unit an ACK

 

NOTE: If # of data bytes in header is 7 (0b111)  (0x111), then the amount of data to follow is actually given in the "Optional Length Byte". Refer to page 129 in "3.png"

0 Kudos
Message 8 of 17
(3,096 Views)

Thank you for your reply. I attached my VI.

 

Is it right?

The output is different with example.

Download All
0 Kudos
Message 9 of 17
(3,088 Views)

@skyhj105 wrote:

Hi friends;

I found some document about error which is related with my labview error(frame error).

I tried all of method in here(http://digital.ni.com/public.nsf/allkb/F3E0621CB71AA16786256F970000FC57).

But it remains unsolved.

manual says that baud is 19600. But when I use teraterm, It doesn`t work. It works well in 57600. So, I set baud 57600 in labview.

 


Your link points to an article with error code -1073807253 during a VISA read. It this the error your getting?


The manual says that the unit will respond after the command is "Accepted and Executed". If you are able to connect at 5700 baud, I'm guessing that the unit still hasn't finished executing the task, that there is only 1 BytesAtPort, and you are only reading 1 character (ACK 0x06). Then your program closes the VISA session and stops. Are you able to read the ACK or any other characters from the Unit? Are you timing out? Or are you getting another error??

0 Kudos
Message 10 of 17
(3,080 Views)