Sign in to follow this  
Followers 0
Datman

How many one's!

32 posts in this topic

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
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
That is inversely proportional to the ingenuity of your fools.

Share this post


Link to post
Share on other sites
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
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
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
I'll let someone else advance it to the next level.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0