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: 

Programmatically change a Text Ring

Is there a property node that allows me to change the selection of a Text Ring?

 

In my oscilloscope program I have to keep the number of samples from getting too high and throwing an error if someone changes the Time/Div to too long of a period for the sample rate.

 

I want my program to do the calculation and if the number of samples is too high then automatically decrease the sample rate, do the math, and repeat if necessary. 

 

The part I am stuck on is the actual changing of the Text Ring control. I cannot just increment or decrement it. Sell I can but as that changes the Sample Rate 1 sample at a time. Sure it would eventually get down there, but there has to be a better way.

 

SR1.png

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 25
(4,024 Views)

Advice.

 

Change the time instead of the sample rate, easier.

 

Or if you really want it to be digital scope like, in the olden days scopes had 500 points for 10 divisions, or 50 points per division. Some would let you have 5000 points per 10 divisions. What I am saying is have a text ring for the sampling rate that is the following: Normal, High, Maximum

Normal - whatever sample rate gives you 500 points in 10 divisions

High - whatever sample rate gives you 50,000 points in 10 divisions

Max - whatever the max rate, number of points is possible.

 

Normal Sample Rate 500/(Acquistion time)

High Sample Rate 50000/(Acquistion time)

Max Sample Rate (Max Num Points)/(Acquistion time)

 

 

User only sees Normal, High, Max You can make an indicator for the Real Sampling Rate

0 Kudos
Message 2 of 25
(3,997 Views)

Hmmm that is a idea but the requirements were for selectable sample rate control and Time/Div in the increments I have set in the Text Rings.

 

I have the part where is someone sets the Sample Rate too high for the current Time/Div but that's just pop up a warning and ignore the new setting. I was hoping to have the sample rate auto adjust when the user changes the Time/Div instead of just display a warning and ignore

 

I guess I will have to either do the same for this or abandon the Text Rings for TypeDef Enum control indexing the values out of an array. At least I can programmatically change the value of Enum

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 25
(3,995 Views)

This works for what (I think) you want. However, there's got to be an easier way. I just can't think of one at the moment.

 

text ring.png

Message 4 of 25
(3,986 Views)

All right my friend... let's ask the question.... WWYT?

I know mean of me.

 

First set the display format to SI units..you'll thank me later... double check but "%.0uSec" sounds close.

 

You have the values[] property.  And the values should all pe positive ascending monotonially even if it's a log scale.  Threshold values[] round up the resulting index, index values[] write value of the ring with the result.

 

Demo code left as an exercise for you.:D


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 25
(3,974 Views)

@jamiva wrote:

This works for what (I think) you want. However, there's got to be an easier way. I just can't think of one at the moment.

 

 


Maybe not the most elegant soultion but far better than the nothing I have come up with...

 

Thanks.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 25
(3,917 Views)

How about this?

snip.png

 

mcduff

 

 

Message 7 of 25
(3,911 Views)

Close mc duff.  

 

I would probably stick values and refnum of ring on a fbns, create cases init, close and coerce add error in out,

 

Init loads the fbns 

 

Close dumps them,

 

Coerce handles the ugly lut. And throws a custom error if refnum is not a refnum too

 

Wrap each method in a sub vi.

 

And you have a nice lvlib with 3 public vis ,API, and a private core engine and ctl.

 

Elegant and reuse ready


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 25
(3,880 Views)

@JÞB wrote:

 

And you have a nice lvlib with 3 public vis ,API, and a private core engine and ctl.

 


As much as I hate to drag my own thread off topic (not that dragging someone else's thread off topic bothers me) 😛  And I know this is going to sound very newbie but....

 

Can better you explain the benefit of using things like lvlib and llb's?

 

I never could figure out llb's, sometimes I find it hard to even get a sub-vi out of one. Last week I had to deal with one the only way I could figure out how to get one of the sub-vis out to use was to open the top level vi, then open the sub-vi and save the sub-vi separately outside of the llb. 

 

A while ago I was trying to complete some of the NI online training. Not ever having any formal programming training I did not understand many of the concepts and jargon they throw around. The project was a Boiler control system and it seemed like a lot and I mean a lot of extra effort to set up all the public, private, blah, blah, blah to make everything fit nicely into an lvlib.

 

I saw no real benefit to doing that and the training didn't really explain the benefits either. 

 

Don't get me wrong, I reuse code all the time, but I just make a sub-vi and stick it in my user.lib directory, or in the case where I have to make my own VI's for an instrument I put them in a sub directory either in user.lib or  instr.lib directory.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 9 of 25
(3,865 Views)

Its your thread. Take it where you want to go.  BRB with that example fleshed out and a few comments......


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 25
(3,855 Views)