From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Read VISA on specific Bytes

Solved!
Go to solution

Greetings,

 

I have been working around and couldnt get the result so posting here.

Basically, the real time  serial data is stream on floating points  for example "22.22,11.11" .

Now I want is to read the first 11 bytes and  VISA should generate an interrupt which will then sort the after and before comma values and plot real time graph. And repeat this process. The value is received for every 500ms and everytime it should read the 11 bytes and no blank spaces to be read it must retain its previous value.

I have attached my VI so as to look what mistakes I have done.

Awaiting Reply.

0 Kudos
Message 1 of 5
(3,483 Views)
Solution
Accepted by topic author curiousmech

Hi mech,

 

what's the point in setting an VISA event?

 

Now I want is to read the first 11 bytes

Then why do you wire "Bytes At Port", when you want to read 11 bytes?

 

sort the after and before comma values

Why not use SpreadsheetStringToArray instead of the while loop?

 

Why do you close the VISA ref after reading just one data set, when you want to receive values each 500ms?

 

Try something like this:

check.png

Note: when you use a TermChar as you have configured at SerialPortInit  you should actually use a larger number of bytes to read…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(3,462 Views)

Thanks for the help GerdW, While i am in learning phase, I am glad i got good guidance.
Bytes At Port was used to determine bytes and cross check it.
Your vi helped alot, but want to clarify few things, what is the block called attached to the indicator "output array "?
Also, can two delimeters be mentioned in spreadsheet string to array?
The string format u used has "point" after the first ampersand what does that mean? Can string format be defined to read specific decimal point like we do " %03.1f " ?

0 Kudos
Message 3 of 5
(3,359 Views)
That's a BuildArray function...
And all those format codes are explained in the help!

Sorry, I'm on mobile right now: no LabVIEW available right now.
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(3,349 Views)

@curiousmech wrote:

The string format u used has "point" after the first ampersand what does that mean? Can string format be defined to read specific decimal point like we do " %03.1f " ?


The "%.;" sets the decimal point at the decimal seperator.  Important for those places where a comma is used.  You can set the format string to whatever you want.  When in doubt, give it a try and see what happens.


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 5
(3,344 Views)