10-29-2015 09:55 AM
Hello
i am trying get data from serial port (using putty). When data is acquring ,there was a problem in displaying data in laview. i am not able to get the exact count and i am getting some symbols like( $,@,&,!,) instesd of acual count. can you pleas help with the problem. so that i can acquire the data as in putty. i am attaching the Vi.
10-29-2015 10:40 AM
First, do not configure and close the serial port on every iteration of the while loop. Configure once before the loop starts and close once after it ends.
Next. Does your data use a termination character? Are you requesting enough bytes for it to get to that character? Is everything else in the configuration correct? Strange symbols are often an indication that the baud rate or other configuration values are not right.
Lynn
10-29-2015 10:54 AM
liviya wrote: i am getting some symbols like( $,@,&,!,) instesd of acual count.
That almost always points to a configuration issue (typically baud rate). Make sure your configuration is correct.
10-30-2015 06:31 AM
hello,
My configuration was correct. i am using the same configurations in both my micro controller and labview . still i am facing the same problem. i have used the same configuration previously and it worked fine. But it is not working now i don't know the reason behind it.
Thank you
10-30-2015 07:40 AM
The same way you can use PUTTY to "explore" the settings of a serial port, you can use MAX. Open MAX, open your serial port, configure it the way you think it should be (9600, N, 8, 1), and do a Read of, say, 1024 bytes. See what you get. If it is gibberish, try adjusting the configuration numbers. If it times out, try other things. If nothing seems to work, report back here. Otherwise, take the settings "that work in MAX" and put them in your program.
What do you know about the device that you are trying to read? Many devices have a termination character (you've configured your VI to expect one), but not all use the same ones. Also, notice that your VI has a Byte Count control (default = 0) -- if you are using a termination character, it might make more sense to use a constant of 1024 and let the termination character end the read. Others have already mentioned that the Serial initialization and closing should be outside the While loop.
Play with MAX, see what settings work with LabVIEW, put it in your code, and let us know the results.
Bob Schor
10-30-2015 08:49 AM
Hello,
i Have no idea What MAX is. i try to check it in internet but i didn't found any thing related to it. if possible please send me the link to download MAX.
1.What do you know about the device that you are trying to read?
I am transmitting the data from psoc to labview using serial communication. I have connected psoc to Geiger counter and measure the radiation of a material. which counts generally from 0 to 10000 in 1 minute. And i have to display this count on labview and i have to trasnfer those counts to a Spreadsheet for further calculations.
2. Many devices have a termination character (you've configured your VI to expect one), but not all use the same ones. Also, notice that your VI has a Byte Count control (default = 0) -- if you are using a termination character, it might make more sense to use a constant of 1024 and let the termination character end the read. Others have already mentioned that the Serial initialization and closing should be outside the While loop.
I am using a termination character and if i set it to 1024 byte count then i am recieving each cout 1024 times. if i set it to 1 then i am not getting proper count.
And also i done as said " the Serial initialization and closing should be outside the While loop."
I am attaching my VI, if i have done anything wrong please correct me.
Thank you
10-30-2015 09:09 AM
10-30-2015 09:42 AM
Exactly what character does the device send as a termination character? The default, which you are using, is Line Feed. If the device sends Carriage Return as termination character, you could get the results you describe.
Lynn
10-30-2015 10:52 AM
Yes, I'm agreeing with Lynn. You enabled the Termination Character by wiring True to the third "top" input, but you didn't wire the middle Top Input that specifies what the termination character is, leaving it as the default value, 0xA (linefeed, \n). Many (older) devices use 0xD (carriage return, \r) -- you might try using that and see if you get more reasonable results.
To see a full description of VISA Configure Serial Port, right-click on the function, type Ctrl-H to pop up Help, and click Detailed Help. There you will see how the Termination Character works.
Incidentally, when you did the read of 1024 bytes, what string did you get back? Do you know if it had \r, \n, other characters? How about showing us a typical string?
Also, click the Start Button (oh, I hope you are not using Windows 8...) and look in the list of programs for "NI MAX". You should also find it on your Desktop with this name (most of us just call it MAX). Here's what it looks like (in its most recent incarnation) --
Bob Schor
10-30-2015 02:03 PM
Hello,
You enabled the Termination Character by wiring True to the third "top" input, but you didn't wire the middle Top Input that specifies what the termination character is, leaving it as the default value, 0xA (linefeed, \n). Many (older) devices use 0xD (carriage return, \r) -- you might try using that and see if you get more reasonable results.
I have done as you said, but i am not sure weather i did correct or not. so please help me with the termination character to change from default value, 0xA (linefeed, \n) to 0xD (carriage return, \r), if was wrokng. And i have know idea how to change it. so please let me know who to do it ( if i dit it wrong)
Wait time is 250ms and byte count is 1024.
thank you