PDA

View Full Version : MAX MIN vs IF



netstranger.nz
- 1st March 2013, 02:07
Hi Guys

I had couple of minutes to investigate the MAX and MIN and ways around them as the syntax seems upside down TO ME. Here is the result.
I know it isn't much of a difference but why use something that is less clear and less efficient?

Acetronics2
- 3rd March 2013, 10:24
Hi Guys

as the syntax seems upside down TO ME.?

Just understand it as MIN or MAX of the two values ...

BTW ... your use here seems a bit strange ... @ the speed you run Why not make use of a Hardware comparator or an ADC measure ???

the 1.5v trip limit of the inputs is ... not so precise ( absolute value ) ... especially if some capacitive circuitry around ... added to the high slew-rate of your signals, the result is quite predictable ... ;)

The difference in time you see is due to the different working values comparing macros ... just have a look to the produced .asm, and you'll understand that ...

AND .. YES, MIN and MAX commands are slower than IF-THEN ...

Alain