11-03-2011 01:35 AM
Hiiii...
I'm developing a front end which reads the values from serial port and dispaly it on frontpanel.
The data is of 16 channels value which is in string form. I have seperated that string to read individual channel's data but at the end of for loop i can read only one channel data for one iteration and also I have to store each iteration value to a text file.
I'm new to labview. Please help. I have LabVIEW 8.0.
Attached herewith is my application code.
Solved! Go to Solution.
11-03-2011 09:13 AM
The 1 time for loop will only run once only giving you ONLY one of your results.
I am not to sure what you were trying to do with this.
Were you tying to write single lines of text to your file? Look at "Write To Spreadsheet File" fuction.
11-03-2011 10:34 PM
Hey I got the solution..
I used case structure to store 16 different values at different location. Using for loop i can't store seperate values so, i got confuse.
Thaaaaank Youuuuuuu,
Regards,
Manisha
11-04-2011 08:51 AM
That sounds pretty inefficient. Why do you use a case structure? Why don't you post your code.
As for the original code, were you trying to run this using the Run Continuously button? I ask because I don't see an overall loop, so it wasn't clear if this was intended to run as a simple subVI or "on-demand". If it's meant to run continuously until you stop, DO NOT USE THE RUN CONTINUOUSLY BUTTON. Use a while loop in your VI. Be sure to place the initialization and close outside of the loop - you do not need to initialize and close the serial port each time you loop around.
11-05-2011 12:09 AM
Thanks for your reply.
As I have already mention m new to labview, every time m chaging my code as i found new functions.
Sorry, but m not getting you. Everytime when I open my code I have to enter the data as well as 16 paths for serial communication. Can I store that permenatly? Is there any way to used that 16 channels value directly on frontpanel of second VI? I have developed two VI, one for serial communication & data writing into file and other is for reading that values n displaying it. M posting you both the VI. I have to read temperature values, its setpoint, hysteresis & depending on that i have to work on alarm conditions. The frontend is incomplete m working on it.
Please do the needful.
Thank you,
Manisha
11-05-2011
09:02 AM
- last edited on
03-27-2025
02:20 PM
by
Content Cleaner
Your approach is quite flawed. You do not need to write data to file just to have the data read in another VI. There are other mechanisms for that, such as queues. I'm not sure what you are intending to do with that "Front End" VI. How large of a monitor are you expecting people to have?
I would suggest looking at the producer-consumer architecture. The producer loop can read the data from the serial port and put the data into a queue. The consumer loop can simply read the data from the queue and update the indicators. I would suggest considering using a 1D array or 2D array for your data since you are basically talking about data from 16 channels. The link for the producer-consumer architecture is supposed to be this: http://zone.ni.com/devzone/cda/tut/p/id/3023. However, at the time I'm writing this the link is broken. You can create the basic pattern from LabVIEW using the templates (File -> New ...).
11-09-2011 03:18 AM
Hey I saw that Producer/Consumer architecture but m not getting, how it can be use in my code.
M facing one more problem in serial communication that, I have enabled the End Read On Termination Char, In continuous run mode the string is not displayed on read string. After passing one character m getting string of 64 char, that string is displayed only for some seconds. I have to read that data continuously in order to display it.
How can I pass end of read char to store that string?
Thank you for your reply.
Regards,
Manisha
11-11-2011 09:48 PM
Hellooo to all,
Guys pls give me some solutions I have to complete my code asap..
Now i want to pass one number, that indicates the enabled channels say if i pass 6 number then 6 channels are enabled n that many channels are displayed i.e. Channels 1 to 6 are enabled. How can i do this? Maximum no of channels can be enabled are 16.
Please help me out with this n my previous post.
Thank you,
Manisha
11-11-2011 10:42 PM
Do not use Continuous Run mode.
Put the parts of your code which need to repeat inside a loop. This likekly will be mostly the Read case structure. If you know how many times it will run use a for loop. If the number of iterations is unknown in advance, use a while loop. In either type of loop use a shift register to pass data from one iteration to another.
Lynn
11-13-2011 10:17 PM
Thanks for ur reply Johnsold.
That problem is solved. Now m facing another problem that serial communication timeout is 10 sec & my device gives me output in 5 sec, but still I can't read values in this 10 sec. Why is it so?? How do I can check that timeout is 10 sec.?
M posting my final code please lemme know any improvement in that & m still not getting how can I take that out put to other VI using queue?? The Front End VI is still not complete. I have to take data from RTD Scanner VI n display it on Frontpannel.
Thanks,
Manisha