09-21-2009 04:13 PM
I am using labview to send commands to a device using the com1 serial port. Using the example VI "Basic Serial Read and Write" I can communicate with my hardware just fine, can write and can read. the problem comes when I want modify the VI by using my own string instead of the string supplied in the example. When I create a string constant with the same exact text that was in the example's string box I cannot write to my hardware.
I dont understand why this wont work. Is there something special about the example VI's text box "string to write" that I dont know about?
Please help
Solved! Go to Solution.
09-21-2009 04:22 PM
If you right click on the examples string control and select "\" codes display, you will see that \r\n is present which represents that a carriage return and new line character is added to the command, which most serial command writes require.
-AK2DM
09-21-2009 04:30 PM
Thanks
I know what you mean and it isn't working that way. For some reason if I use a string constant with \r\n it still does not work.
Anyway I solved the problem in a roundabout manner. The command I am sending is one word but two parts; first part text, second part number. I want to create a loop where the number changes. I was able to do this by combining three strings, the first is a copy of the example's string, the middle is my number converted to string, the third is a different copy of the examples string. Now it works and I can get on with my life