Tia Portal Rs485 communication with plc

According this


https://www.tunasistem.com.tr/image/kullanim/tuna-ltr.pdf


For default TUNA have 115200,8,N,1 port configuration (Hyperterminal screenshot).


I hate it when speed settings aren't writed clearly anywhere on manuals.


USB connection also looks like that it is simulating serial port to TUNA.


Some devices have serial pins at paraller with USB com port. If that is case then USB connection is taking all communications from device.



If you don't see RX led blinking, take USB cable off from TUNA and check again if RX led start blinking.
 
Also try for MB_MASTER block





DATA_PTR-pin = P#DB2.DBX0.0 WORD 10 (Data buffer lenght 10 words)




Not sure if it needs lenght parameter for 1200. Thinking that had years ago some probles because of that but it was Siemens 300 series.
 
It looks like you used a process similar to the one described by this youtube video. There were a few times during that video where the author set specific checkboxes to make the application work.

Yes and i followed his lead to have no problems so my checkboxes and his are the same.

but perhaps the weight data have been placed in what the Modbus protocol defines as Input Registers, in which case the DATA_ADDRESS of 30008 should be used.
I need to try this.

The baud rate may be mismatched between the S7-1200 and the TUNA;
Nope. The baud rate in both of them are 115200, i set in the TUNA first and then set it in the plc.

By the same token, the parity or stop bits may be mismatched between the S7-1200 and the TUNA

The wires could be reversed from how they should be
I need to check these.

Also, in the video, starting here, it talked about disabling optimized block access to the Register DB; I suspect you may need to do that.
I did that, no problem there.

Also, in the interface you showed in post #2, what to you see when you enter the P (comm status) command?
It was showing the baudrate, Id and some other stuff. I cant post it because i dont have it. Tomorrow i will post a screenshot of that here.
 
Is your 1200 Siemens PLC transmitting serial data (is there TX led blinking)?
On my cb1241 both TX and RX lights are blinking at the same time. But on my transmitter only RX light is blinking which i believe shows that my transmitter is receiving the modbus commands but cant send answers back so TX of the transmitter wont blink.

According this


https://www.tunasistem.com.tr/image/...m/tuna-ltr.pdf


For default TUNA have 115200,8,N,1 port configuration (Hyperterminal screenshot).

Yes, you are correct.

I hate it when speed settings aren't writed clearly anywhere on manuals.

https://www.tunasistem.com.tr/image/kullanim/tuna-ltr3-short-from.pdf in this manual it says here that the weighing speed is 3840 samples per second. I can change the measuring speed(Hz) with SSx command. Although i dont know what the modbus adress of that would be. I need to contact the supplier for that.

USB connection also looks like that it is simulating serial port to TUNA.
Yeah they told me to pick serial port when looking at it at Putty.

If you don't see RX led blinking, take USB cable off from TUNA and check again if RX led start blinking.
I did that. No difference occured. RX and Tx blinks in the plc but TUNA only has RX blinking. TX is off in the TUNA

Also try for MB_MASTER block

DATA_PTR-pin = P#DB2.DBX0.0 WORD 10 (Data buffer lenght 10 words)
I will try this

Screenshot (663).png
 
YEEEEEEESSSSSS, we did it guys I can read the weight values, Reading_Val[1] is my weight value and it is changing at rapid speeds.

Its amazing. I couldn't have done it without all your help. I am amazed.

The real solution was to change the cables. For some unkown reason RX/A+ should be connected to T/rB and TB. And then my TUNA just started flashing both Rx and Tx lights.

I cant thank you enough guys. You are all amazing.

But i wonder. weight value changes rapidly. Every second it changes constantly. 1, 0, -1, -2. I need to do some calibration.

Oh and i have another question. Instead of just writing down 40008 on the DATA_ADDR can i just give it a global memory and change it whenever i need it through my programme?

Screenshot (664).png
 
It's not calibration that is needed, there are a number of causes for weight fluctuations, those being bearing noise on drives, noise on the analogue signal to the load cell amplifier (possibly earthing or grounding), general mechanical noise, also, it will depend on the weight resolution being measured for example if reading 1000kg a variation of +- 1 kg is quite small & probably within spec, however, if you are measuring very small weights and the difference is large then you do have a problem. this can be down to the load cell being too large i.e. using a 1500kg load cell for measuring weights as low as 50kg in 0.1kg steps.
There may also be built in filters or averaging within the load cell amplifier to smooth out small variations.
 
The real solution was to change the cables. For some unkown reason RX/A+ should be connected to T/rB and TB. And then my TUNA just started flashing both Rx and Tx lights.




RS485 is 4wire or 2wire. On 2 wire one wire is for transmitter signal and other is for receiving.


They need to connect so that TX (transmit) is connected to others RX (receive) pinn and vice versa.


Probles is with markings. Some manufacturers mark TX with letter A and RX with letter B.

Another manufacturer uses A for RX and B for TX.


Sometimes it is just swapping wires several times and after 5 or 6 swaps it magically start to work. :ROFLMAO:
 
Oh and i have another question. Instead of just writing down 40008 on the DATA_ADDR can i just give it a global memory and change it whenever i need it through my programme?


You can, but it is wiser to use constants so PLC restart don't mess addresses to wrong ones.


Instead read all you need with one long modbus message (if possible) or program several different modbus querys.
You need to request different messages with different times as only one message can be active at time on RS232 and RS485 communication.
 
(y)

Very interesting. For future reference for anyone who reads this thread, please confirm that successful wiring arrangement looks like the image below:
xxx.png
 
It's not calibration that is needed, there are a number of causes for weight fluctuations, those being bearing noise on drives, noise on the analogue signal to the load cell amplifier (possibly earthing or grounding), general mechanical noise, also, it will depend on the weight resolution being measured for example if reading 1000kg a variation of +- 1 kg is quite small & probably within spec, however, if you are measuring very small weights and the difference is large then you do have a problem. this can be down to the load cell being too large i.e. using a 1500kg load cell for measuring weights as low as 50kg in 0.1kg steps.
There may also be built in filters or averaging within the load cell amplifier to smooth out small variations.

Well my loadcell can weigh up to 100kg's. But when put for example my phone. The value changes like crazy. Which didnt suprise me that much. Just like you i thought that maybe this is because of my max weight is so high that it doesnt accurately show. But when i put weight of 10 kg's it did change a lot. And also. It doesnt show the right value. So when i put 10 kgs it shows something like 6000-7000. Weird.
 
RS485 is 4wire or 2wire. On 2 wire one wire is for transmitter signal and other is for receiving.


They need to connect so that TX (transmit) is connected to others RX (receive) pinn and vice versa.


Probles is with markings. Some manufacturers mark TX with letter A and RX with letter B.

Another manufacturer uses A for RX and B for TX.


Sometimes it is just swapping wires several times and after 5 or 6 swaps it magically start to work. :ROFLMAO:

Definitely :ROFLMAO: . I guess i have to get used to this

]You can, but it is wiser to use constants so PLC restart don't mess addresses to wrong ones.


Instead read all you need with one long modbus message (if possible) or program several different modbus querys.
You need to request different messages with different times as only one message can be active at time on RS232 and RS485 communication.

Interesting. I was thinking of giving it a global memory and changing it whenever i found it necessary. For example i thought that just before the weight is weighed in i would tare it using modbus commands and then turn it back to reading weight so that my weight value would be correct all the time.

But now that you said and i realized, i cant do that because if i try to tare then the weighing will stop so it will probably not work. Maybe it will. I have to find how the taring option works first though :D .

There is something that i dont understand though. It says on the manual by sending the 0,1 or 2 modbus adresses to my plc i can call 122 which calibrates the loadcell. But how can i call two messages at the same time?
 
... It doesnt show the right value. So when i put 10 kgs it shows something like 6000-7000. Weird.

xxx.png

The weight value is stored in two 16-bit Ints*. It is likely that for a small value (e.g. your phone), the higher-order Int will be 0, which will also be the case for any object with a weight reading up to 65535 (unsigned). For 10kg, the first, lower-order Int (Register.Reading_val[1]; TUNA Register 8) overflows and wraps around, perhaps multiple times, and those "carries" will end up in the higher-order Int (Register.Reading_val[2]; Tuna Register 8).


Can you show us the Register.Reading_val array again, with the 10kg weight on the scale, and also provide the actual weight of that 10kg weight?


* It may even be a floating point value, but probably not. Also, from an earlier post, it appears that TUNA Register 8 = Modbus Address 40009 = Register.Reading_val[1] is the low-order byte of a 32-bit value. As noted earlier, TUNA registers 8 and 9, where the weight information is, ends up in your Register.Reading_val[1] and Register.Reading_val[2], because the starting Modbus address asked for is 40008, which is TUNA register 7**, and TUNA register 7 is the second 16-bit Int of unused TUNA registers 6/7.

** since the first possible Modbus address is 40001 (i.e. not 40000), and the first TUNA register is 0.
 
Last edited:
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.
 
There is something that i dont understand though. It says on the manual by sending the 0,1 or 2 modbus adresses to my plc i can call 122 which calibrates the loadcell. But how can i call two messages at the same time?


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?
 

Similar Topics

Hello gentlemen, Im working on a small project on TIA Portal, about establishing a Modbus TCP connection between my ET200SP plc and a socomec...
Replies
11
Views
242
I am currently am in a PLC class and need urgent help on how the ladder logic would be laid out. I understand how to get the traffic lights to...
Replies
19
Views
388
Hello, If the date on the license manager of tia Portal has expired, can I still work with it? or is this just to keep the program up to date...
Replies
7
Views
189
Im trying to create a level indicator for water Tank i have used the ADD function while the pump is on and level increasing everything works...
Replies
33
Views
972
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
425
Back
Top Bottom