LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

logarithmic Knobs in LabWindows/CVI 7.0

Hi,

I´m using LabWindows/CVI in Version 7.0... I´m wondering if there are any logarithmic Knobs.
I can only find numerics with linear Values.... but i can´t find an option to set them to logarithmic.

anyone any hints how to find them... or an workaround?

Manuel H

PS: sorry for my little english.
0 Kudos
Message 1 of 7
(3,846 Views)
Dear Manuel

I would workaround it by something like this:



int CVICALLBACK CBKnob (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event) {
  case EVENT_VAL_CHANGED:
    GetCtrlVal ( gPanel , PANEL_NUMERICKNOB , &gLinVal ) ;
    SetCtrlVal ( gPanel , PANEL_NUMERIC, log ( gLinVal ) ) ;
    break;
  }
 return 0;
}


This reads the linearly altering value from my knob control and displays the log of it on my numeric control.

Best regards

Philipp Roessler
0 Kudos
Message 2 of 7
(3,816 Views)
hmm yes if tryed several workarounds and if tryed your solution already.

int CVICALLBACK Knob (int panel, int control, int event,
        void *callbackData, int eventData1, int eventData2)
{
    double LinVal;
    switch (event)
        {
        case EVENT_VAL_CHANGED:
           
            GetCtrlVal ( panel, PANEL_NUMERICKNOB , &LinVal ) ;
            SetCtrlVal ( panel, PANEL_NUMERIC, log( LinVal ) ) ;

            break;
        }
    return 0;
}

int CVICALLBACK Num (int panel, int control, int event,
        void *callbackData, int eventData1, int eventData2)
{
    double LogVal;
    switch (event)
        {
        case EVENT_VAL_CHANGED:
            GetCtrlVal ( panel, PANEL_NUMERIC , &LogVal ) ;
            SetCtrlVal ( panel, PANEL_NUMERICKNOB, exp( LogVal ) ) ;

            break;
        }
    return 0;
}


however i have to hide the markers on the knob otherwise the user gets confused. 😞
Too sad, that the numeric knob looks really bad without markers.

In an other try I used a Ring Knob instead of an Numeric and gave that knob logarithmic values.
It looked nice, but the user can´t use the numeric field to key in exact values.
So I made an extra numeric field (just like in the application above). So the user can key in exact values...
but I can´t put the ring knob back to its right position. 😞

Message Edited by Manuel H on 02-14-2007 03:51 AM

0 Kudos
Message 3 of 7
(3,796 Views)
Dear Manuel
 
What do you mean "... can´t put the ring knob back to its right position."
 
You don't need to take the log() or exp() if you implement your example with a ring control, right?
 
Best regards
 
Philipp
 
Message 4 of 7
(3,784 Views)
[QUOTE = Philipp]
What do you mean "... can´t put the ring knob back to its right position."
[/QUOTE]

For example the ring knob is having these values 1,2,5,10,20,50,100 etc (okay its not really exp but it should do fine)
and the user wants the value 12.5 and types this to the numeric box... i can´t tell the ring knob to go to 12.5.
However I could say: I approach the value and set the ring knob to 10. But i don´t think this is a nice solution.

EDIT: sorry for wrong rateing your first post... i´m not into this thing and though its about grades like in school.
know i mentioned the little (best) next to the 5.

Message Edited by Manuel H on 02-14-2007 08:30 AM

0 Kudos
Message 5 of 7
(3,775 Views)

Dear Manuel

I think you're at a loss here: if you use a ring knob, you can make it logarithmic but only have discrete positions; and a numeric knob can't be logarithmic.

Best regards

Philipp Roessler

 

0 Kudos
Message 6 of 7
(3,740 Views)
Hi Philipp,

finally I found a workaround for this problem. Its not the best solution but it okay for me right now.

I´m using Ring Knobs with log values and a numeric field below.
If the value of the numeric field does not match my Ring Knob values i add a new item to the ring.
For example the ring has these values: 1,2,5,10 and  the user types 7 to  the numeric field i add a new item to the ring between 5 an 10 an name it 7.
If the user now types a 4 i delete the 7 and add the new item between 2 and 5.

if anyone is interesseted in the code oder has any better idea... just reply here.

Manuel
0 Kudos
Message 7 of 7
(3,696 Views)