Hi guys,

The delay library contains some things I do not understand. Take for example the delay_1ms procedure:

-- Delays for n * 1 msec
procedure delay_1ms(word in n) is
   const _one_ms_delay = 1000 - ((14 * instruction_time) / 100)
   for n loop
      if (_one_ms_delay <= 1000) then
         _usec_delay(_one_ms_delay)
      else
         _usec_delay(1)
      end if
   end loop
end procedure

The conditional expression of the if-statement in the for-loop seems to be always true (provided the instruction time is not negative!).
And when the 'if' is not useful the 'else' can be eliminated as well.
Or am I overlooking something?
Even when the 'if' is needed a delay of 1 usec is neglectable compared to the number of instructions in the rest of the procedure, which would be another reason to ditch the else branch.

Joep I think you were the last to tune the delay library (although your name is not in 'Adapted by'). Could you explain?

Regards, Rob.

PS: A similar if-then-else construction is in the delay_10us procedure, but not in the delay_100ms and delay_1s, why?

--
Rob Hamerling, Vianen, NL (http://www.robh.nl/)

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to