06-14-2010 02:14 PM
RossGE wrote:
I have my hardware working in Hyperterminal now and have pulled up the basic serial example but Im having trouble understanding how it works.
What are you having problems understanding? In your case you do not need to write anything out, so the Write toggle switch would be set to False (down). When you run the VI (after setting the correct serial port parameters) it should read whatever is on the serial port.
Do i need to just copy the example into my program to get the numbers inputted into my code?
Not entirely. I don't know what you've got set up as code is concerned, so without knowing anything else you'd have some sort of loop. You initialize the serial port before the loop, read from the device inside the loop, and do whatever you need, and then close outside the loop (see the "Advanced Serial Write and Read" example for this basic structure). You still need to determine whether the device ends its response with a specific character. This is so you can configure the serial port read to either terminate once it sees a specific character (as the "Advanced Serial Write and Read" example does), or whether you need to use the Number of Bytes at Serial Port inside your loop(as the "Basic Serial Write and Read" example does). Do you know whether the device uses a termination character? When you see the data streaming across in HyperTerminal is it all on one line, or is it one measurement per line? If it's one measurement per line then a termination character is being used. You need to find out what this is. You can find out by saving the transmission to file and then open the file with a hex editor, or you can use PortMon.
06-14-2010 03:49 PM
I got the input to send into labview and I believe it is inputing in an acceptable way. However, I'm not sure if it is the best way to input the data and when i try to convert the strings into numerical data no data is outputted out of the converter. Could you look at this and tell me where i am going wrong?
06-14-2010 03:58 PM
Don't put your Serial port configuration in the while loop. Put it ahead of the while loop. Reconfiguring the port every iteration is probably wiping out your buffer.
Are you sure 100 msec is enough of a delay to be getting data back? Put an indicator on the output of bytes at port so you can see how many bytes you are actually receiving.
06-14-2010 04:17 PM
Ravens Fan wrote:Don't put your Serial port configuration in the while loop. Put it ahead of the while loop.
Well, I'm glad to see that he's paying attention to what I'm saying.
RossGE wrote:I got the input to send into labview and I believe it is inputing in an acceptable way. However, I'm not sure if it is the best way to input the data and when i try to convert the strings into numerical data no data is outputted out of the converter. Could you look at this and tell me where i am going wrong?
I have no idea if the Decimal String to Number is even correct because you have not given us any example of what you actually get on the serial port, and as I've already mentioned twice now you need to perform your read based on how the device sends the data. If the device adds a termination character then that's how you should be performing the read. If it does, but you use the Number of Bytes at Serial Port then you could be reading part of one measurement and part of the next. The conversion in this case will be gibberish.
06-15-2010 10:17 AM
06-15-2010 10:25 AM
It's pretty clear you have not read the help on the Decimal String to Number function. It clearly states that the conversion is to integers. You want Fract/Exp String to Number.
Go to the help menu and turn on Context Help. Move your mouse over a function and read the help. Click on the Detailed Help.
06-15-2010 02:37 PM
06-15-2010 03:27 PM
In your Untitled3 VI:
RossGE wrote:
Yes I had the help menu up i had tried both the two converters I had to change the number of digits in the properties.
The number of digits of what? Are you referring to the precision/significant digits? You can, of course, change that to whatever you want, depending on how you want the number displayed in the indicator. You must use the Fract/Exp String to Number, however, since that's the string you're getting.
I have completed the program but sometimes my progam loses the decimal, the negative sign or just puts out zeros and when i run it highlighted it the converter gets over run i think that i have my termination character settings off how do i go about finding the correct setting.
There are many ways to find out what the termination character is:
06-15-2010 06:45 PM
06-16-2010 08:42 AM
Thanks changing the byte count on the string converter is allowing me to output the proper size. However, when i deleted all the information between the serial port and the while loop the converter begin to get over run with data.