mmeeks

Resetting Intergers

4 posts in this topic

Hi all.  I am in need of a little help here.   I am doing some stats that i put into intergers.  3 times a day i reset about 45 intergers and 40 floats all at the same time.   They are N21:0-N21:45 and F22:0-F:40.   The same bit resets all these.  Is there a way i can put this all in 1 line instead of adding 45 branches.  Any help would be highly appreciated as this is hurting my scan time now.  

 

Thanks

Share this post


Link to post
Share on other sites

Not sure how much it will help your scan time, or exactly what processor you're using, but look at the FLL instruction:
FLL.JPG.b7ac9ca4e3edaec5ef7b4eb0d7ffca6d

If your processor doesn't have FLL, use COP. It works similarly, but you'll have to use an address for the Source that's always zero. Or, use a MOV instruction to put a 0 in the first register and then a COP to copy that value through the rest of the array:
COP.JPG.d1210eb64daed8ed13776e2ee6188cc7

Check out the online instruction help for FLL, COP, and MOV to get familiar with them.

 

 

Share this post


Link to post
Share on other sites

Joe,  

Thanks so much for the help there.  That helped clean up the program alot.  I was searching for ways to do that for awhile and couldnt come up with anything.  I am using a Micrologix1400 series B.   The scan time was at 210 now im at 133.   I am doing stats of how that has 5 numbers that i track every hour.  What i found is if i only look at these lines when its that time this will help the scan time tremendous.  As right now its doing about 150 lines of math every scan.  This will go down to about 20 or 30 a scan.  Thanks for the Help much appreciated. 

Share this post


Link to post
Share on other sites

FLL always works best when you're clearing an array. I'm a big fan of the CLR instruction when zero-ing a single word of data. 

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