From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Data Write

Solved!
Go to solution

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.

0 Kudos
Message 1 of 24
(4,037 Views)

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.

Tim
GHSP
0 Kudos
Message 2 of 24
(4,034 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 24
(4,010 Views)

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

0 Kudos
Message 4 of 24
(3,997 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 24
(3,985 Views)

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??

0 Kudos
Message 6 of 24
(3,907 Views)
Solution
Accepted by topic author naumanhabib

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 24
(3,834 Views)

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

Download All
0 Kudos
Message 8 of 24
(3,677 Views)

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

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 24
(3,523 Views)

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

0 Kudos
Message 10 of 24
(3,505 Views)