Tia Portal Rs485 communication with plc

It is actually lower than what we expect isnt it? 10kg is 10000 gram, right? So giving me 6000-7000 is actually giving me a lower value then i expected. Could this be a energy value though? Maybe i need to scale this so that i can find my actual weight.
That is too much difference for it to be just calibration that is needed. Something else is wrong.
I suspect that you need to set the transmitter to match the mV/V of the loadcell. On the side of the transmitter it says range 1-10mV/V, so it must be configurable.
If for example, the loadcell has an output of 3mV/V and the transmitter is set to 4mV/V, then it can explain the greater part of the error you are seeing.
 
It is actually lower than what we expect isnt it? 10kg is 10000 gram, right? So giving me 6000-7000 is actually giving me a lower value then i expected. Could this be a energy value though? Maybe i need to scale this so that i can find my actual weight.

If 10kg was 10000 in Register.Reading_val[1], then 100kg would be 100000 (100k), which would be too large to put into 16-bit two's complement (signed) Int Register.Reading_val[1], even if negative values (-32768 to -1) were converted to positve (+32768 to +65535). The next register, Register.Reading_val[2], (TUNA Register 9 = Modbus Address 40010) would be non-zero to handle the overflow.

If 10kg was 6000-7000, then 100kg might not overflow and be -536 signed = 60000 unsigned, but I think that is unlikely.

What is the value in Register.Reading_val[2] when there is a 10kg object on the loadcells? Better yet, expand the array Register.Reading_val to [0..25], and read all 26 TUNA registers, 0 to 26, by assigning 40001 and 26 to DATA_ADDR and DATA_LEN, respectively, and posting the results here.
 
If 10kg was 10000 in Register.Reading_val[1], then 100kg would be 100000 (100k), which would be too large to put into 16-bit two's complement (signed) Int Register.Reading_val[1], even if negative values (-32768 to -1) were converted to positve (+32768 to +65535). The next register, Register.Reading_val[2], (TUNA Register 9 = Modbus Address 40010) would be non-zero to handle the overflow.

If 10kg was 6000-7000, then 100kg might not overflow and be -536 signed = 60000 unsigned, but I think that is unlikely.

What is the value in Register.Reading_val[2] when there is a 10kg object on the loadcells? Better yet, expand the array Register.Reading_val to [0..25], and read all 26 TUNA registers, 0 to 26, by assigning 40001 and 26 to DATA_ADDR and DATA_LEN, respectively, and posting the results here.

Register.Reading_val[2] is still 0 when there is a 10kg object on the loadcell. I will try to expand the array and see how that works out.


That is too much difference for it to be just calibration that is needed. Something else is wrong.
I suspect that you need to set the transmitter to match the mV/V of the loadcell. On the side of the transmitter it says range 1-10mV/V, so it must be configurable.
If for example, the loadcell has an output of 3mV/V and the transmitter is set to 4mV/V, then it can explain the greater part of the error you are seeing.

OK so this worked out. I changed my mV/V to 1 and my 10kg weight gave me big numbers, 9 gave me really small numbers on my 10kg(500-600). So i played around and found that the 2mv/V is the right one. I Now can see my 10kg without a problem. But something really did stuck in my head.

If 10kg was 10000 in Register.Reading_val[1], then 100kg would be 100000 (100k), which would be too large to put into 16-bit two's complement (signed) Int Register.Reading_val[1], even if negative values (-32768 to -1) were converted to positve (+32768 to +65535). The next register, Register.Reading_val[2], (TUNA Register 9 = Modbus Address 40010) would be non-zero to handle the overflow.

What would my plc show if i put up a 100kg weight?
 
I undestand it that way that first register [0] is parameter number on TUNA which you want to change, registers [1] and [2] are setting numbers fro that parameter.


So you send Write command start from 40001, 2 or 3 registers, 40001 = value 122, and 40001, 40002 values are your calibrate numbers?

Nope, tried that didnt work. So the manual says "Special commands are executed using addresses 0-1-2". and under the 122 where i marked with blue arrow it says "Calibration to zero. No further action is required."

Oh and btw if you look to this pic there is also some stuff called Reg1 and Reg2. According to the manual to calibrate to 100000, i need to write 108 to Address 0 and put 34464(low) on Reg1(address 1) and put 1(high) on Reg2(address 2).

Here is the real kicker though, how can first put 40000 and then change it up to 40108 and then go 40001 and then do 40001? Didnt you guys say that i can only have 1 address active? how this would be possible?

Screenshot (668)_LI.jpg
 
What would my plc show if i put up a 100kg weight?

Assuming 1 count per gram, 100kg is 100,000g = 100,000count.

The binary for 100,000:
100k - 1 x 65536 = 34464
34464 - 1 x 32768 = 1696
1696 - 0 x 16384 = 1696
1696 - 0 x 8192 = 1696
1696 - 0 x 4096 = 1696
1696 - 0 x 2048 = 1696
1696 - 1 x 1024 = 672
672 - 1 x 512 = 160
160 - 0 x 256 = 160
160 - 1 x 128 = 32
32 - 0 x 64 = 32
32 - 1 x 32 = 0
0 - 0 x 16 = 0
0 - 0 x 8 = 0
0 - 0 x 4 = 0
0 - 0 x 2 = 0
0 - 0 x 1 = 0

so 1 1000 0110 1010 0000

So Register.Reading_val[2] (TUNA Reg. 9) should be 1 and Register.Reading_val[1] (TUNA Reg. 8) should be -31072 (-32768 + 1696).

Maybe; try sitting on it.
 
ok so here is the thing. I was trying to make it more stable by these math equations and it kinda worked. Rounding goes well and i divided it again and got myself a good value. 1.65kg's. But here's the kicker. How can i make it show like 1.65 as a 1 kg 650 grams? i am kind of stuck here

Screenshot (686).png
 
oh and btw i know this pic is useless because i kinda repeat the same steps going back and forth but i just tried experimenting with it :D
 
Not sure if I undestanded your question right?


Your online view is showing 1.47, do you want it to show 1.650 (scaling) or 1.470?


If case is 1.47 -> 1.470 then it is maybe easier to use two different ints. One for Kg and other for grams.
As real (float) value is number with exponent part, it is difficult to show number with fixed decimal point on PLC.


On scada or HMI you maybe have setting for that, but usually only for forcing leading digits.



First divide your int with 1000, then move remaining part to different int variable.


For grams you can use Decimal to BCD covnert, then shifting 4 bits to right and lastly BCD to Decimal convert.


Then you have your Kg and grams seperated and grams is with 3 numbers.
 
If #silly is a real e.g. with a value of 1.65:
TRUNC(Real to Dint) #silly #silly_dint_kg
CONV(Dint to Real) #silly_dint_kg #silly_real_kg
SUB(Real) #silly #silly_real_kg #silly_real_kgfrac
MUL(Real) silly_real_kgfrac 1000.0 #silly_real_gram
ROUND(Real to Dint) #silly_real_gram #silly_dint_gram
= #silly_dint_gram 1000 ADD #silly_dint_kg 1 #silly_dint_kg MOV 0 #silly_dint_gram
#silly_dint_kg will be 1 (kg)
#silly_dint_gram will be 650 (gram, from 0-999)

Caveat: Assumes #silly is non-negative.

A simpler approach, assuming MOD (modulo) is available:
MUL(Real) #silly 1000.0 #silly_real_kggram
ROUND(Real to Dint) #silly_real_kggram #silly_dint_kggram
MOD(Dint) #silly_dint_kggram 1000 #silly_dint_gram
SUB(Dint) #silly_dint_kggram #silly_dint_gram #silly_dint_kg
DIV(Dint) #silly_dint_kg 1000 #silly_dint_kg

 
If #silly is a real e.g. with a value of

Caveat: Assumes #silly is non-negative.


Would it matter :unsure:



If value would be -1,23kg
then full kilograms is -1.0


and subtract -1,23-(-1.0) = -1,23+1.0 = -0.23 kg




So it converts allways right no matter if original value is + or - weight.


If dividing is done on UINT variables then it would show weird numbers if negative values.


But negative value for weighter is probably wrong for start.
 
Not sure if I undestanded your question right?

Your online view is showing 1.47, do you want it to show 1.650 (scaling) or 1.470?

uhm sorry its my fault. Sorry, i need to explain. I was talking about 1.650 right as i was looking at it. If we are talking about the screenshot i posted i need 1.470. But i wanted to experiment with it a little and lets say i wanted count the weight value 5g to 5g. For example 1.470-1.475-1.480-1.485. Is it possible? if so how?
 
If #silly is a real e.g. with a value of 1.65:
TRUNC(Real to Dint) #silly #silly_dint_kg
CONV(Dint to Real) #silly_dint_kg #silly_real_kg
SUB(Real) #silly #silly_real_kg #silly_real_kgfrac
MUL(Real) silly_real_kgfrac 1000.0 #silly_real_gram
ROUND(Real to Dint) #silly_real_gram #silly_dint_gram
= #silly_dint_gram 1000 ADD #silly_dint_kg 1 #silly_dint_kg MOV 0 #silly_dint_gram
#silly_dint_kg will be 1 (kg)
#silly_dint_gram will be 650 (gram, from 0-999)

Caveat: Assumes #silly is non-negative.

It worked and as LARE said it didnt matter. Still it would be better if we could find a way to make the grams increase 5(610-615-620-625-630...) at a time instead of 10(610-620-630...).

Screenshot (688).png
 

Similar Topics

My PLC (S7-1200 with CPU-1212C) has now been delivered to customer site. They've asked me to do some updates to the software. I can do that on my...
Replies
21
Views
327
Does anyone know why the connection interface is greyed out and says why I can only use Teleservice instead of the other options like PN/IE? I am...
Replies
0
Views
44
Hi guys I after a bit of advice on Tia portal graphics, I would like to add a conveyor belt graphic to a hmi and the conveyor in the basic...
Replies
3
Views
130
Hi I used to be able to launch PLCsim without any problem. Now it tells me " STEP 7 Professional Licence is required to simulate this PLC"...
Replies
15
Views
452
Hi all Trying to remotely connect to a TIA Portal PLC. I can ping it without a problem but can't get my software to connect. I've opened port...
Replies
8
Views
280
Back
Top Bottom