LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you change Endian-ness in LV VISA Serial Communications?

Hello all,

 

I've built my first version of a vi, that sends out and receives serial messages through VISA.

 

Talking with the person testing this out, hooked (finally) to the real piece of hardware, we've run into a situation....from what he says, it appears I'm seinding Big Endian....and he's expecting  to communicate with Little Endian.

 

Is there some sort of switch of flag I can set somewhere in LV to change between Big and Little Endian-ness? 

 

Thanks in advance,

 

cayenne

0 Kudos
Message 1 of 13
(3,170 Views)

Can you give a bit more details on what the device expects and how you are composing the string to be sent?

 

"Flatten to string" has byte order input, so that's probably what you should be using.

Message 2 of 13
(3,167 Views)

@altenbach wrote:

Can you give a bit more details on what the device expexts and how you are composing the string to be sent?

 

"Flatten to string" has byte order input, so that's probably what you should be using.




Ok..let's give a small example.

In my byte string...according to the ICD....I'm supposed to send 01111111  this goes out through the NI serial connector (RS422)...on on his end of the connection, he says he's seeing 10000000

 

I'm not in front of LV right now...will have to get home and can do a quick screenshot to show how I'm constructing the message. On my end, I can see the byte string I'm putting together and it appears to be proper....but somehow on his end, he's getting something wrong.

 

 

 

0 Kudos
Message 3 of 13
(3,160 Views)

@cayenne wrote:

In my byte string...according to the ICD....I'm supposed to send 01111111  this goes out through the NI serial connector (RS422)...on on his end of the connection, he says he's seeing 10000000



That's not an endian-ness problem.  That's an inversion issue.  RS-422?  Make sure your + and - are not flipped in the wiring.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 13
(3,157 Views)

@crossrulz wrote:

@cayenne wrote:

In my byte string...according to the ICD....I'm supposed to send 01111111  this goes out through the NI serial connector (RS422)...on on his end of the connection, he says he's seeing 10000000



That's not an endian-ness problem.  That's an inversion issue.  RS-422?  Make sure your + and - are not flipped in the wiring.


Absolutely. Remember that reversing the polarity of the neutron flow always fixes the problem in sci-fi shows and movies.

0 Kudos
Message 5 of 13
(3,141 Views)

@crossrulz wrote:

@cayenne wrote:

In my byte string...according to the ICD....I'm supposed to send 01111111  this goes out through the NI serial connector (RS422)...on on his end of the connection, he says he's seeing 10000000



That's not an endian-ness problem.  That's an inversion issue.  RS-422?  Make sure your + and - are not flipped in the wiring.


First, thanks for all the help so far....and let me say OOPS!

 

I had a miscommunication with the person testing this out on hardware.

 

The example I gave above is incorrect...

 

It appears that things are not as I described above.  What happens is...I trasmit 00000001

On the hardware side..they're getting 10000000

 

I've confirmed with them, that they are expecting Little Endian...and it appears I am sending Big Endian...

 

Can someone confirm with me that LV serial out is BE?

 

Is there a simple way for me to send out LE rather than BE?

 

From the tester he stated:

 

"As you suggested earlier, you can do an Oops..that you should have said that the ICD called for the VI to transmit 00000001b, i.e., the LSB is a logic 1, but the VI is transmitting 10000000b, where the MSB is a logic 1. All other bytes in the message are bit-swapped, which makes me think the VI is transmitting in big endian format. The above example is not the serial bit stream, but the parallel format."

 

Thank you,

 

cayenne

0 Kudos
Message 6 of 13
(3,119 Views)

@cayenne wrote:
"As you suggested earlier, you can do an Oops..that you should have said that the ICD called for the VI to transmit 00000001b, i.e., the LSB is a logic 1, but the VI is transmitting 10000000b, where the MSB is a logic 1. All other bytes in the message are bit-swapped, which makes me think the VI is transmitting in big endian format.
Bit swapped is not the same as Byte swapped. swapping bits has nothing to do with byte order or endian-ness.
Do you have a more representative set of data where you know what it is supposed to be.

 

0 Kudos
Message 7 of 13
(3,114 Views)

@altenbach wrote:

@cayenne wrote:
"As you suggested earlier, you can do an Oops..that you should have said that the ICD called for the VI to transmit 00000001b, i.e., the LSB is a logic 1, but the VI is transmitting 10000000b, where the MSB is a logic 1. All other bytes in the message are bit-swapped, which makes me think the VI is transmitting in big endian format.
Bit swapped is not the same as Byte swapped. swapping bits has nothing to do with byte order or endian-ness.
Do you have a more representative set of data where you know what it is supposed to be.

 


Ok, here is a full sample of what I'm sending:

 

 0000000100000000000000001111111011111110
This is what he's seeing on his end:
10000000 00000000 00000000 01111111 01111111
 
Thank you,
C
0 Kudos
Message 8 of 13
(3,108 Views)

I am assuming these are bits (5bytes total) and not text containing the characters 0 and 1, exclusvely.

 

You simply need to reverse the bits for each byte, which is most easily done using a 256byte lookup table.

Message 9 of 13
(3,103 Views)

@altenbach wrote:

I am assuming these are bits (5bytes total) and not text containing the characters 0 and 1, exclusvely.

 

You simply need to reverse the bits for each byte, which is most easily done using a 256byte lookup table.


Thank you for the reply.

 

I'm not familiar with the term " 256 byte lookup table".....would you have any links to examples of what this is?

 

Thank you,

 

C

 

0 Kudos
Message 10 of 13
(3,079 Views)