01-22-2010 01:57 PM
printf("T%3.2f,H%3.2f",fTemp_true,fRh_true);
And I read data with Hyperterminal it show this T29.11,H67.88 I want to show 29.11 and 67.88 only and stroe in database. I study connect serial port in example and I have a question. If I use this code.Can I auto read every 1 minute or this code can read 1 time only and I have to click every 1 minute.How to auto read when I send data to serial port with microcontroller every 1 minute. And I cannot substring 29.11 and 67.88 because %3.2f can show T29.11,H67.88 or T129.11,H100 . and How can I simple send data to database. Thank you .
01-22-2010 02:41 PM - edited 01-22-2010 02:42 PM
No, you don't have to click run every minute. You just need to place a while loop around the VISA Read. You could use Wait (ms) but it would be better to use something like the Elapsed Time function and wire the time has elapsed output to a case statement with the VISA Read inside the true case.
This is one way to parse the string:

If you have the database connectivity toolkit, you can easily write to a database. There is also something called LabSQL.
01-24-2010 03:30 PM
This code I use while loop around the VISA Read .It can refresh value in read buffer when have new value from the serial port.but It show value in read buffer for a moment about 1-2 secound only. I want to show value until have a new value from serial port . Serial port recive value from microcontroller which microcontroller send data to serial port every 1 minute.
This code I use case statement .It can't show value because read buffer line and VISA Close line is white tunnel.Microcontroller send data to serial port every 1 minute.I want to show value in read buffer and refresh value every 1 minute before I will study parse the string.How to show value in read buffer and refresh value when have new value from serial port.
01-24-2010 04:16 PM
You really need to place the string indicator inside the while loop. Otherwise, you won't see anything until the while loop stops. You could also use the VISA Bytes at Serial Port to determine when to do a read. When the byte count is greater than 0, do the read. You could use a shift register with a concantanate string function. You would then be appending the new string to the older string.
Lastly, I would recomend you look at the basic LabVIEW tutorials.
01-26-2010 04:44 PM - edited 01-26-2010 04:52 PM
I use this code improve it can show data about 5 secound.but I want to show until have new data from microcontroller.Microcontroller send data 1 time only per 1 minute
If I use this code it can show data about 1 secound only I can see in a wink.How to show data until have new data in serial port.
01-26-2010 09:11 PM
I don't understand what you want. The indicator will display the last reading until something new is received. If the device is sending data every minute, then your loop program will timeout and generate an error. Why don't you use the Elapsed Time function like I originally suggested? Wire the time has elapsed function to a case statement with your VISA Read code inside.
Your bottom VI will only take a single reading and stop until you hit the run button. Do NOT use the run continuous button.