01-02-2020 11:57 PM
how to identify the bit order in transmit date whether it is LSB or MSB on standard i/o in serial port RS232
Solved! Go to Solution.
01-03-2020 05:11 AM
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.
01-05-2020 06:29 AM
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.
01-05-2020 10:49 PM
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
01-06-2020 01:18 AM
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.
01-06-2020 06:10 PM
Additionally, CVI offers some endianness functions in the Programmer's toolbox.
01-06-2020 11:36 PM
If i use ComRdByte without setting time for function , can I able to read the byte or particular bit and then assign their function
01-07-2020 01:19 AM - edited 01-07-2020 01:24 AM
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.
01-07-2020 03:25 AM
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
01-07-2020 04:09 AM
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?