02-01-2022 12:25 AM
Hi All
I'm having a problem transferring data from a PIC to LabView via RS232. I have 2 bytes of data per data point which are in binary. As the most significant byte only uses the 2 LSB's I'm running into those control charcters from ASCII. Also, I cannot successfully change the charcters transferred back to an ASCII No. to represent my data. It seems that the read vi doesn't like me transmitting a binary byte. I've tried the Type Cast VI but with no success. Broken wires due to data type mismatch. Any help would be greatly appreciated
02-01-2022 01:52 AM
Post your VI, easier to help that way.
Do you have a termchar enabled for your communication? Termchar with binary data could cause the packet to be read prematurely.
02-01-2022 06:58 AM
Binary data...
Turn OFF the Termination Character. If a byte just happens to match the termination character, the read will stop. This happens quite a bit with binary formatted data.
As far as converting your data, I prefer to use the Unflatten From String since it has an additional option to handle the Endianness of the data source.
Another possible issue you may have is how are you synchronizing your messages? How do you know you have the bytes in the right order? You will typically want some type of message frame to ensure you got the correct data. This will involve a start character and preferably some type of checksum/CRC at the end. You may want to check out this video for a lot more details: VIWeek 2020/Proper way to communicate over serial