12-17-2019 06:22 AM
Hi All, i am stuck in problem regarding writing data to labview.
Actually i want to send/write data to any port so that i can read data from other computer on the same port. Also i need to know that is there any way to read data from graph and then send that data thorough port.
Attached is my vi screenshot in which i need to get data (Center frequency, gain)in numeric form from graph and then want to send it to any com port.
Solved! Go to Solution.
12-17-2019 06:27 AM
You can get data from the graph. If you attach your code so we can see how you are logging data we can help you with the advice that you need.
Are you looking for just the most recent value?
Are you looking for an average value?
Post your code and we can help.
12-17-2019 06:56 AM
@naumanhabib wrote:
Actually i want to send/write data to any port so that i can read data from other computer on the same port.
First step is to come up with a data protocol. You need a protocol to ensure all of your data is received. There are many ways to do this. Probably the simplest would be to use the Array To Spreadsheet String on your data. This will format it into a tab (default) delimited ASCII data stream that ends with an End Of Line character (Carriage Return and Line Feed). You can then write that out of your serial port. On the other side, you just tell the VISA Read to read more data than you ever expect in a single stream. In this case, I would probably use 4096. If you left the defaults for the termination character (enabled and set to 0xA, 10, Line Feed), then the read will end with the End Of Line character. Then you just use Spreadsheet String To Array to convert back into an array of values.
12-17-2019 07:35 AM
its a simple receiver just i need to find the current frequency and gain value and then send it to some com port. will be highly thankful if you post or refer me vi because i am beginner to labview
12-17-2019 08:09 AM
@naumanhabib wrote:
its a simple receiver just i need to find the current frequency and gain value and then send it to some com port. will be highly thankful if you post or refer me vi because i am beginner to labview
There are TONS of examples on these boards for communicating over a serial port. You could also look in the example finder (Help->Find Examples) for some over generalized examples. Give them a good look. Try some code of your own. Then report back with what you have (post the VI) and where you are having issues. You are asking way too generalized questions for us to really help.
12-17-2019 10:04 PM
ok. i will try but please give me a way to extract values out from graph like in my case of center frequency and gain values??? is there any way for this??
12-18-2019 08:01 AM
If you are referring to your Frequency Plot, then use the Unbundle By Name to get the "magnitude","df" (frequency step), and "f0" (first frequency in the graph) components out. You and use the Array Max & Min function to find the peak magnitude and the index of that maximum point. To calculate the frequency of that location, you use f0 + df*index.
12-18-2019 11:10 PM
Thank you soo much i exactly wanted this max value of peak but i am unable to get frequency of that location i.e i want to display current frequency information and want to get bandwidth of that center peak. Attached is my updated vi and screenshots of peak where i want to know about highlighted area of peak. is there any way to display highlighted bandwidth information automatically anywhere?? Will be thankful
12-19-2019 03:52 AM - edited 12-19-2019 04:02 AM
Hi naumanhabib,
@naumanhabib wrote:
i exactly wanted this max value of peak but i am unable to get frequency of that location i.e i want to display current frequency information and want to get bandwidth of that center peak. … is there any way to display highlighted bandwidth information automatically anywhere??
You already determine the max peak value. From the very same ArrayMinMax function you will get the index of that max peak. Now for some simple math:
freq := f0 + df × index
12-19-2019 04:17 AM
See i have tried this formula but not getting frequency of that max peak. Please if you can update my vi in which i get frequency value of that max peak. Thankful to you