Not equal...
If PayPacket<>Expectations goto NewJob
Sorry, I didn't really explain it properly.
I need to check if var2 is between (var2-var1)/2 and (var3-var2)/2 etc.
Keep your motor running
Hello Moby,
Moby>>I need to check if var2 is between (var2-var1)/2 and (var3-var2)/2 etc.<<
Not sure if I understand fully but...
if(Abs(Var3-Var2)=(Var3-Var2)) then Do whatever
This equation will make sure Var2 is lower than Var 3
Use this equation again with the other variable..
if(Abs(Var3-Var2)=(Var3-Var2)) &&
if(Abs(Var2-Var1)=(Var2-Var1))
Then do something
This equation makes sure Var2 IS lower than Var3 AND
Var2 is greater than Var1
This is written in Psuedo code...but the idea is exactly the same..
I think in PBP it will look like this:
if(Abs(Var3-Var2)=(Var3-Var2))
if(Abs(Var2-Var1)=(Var2-Var1))
Then do something
Endif
Endif
I am at work, I have no way to check the syntax out.
Dwayne
Last edited by Dwayne; - 31st March 2005 at 16:58.
Ability to Fly:
Hurling yourself towards the ground, and missing.
Engineers that Contribute to flying:
Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute
Pilots that are Flying:
Those who know their limitations, and respect the green side of the grass...
That's sort of it Dwayne but not quite. I think it's my inability to explain it that's the problem.
Imagine a product was made with one of say 5 identity resistors and there are also fake products which use different resistors.
To determine if the product is genuine you would need to measure the resistor in the product and check to see if it was the same as one of the expected 5, within a certain tolerance.
I can set an array of the 5 expected values and when I measure the product resistor I want then to check it against the array values. It's simplifying that process that I can't quite work out.
(Just to say, the actual resistance doesn't need to be calculated, I just work on raw adc readings, having done measurements with a resistance box.)
Keep your motor running
my suggestion, take a/d reading of your expected resistors. store these value in the internal eeprom, in an array or variables. allow a error %,
your program must compare your product reading to all your value store in array, internal eeprom or variables with your error %.
what are your target resistors values???
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hello Moby,
Real var byte
Test1 var byte
Test2 Var byte
Test3 var byte
Test4 var byte
Test5 var byte
if (abs(Read-Test1)less than Tolerance) then output REAL items!
if (abs(Read-Test2)less than Tolerance) then output REAL items!
if (abs(Read-Test3)Less than Tolerance) then output REAL items!
if (abs(Read-Test4)Less than Tolerance) then output REAL items!
if (abs(Read-Test5)less than Tolerance) then output REAL items!
I had to type in Less than, instead of using the sign, because of the
html coding.
There you go!!
Dwayne
Last edited by Dwayne; - 31st March 2005 at 16:23.
Ability to Fly:
Hurling yourself towards the ground, and missing.
Engineers that Contribute to flying:
Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute
Pilots that are Flying:
Those who know their limitations, and respect the green side of the grass...
Thanks folks. I think Dwaynes answer is the way to go. I will try it and let you know how I get on.
Keep your motor running
The way that works is the following.
Lets say we are checking resisters, and need to know if they are within a certain tolerance....
say within 5 pecent....
Your known resistance is 1000 OHMS, and 5 percent is 50 ohms
The ABS function works as the following:
Lets say TEST is 1500 homes
ABS(test-1000)=500
Thus If (test-1000)<50 then output good resistor! (but its not less than 50)
Lets say TEST=900
ABS(test-900)=100 (if the value is negative, it changes to postive)
Thus If (test-1000)<50 then output good resistor! (but its not less than 50)
Lets say TEST = 970
ABS(test-1000)=30
Thus If (test-1000)<50 then output good resistor! (Wonderful!! good part)
Dwayne
Ability to Fly:
Hurling yourself towards the ground, and missing.
Engineers that Contribute to flying:
Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute
Pilots that are Flying:
Those who know their limitations, and respect the green side of the grass...
Bookmarks