Jump to content

Lambiek

Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Posts posted by Lambiek

  1. There is a simple way using the select function. It takes a minute or two to test that it's correct with values just below, equal and just above each of the steps.

    I'm including a jpg of the diagram!

    Yours Sincerely

    John

    post-230-1111530954.jpg?width=400

    Just thought about this for a minute... It's a) upside down and b) the 8000 one has the wrong comparator... a not uncommon event in my programming!

    4299[/snapback]

    Thank you already for your answer :thumbup: , But it's not really clear what your meaning, what are the possible cases in the case structure ?

    I'm not sure I understand what your trying to tell me.... :(

  2. Hi,

    I'm rather new to LV, and while I'm experimenting and developing with a FP RT system, I'm stuck now.

    We're doing frequency measurements with a counter module (cFP-CTR-502), and in this context I need an algoritm that goes like this:

    A variable (I'll call it Divisor) has a value of 1 for starters and depending on the value of another variable (let's call it Count), the divisor should be multiplied, or divided by a value:

    count < 1000 => Divisor *3

    count < 500 => Divisor *6

    count < 250 => Divisor *9

    Count >16000 => Divisor *9

    Count >8000 => Divisor *6

    Count >5300 => Divisor *3

    Count between 1000 and 5300 => no alteration of Divisor.

    I tried to write code in a formula node(dlr==Divisor and Cnt==Count):

    float32 dlr=1;

    while (dlr<6250)

    {

    if(cnt<250)

    dlr=dlr*9;

    else if (cnt<500)

    dlr=dlr*6;

    else if (cnt<1000)

    dlr=dlr*3;

    else if (cnt>5300)

    dlr=dlr/3;

    else if (cnt>8000)

    dlr=dlr/6;

    else if (cnt>16000)

    dlr=dlr/9;

    }

    But this has two main problems:

    -All of my CPU time is taken (alltough it's in a while loop with a 'Wait untill next ms multiple')

    -'dlr' is allways reset to a value of 1, while it should be a more dynamic number

    Can Anyone give me a hint on how I should work this out ?

    thx

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.