bmoyer Posted October 8, 2008 Report Share Posted October 8, 2008 Hi everyone, I have a utility that I developed using LabVIEW to communicate with a device using VISA over RS232 and there is a mode of the device for sending calibration data which takes data in a binary format. What I have found is that some of the data is being converted before it arrives at the device (using a serial port monitor) - mainly the 0x0d (\r) values are being converted to 0x0a (\n). I found a VISA property under the "Serial Settings" submenu called "End Mode for Writes" but the default for this property is "None" so this property shouldn't have an effect on my data (but I will give it a try). Has anyone seen this type of behavior and worked out a fix? Many thanks, Bruce Quote Link to comment
ASTDan Posted October 8, 2008 Report Share Posted October 8, 2008 Hello Bruce, When you use the serial init VI specify the termination character as \r. The default is \n Quote Link to comment
bmoyer Posted October 8, 2008 Author Report Share Posted October 8, 2008 QUOTE (ASTDan @ Oct 7 2008, 09:43 AM) Hello Bruce,When you use the serial init VI specify the termination character as \r. The default is \n http://lavag.org/old_files/monthly_10_2008/post-8614-1223386956.gif' target="_blank"> Wouldn't this reverse the problem? If this is the case, wouldn't that change 0x0a (\n) into 0x0d (\r)? When I looked into the termination for the VISA Configure Serial Port (Serial Instr).vi, it's setting the "Message Based Settings:Termination Character" property and the help on this property says "This property specifies a character that, when read, causes a read operation to terminate." In my case I am writing data. Any other ideas? Bruce Quote Link to comment
ASTDan Posted October 8, 2008 Report Share Posted October 8, 2008 QUOTE (bmoyer @ Oct 7 2008, 10:17 AM) Wouldn't this reverse the problem? If this is the case, wouldn't that change 0x0a (\n) into 0x0d (\r)?When I looked into the termination for the VISA Configure Serial Port (Serial Instr).vi, it's setting the "Message Based Settings:Termination Character" property and the help on this property says "This property specifies a character that, when read, causes a read operation to terminate." In my case I am writing data. Any other ideas? Bruce Try setting your termination character to false in the Init serial VI. Quote Link to comment
TobyD Posted October 8, 2008 Report Share Posted October 8, 2008 QUOTE (ASTDan @ Oct 7 2008, 07:33 AM) Try setting your termination character to false in the Init serial VI. My understanding is that the termination character only affects read operations. How are you setting your input string control ('\' code display, hex display, normal display). I wonder if this could be having an effect on things? Quote Link to comment
jdunham Posted October 8, 2008 Report Share Posted October 8, 2008 QUOTE (bmoyer @ Oct 7 2008, 05:12 AM) I have a utility that I developed using LabVIEW to communicate with a device using VISA over RS232 and there is a mode of the device for sending calibration data which takes data in a binary format. What I have found is that some of the data is being converted before it arrives at the device (using a serial port monitor) - mainly the 0x0d (\r) values are being converted to 0x0a (\n).I found a VISA property under the "Serial Settings" submenu called "End Mode for Writes" but the default for this property is "None" so this property shouldn't have an effect on my data (but I will give it a try). We use our serial ports only in binary mode, so it is definitely just a settings problem related to the termination character There are serial settings for this, and also a "message" setting. I'm not sure which one overrides another, but we turn them all off and it works great http://lavag.org/old_files/monthly_10_2008/post-1764-1223401468.png' target="_blank"> Quote Link to comment
bmoyer Posted October 8, 2008 Author Report Share Posted October 8, 2008 QUOTE (jdunham @ Oct 7 2008, 01:44 PM) We use our serial ports only in binary mode, so it is definitely just a settings problem related to the termination characterThere are serial settings for this, and also a "message" setting. I'm not sure which one overrides another, but we turn them all off and it works great http://lavag.org/old_files/monthly_10_2008/post-1764-1223401468.png' target="_blank"> The "Serial Settings:End Mode for Writes" parameter looks promising. I will try setting this to "None" tomorrow and let you know how things go. Thanks, Bruce Quote Link to comment
bmoyer Posted October 9, 2008 Author Report Share Posted October 9, 2008 In my experience a hardware "guy" will first blame the software before admitting fault, in this case, the software "guy" (me) incorrectly blamed the hardware "guy". My utility loads a binary calibration file and then sends the data to the device. I incorrectly assumed that the Read from Text File function would leave my data unaltered (similar to the Read Characters from File function (now obsolete in newer LV versions) which has this EOL conversion defaulting to off), but it defaults to convert EOL=on (you have to right-click the VI to see this parameter, it's not an input like the other function). Even better, I guess I could/should use the Read From Binary File function which doesn't have an option at all for this conversion. Thanks to all who replied for their valuable insight! Bruce Quote Link to comment
crelf Posted October 9, 2008 Report Share Posted October 9, 2008 QUOTE (bmoyer @ Oct 8 2008, 11:48 AM) I incorrectly assumed that the Read from Text File function would leave my data unaltered (similar to the Read Characters from File function (now obsolete in newer LV versions) which has this EOL conversion defaulting to off), but it defaults to convert EOL=on (you have to right-click the VI to see this parameter, it's not an input like the other function). Right (this has bitten me in the past too). The CR+LF glyph on the icon connotes the differences in the functionality: http://lavag.org/old_files/monthly_10_2008/post-181-1223482436.png' target="_blank"> Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.