LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

rs232

Solved!
Go to solution

how to identify the bit order in transmit date whether it is  LSB or MSB on standard i/o in serial port RS232

0 Kudos
Message 1 of 11
(5,313 Views)
Solution
Accepted by topic author esaki

The bit order does not depend on the protocol but is implementation dependent instead. That is to say it is defined by the device producer, who must clarify this detail in the device description.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 11
(5,239 Views)

I would say it is actually one of the attributes of the protocol, unless you mean to indicate that RS-232 is the protocol, which I rather would consider the interface.

For most RS-232 communication the endianess (which is the byte ordering) is however not really an issue as they are typically text based. It only gets an issue when you have binary protocols that contain multibyte numbers.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 3 of 11
(5,039 Views)

In binary protocols that contain multibyte number in which I want a particular endianess(byte order) LSB or MSB value to be read and print in cvi

 

 

Thank you for your support 

0 Kudos
Message 4 of 11
(4,900 Views)

Are you asking about how to format the data into a binary string in a specific endianess? Your original question sounds very much like you want to decide programmatically what endianess you need to use which you can’t since it depends on the device and has to be specified in the documentation of that device. Roberto obviously interpreted it in the same way.

To implement the specific endianess the CVI Fmt() functions which work similar to the printf syntax, have additional format modifier syntax for integer and floating point formats to define the explicit endianess to use.

 

http://zone.ni.com/reference/en-XX/help/370051AG-01/cvi/libref/cviformatting_functions/

 

You use the b modifier to specify the size of the integer and the o modifier to specify the byte order.

 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 5 of 11
(4,882 Views)

Additionally, CVI offers some endianness functions in the Programmer's toolbox.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 11
(4,425 Views)

If i use ComRdByte  without setting time for function  , can I able to read the byte or particular bit  and then assign their function 

0 Kudos
Message 7 of 11
(4,359 Views)

Please explain better what your aim is. I don’t have any idea what you mean.

As this function only returns you a single byte (or a negative value in case of an error), it has nothing to do with your original topic in this thread which seemed to be about endianess. As such it would be useful to start a new thread for this and explain better what your problem is.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 8 of 11
(4,340 Views)

my question was using Endian (lsb ,msb) I need to print the value ,if its is lsb i need to print the true value or if its msb i need to print false value . Both case depents on the endian and other question is  if I call a radom byte it should print a particular bit value either lsb nor msb value   

0 Kudos
Message 9 of 11
(4,311 Views)

I myself cannot understand what your goal is! Endianness usually refers to multibyte values so its difficult to understand how to use it with a single byte read, or you want to discriminate whether the remote device speaks in Most- vs Least-significant bit first standard? Additionally, what "print the true/false value" means?

Can you show us an example with some values received from the remote system and what you expect to handle them?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 10 of 11
(4,306 Views)