Discusiones sobre Productos NI

cancelar
Mostrando los resultados de 
Buscar en lugar de 
Quiere decir: 

Recorrer un menu ring

¡Resuelto!
Ir a solución

Hola,

¿como puedo recorrer un objeto de tipo "menu ring"?

Me explico: quiero realizar un programa que recorra un espectro de frecuencias, desde una frecuencia inicial hasta una final, ambas seleccionadas en dos menus ring. Las frecuencias no son secuenciales, comienzan en 25 Hz, 30Hz, 50 Hz... y así, no tienen un paso fijo. 

 Se me ocurrió incrementar en una unidad el primer menú ring y usar la puerta lógica Round Toward +Infinity, pero no funciona (si está seleccionado 25 Hz, redondea a 26 y no a 30).

No se me ocurre como puedo llevarlo al cabo, ¿quizás con algún property node?

Gracias de antemano

0 kudos
Mensaje 1 de 6
3.310 Vistas

Uncheck "sequential values" and you can have any value for a given entry.

 

altenbach_0-1575851750739.png

0 kudos
Mensaje 2 de 6
3.291 Vistas

I've already done that, but my problem is that I don't know how to go over each value automatically.

 

This is part of my block diagram. I introduce an Initial frequency (choosen by user), which goes to a .vi of my instrument. Then I increment the frequency (that's what I want that it occurs automatically, to the next value of the menu ring), and I compare it with Final frequency (also choosen by user). If it is greater, leaves the loop. 

 

I want to eliminate the Step block and end the loop at Final frequency.

 

Captura de pantalla completa 09122019 24546.bmp.jpg

 

0 kudos
Mensaje 3 de 6
3.269 Vistas
Solución
Aceptado por el autor del tema sangvalle

Since all your options have the numeric value written in each option, you could do something as simple as parsing that string to get the frequency. This method would be pretty straight forward, given an Enum with the options ordered:

Screen Shot 2019-12-08 at 10.02.49 PM.png

 

However, if you plan to have an "Invalid" option, or more complex options sometime in the future, I recommend exploring the use of a Map that links your Enum values with their frequency.

 

All the best,

0 kudos
Mensaje 4 de 6
3.212 Vistas

Thank you so much!!

With your help, I found a way to do the same with menu rings 🙂

Thanks!

Captura de pantalla completa 09122019 172345.bmp.jpg

0 kudos
Mensaje 5 de 6
3.177 Vistas

Sounds good! I recommend you change to TypeDef Enum as in my example, instead of stand alone Rings. This will easy your life whenever you need to change one of the values in the ring, as a Type Def will keep all of its instances in sync.

 

Good luck with your project!

Mensaje 6 de 6
3.158 Vistas