Sign in to follow this  
Followers 0
BobB

Multiply Table

6 posts in this topic

I have a heap of values being entered into data memories from a screen. These values will be utilised as timer set points. I also have a variety of timer value multipliers. The values being entered are for a total 20 second run time - the multipliers are 2, 3 and 4 to give 40 second, 60 second and 80 second run times. I can set the multiplier easily in a data memory from bit values - multiplier 1, 2, 3 and 4. I would like to be able to multiply the whole table of 40 words by the multiplier instead of having to multiply each value separately - lot of code. There are 2 sets of these so a total of 80 words to multiply. I guess I am looking for a block multiply that works in a similar way to BSET - multiply a range of DMs. Any thoughts at all? I have racked my small brain all day over this one. Hope the thread makes sense. Later I will have another stupid question re calculating percentages for timers - that also may be interesting - but not for now - have to get a job out the door. Edited by BobB

Share this post


Link to post
Share on other sites
Hi Bob: From the Addresses and Instruction you mentioned, this is obviously an Omron PLC. Which Omron PLC Model is it though? Stu....

Share this post


Link to post
Share on other sites
Hi Stu Ah!! Data memories and BSET gave it away. CJ2M-CPU33 - same as CJ1M except USB + Ethernet IP. Screen is Beijer 10" sunlight readable - dislike Red Lion immensely. Have had to find some decent bitmaps though - they use the same horrible library as Red Lion. I only use the CJ2, CS1 and CP1 in various forms these days - basically the same instruction set and CX-P. Good software, good hardware, 2 year warranty. I have been unable to figure out a way to block multiply - would sure make my life easier. Pretty good on Omron to be honest but this one had me stumped. The next one will be interesting too - will have to use floating point but FIX truncates the decimal point and the timers only accept decimal or BCD - lose the decimal point - next job though. Regards Bob Edited by BobB

Share this post


Link to post
Share on other sites
Well, I haven't done anything with a CJ2M, but the first thing that comes to mind is a For/Next Loop if the CPU33 supports it. Stu.....

Share this post


Link to post
Share on other sites
Hello Bob I know how much you love function blocks, but there's no better way, I'm afraid! This FB wants the multiplier, the D location of the input table, and the D location of your results table. The D area is implied internally, so it just wants the address. All data types are UINTs, but changing to another is easy. In the example, the input table starts at D0, and the results appear at D40. The multiplier is hard coded as &4; make this your variable. Pp ForBob.cxp Edited by ParaffinPower

Share this post


Link to post
Share on other sites
May favourite pastime - thought that would probably be the only way. Thank you.

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