TM221CE16R Calculation Issue

QasimFSH

Member
Join Date
Apr 2018
Location
Adelaide
Posts
142
Hi Everyone,

I am facing some very unique issue (at least unique for me), which is simply a problem in calculation! Please have a look at the picture attached!

Its this %MW10 which I don't know why is causing issue in this simple addition. If anyone has any clue about it, please help me.

I am using SoMachine Basic, with TM221CE16R.

Thanks.

PLC Issue.png
 
Well...

As your prompts show, you have 9238 + 9386 + 9353 + 10311 = 38288.

I believe that, if your answer is a 16-bit value, the highest it can be is 32,767.

Please correct me if I'm wrong.

If the number is higher, it will become negative because the 16th bit is the sign.
 
Last edited:
%MW13 definitely needs to be a 32 bit variable.

I'm not really up to speed on whether you can add 16 bit variables together and get a 32 bit variable so you may need to change all of them.
 
You should use DWORD instruction to change %MW 16 bit to %MD 32 bit then sum result to %MD (%MD use 2 words e.g. %MD0 use %MW0 and %MW1 then you should not use %MW0 or %MW1 in your program)

M221_DWORD_01.jpg
 
%MW and %MD memory ranges are overlapping... for example %MD0 and %MW0 are pointing to same memory location. %MD0 takes %MW0 and %MW1, %MD1 takes %MW1 and %MW2, %MD2 takes %MW2 and %MW4...
 
As goghie said you use %MD overlap %MW in your program I will describe like this

%MD0 use %MW0 and %MW1
%MD1 use %MW1 and %MW2
%MD2 use %MW2 and %MW3

that conclusion

1. If you use %MD0 you should not use %MW0 or %MW1
2. If you use %MD0 you should not use %MD1 and available every 2 words (%MD0, %MD2, %MD4, %MD8, etc)

Please see example bewlow to use with your program.

M221_DWORD_02.jpg
 
I don't want to throw this thread off on a curve ball, but I appreciate enlarging my understanding of Somachine Basic when I can.

what is the value of the "SHORT" block at the beginning of your rung?
 
I don't want to throw this thread off on a curve ball, but I appreciate enlarging my understanding of Somachine Basic when I can.

what is the value of the "SHORT" block at the beginning of your rung?

With lot of PLCs you can't start rung without some contact or operation that returns TRUE or FALSE value, so in Somachine there is LD 1("SHORT") - it's something like Always ON.
 
Hi again,

Does anyone of you know what is the function of rising and falling edges? I essentially want to trigger a timer once a coil is turned off, after being on.

Thanks guys
 

Similar Topics

HI All, I have to use thermocouple (sine the give voltage as output), and I have two analog inputs in my TM221CE16R, which are voltage dependent...
Replies
4
Views
1,861
Hi All, I have a little confusing in connecting the inputs to TM221CE16R, Schneider PLC. And this is the first time I am using a PLC, though I am...
Replies
0
Views
1,131
Hi ALl, I am using TM221CE16R for my plant automation. This controller of schneider only accepts 24v dc as input. Less than 5v is a definite low...
Replies
2
Views
1,432
Hi all, hope you all had a good Christmas, just working on a project for a customer and am going to be using a TM221 from Schneider Electric. Has...
Replies
35
Views
15,815
Does this instruction calculate values during a single scan, or does it require number of scans based on element count in the array? For Example...
Replies
3
Views
108
Back
Top Bottom