Posted 18 Apr 2007 Alaric's example is not recusive. It is just a simple loop. There are bit counting algorithms that don't require loops. I would lean toward them now that I have 32 bit and 64 bit computers available. They are more deterministic as far as the time they take. That isn't a big issue with PLCs but in what I do it is nice to know exactly how long a sequence of code takes. We literally count nanoseconds. Back in the dark ages I used look up tables so I could count the bits a byte at a time. Bubba shouldn't need to know how it works. He only needs to know that it works. Bubba shouldn't have to play with this code. . Share this post Link to post Share on other sites
Posted 18 Apr 2007 I decided to do this too, does make the program readable as everyone says. It certainly looks like it will run fast enough which was my main concern. So I agree with you Alaric, I think ill leave it as is, and be happy in the knowledge that its pretty foolproof! Share this post Link to post Share on other sites
Posted 18 Apr 2007 That is inversely proportional to the ingenuity of your fools. Share this post Link to post Share on other sites
Posted 8 Jul 2007 How about a replacement for the FBC instruction? For-Next loop out in a subroutine? Pass ParaMeters? Share this post Link to post Share on other sites
Posted 8 Jul 2007 Did you check out the code I wrote as part of post #14 of this thread? Share this post Link to post Share on other sites
Posted 9 Jul 2007 Yepper Looks good as far as it goes. I was thinking a little more ambitiously. A complete replacement for FBC. Or at least the main function of comparing a PILE of bit to another PILE of bits and flagging the differences in a Third pile of bits. Share this post Link to post Share on other sites
Posted 9 Jul 2007 I'll let someone else advance it to the next level. Share this post Link to post Share on other sites