Greg

Twido EXCH & MSG functions

18 posts in this topic

Hi guys, can anybody explain the values that written in the application to retrieve data from modbus slaves through the Ethernet port, i read a little bit from the help of TwidoSuite i understood all the concept of getting the data, the only thing i still don't understand the first 4 raws with that values as it explained in the examples in Hex, and why does it changes all the time. and how can i determine from which addresses i would like to get the data from the slave? please see attached example of code as described in help. Thanks in advance, Best Regards, Greg.

Share this post


Link to post
Share on other sites
priviet LD1 [%MW0;=16#0106] 01 SEND/RECEIVE 06 NUMBER OF BYTES OF THE MODBUS STRING [%MW1;=16#0300] 03 OFFSET (ANSWER) 00 OFFSET (TRANSMISSION) [%MW2;=16#0103] 01 SLAVE ADDRESS 03 READING WORDS [%MW3;=16#0000] 0000 START ADDRESS [%MW4;=16#0004] 0004 NUMBER OF WORDS TO READ LD1 AND %MSG2.D [EXCH2 %MW0:11] FROM MW0 TO MW4 TRANSMISSION + MW5 TO MW10 ANSWER THE ANSWER WILL BE: %MW5 = 16#0103 ECHO OF THE FIRST WORD TRANSMITTED %MW6 = 16#0008 00 BYTE ADDED (OFFSET = 3RD BYTE OF THE ANSWER) 08 NUMBER OF BYTES OF DATA IN THE ANSWER %MW7 = 16#XXXX FIRST WORD %MW8 = 16#YYYY SECOND WORD %MW9 = 16#ZZZZ THIRD WORD %MW10 = 16#WWWW FOURTH WORD
2 people like this

Share this post


Link to post
Share on other sites
Hi aggattapauer, Thanks a lot, couldn't get better answer then that, appreciate it a lot. Could you tell me please where did you get this info from? And where can i find all the parameters i can write into the first words? Best Regards, Greg. Edited by Greg

Share this post


Link to post
Share on other sites
Hi, again i wanted to thank you, i found the whole explanation in programming manual of twidosuite. Best Regards, Greg.

Share this post


Link to post
Share on other sites
On 10/17/2011 at 6:18 AM, aggattapauer said:

priviet LD1 [%MW0;=16#0106] 01 SEND/RECEIVE 06 NUMBER OF BYTES OF THE MODBUS STRING [%MW1;=16#0300] 03 OFFSET (ANSWER) 00 OFFSET (TRANSMISSION) [%MW2;=16#0103] 01 SLAVE ADDRESS 03 READING WORDS [%MW3;=16#0000] 0000 START ADDRESS [%MW4;=16#0004] 0004 NUMBER OF WORDS TO READ LD1 AND %MSG2.D [EXCH2 %MW0:11] FROM MW0 TO MW4 TRANSMISSION + MW5 TO MW10 ANSWER THE ANSWER WILL BE: %MW5 = 16#0103 ECHO OF THE FIRST WORD TRANSMITTED %MW6 = 16#0008 00 BYTE ADDED (OFFSET = 3RD BYTE OF THE ANSWER) 08 NUMBER OF BYTES OF DATA IN THE ANSWER %MW7 = 16#XXXX FIRST WORD %MW8 = 16#YYYY SECOND WORD %MW9 = 16#ZZZZ THIRD WORD %MW10 = 16#WWWW FOURTH WORD

This explanation helped me too, I followed up and can read (read only) registers of one soft starter. I tried to read registers of four soft starters using a M221 PLC but I can't! Please would you explain me on these MSG1/2 to read all the soft starters' registers. Attached is how I wrote to read read 11 registers of a soft starter.

Thank you in advance  

RS485 Communication.png

Edited by RichardK

Share this post


Link to post
Share on other sites

@RichardK Which softstarter brand and model do you use and how ti communicate with it (TCP, Modbus or anything)?

Could you send your softstarter communication manual to us?

1 person likes this

Share this post


Link to post
Share on other sites

@RichardK I have check on SoftStarter Manual it use Modbus RTU Protocol that can use READ_VAR function on M221 that easier than EXCH/MSG command.

Could you tell us which 11 parameters to read and what Device ID for four softstarters?

And send us program for EXCH/MSG because attach files are so blur to read.

Share this post


Link to post
Share on other sites

@Wasan Thank you, actually 12 registers, Register 3 to 14 (Motor Current to Soft starter fault codes). I was using timers to read two soft starters. Instead of this EXCH/MSG please help me how to use this READ_VAR. Attached is my PLC program and the list of registers to read.

 

Thank you once again for help

Chapter 6.pdf

MY PLC PROGRAM.pdf

Share this post


Link to post
Share on other sites

Hi @RichardK

I have create example program for READ_VAR function block attacth to this post

I don't have real hardware then I'm not sure that it will work correctly.

Then I will describe how program works

1. Create program on SoMachine or Machine Expert - Basic then assign communication parameter on PLC serial port to match with Soft Starter Parameter.

MrPLC_M221_ReadVar_SoftStarter_001.thumb

2. Config Modbus parameter to set PLC as Modbus Master.

MrPLC_M221_ReadVar_SoftStarter_002.thumb

3. In this program I have use system clock 100 ms %S5 to count uo conuter for each READ_VAR command for this project I use 4 device to read then I set preset to be 4 + 1 = 5 when counter reach preset it will reset automatically.

MrPLC_M221_ReadVar_SoftStarter_003.thumb

4. use compare block for %C0.V (Counter 0 Current Value) = 1 when counter reach 1 it will operate then put %READ_VAR function block after it at EXECUTE pin

You need to assign %READ_VARX for each communication block. Example I start with %READ_VAR0 for communicate with device slave ID 1.

Detail for configuration shown below

Link: Which PLC port to connect with Modbus Device

Id : Modbus Slave ID for SoftStarter

TimeOut : How long to timeout after wait for resplonse

ObjType : Function code that you use (use 0 For Modbus 0x03 for read multiple registers)

FirstObj : First Register to be read (For this softstarter start with 0 for P000 then we need to read P003 that means we start with 3)

Quantity : How many data to read (use 12 for P003 - P014)

IndexData : First %MW to recieve data (For this block use %MW0 - %MW11 to recieve 

MrPLC_M221_ReadVar_SoftStarter_004.thumb

5. Then create similar program for each device to read by add compare value to 1 for each command and change %READ_VAR0 to next %READ_VAR1..2..3 and config IndexData for each READ_VARX function block. 

MrPLC_M221_ReadVar_SoftStarter_005.thumb

6. Then we will end at %READ_VAR3 for device 4.

MrPLC_M221_ReadVar_SoftStarter_006.thumb

Now we can read Modbus data from 4 softstarters P003 - P014 as these

No.1 -> %MW0 - %MW11

No.2 -> %MW20 - %MW31

No.3 -> %MW40 - %MW51

No.4 -> %MW60 - %MW71

MrPLC_ReadVar_SoftStarter_01.smbp

1 person likes this

Share this post


Link to post
Share on other sites

@Wasan I followed the example you gave, it is perfectly reading the four soft starters.

 

I was also trying to read and write between M221 PLC using the Read_Var/ Write_Var via network (3_eth1 not 1_SL1) but I still cannot get it right, every time I try, I still make wrong setting somewhere, please help me.

 

Thank you

Share this post


Link to post
Share on other sites

@RichardK Which device model that you need to connect with Modbus TCP?

Share this post


Link to post
Share on other sites

 

@Wasan5 x M221CE24T PLC CONTROLLERS (1 MASTER AND FOUR SLAVES), I tried and got them finally communicating through our network but one problem, when one of them goes offline/power off, the entire communication fails. Though four of them online they still cannot communicate with master until the one goes off comes back online. How can I make master communicate separately with its slaves and I can identify which slave goes off. Attached is the PLC Program of the master Controller (M221CE24T)

 

Thank you

 

MASTER PLC_10.190.153.232.smbp

Edited by RichardK

Share this post


Link to post
Share on other sites

@Wasan Good day Wasan, I tried to use the same setup of the Example you gave on the Read_Var to read registers of four Toshiba Softstaters (Manual link:  http://sunnice.com/manuals/(71105)%20Toshiba%20TMS7%20Users%20Manual.pdf) but cannot read anything from the Soft starters. The Toshiba Softstaters' RS485 port can only communicate on MODBUS ASCII, I tried to change the PLC Serial Link settings to MODBUS ASCII but still cannot, How can I configure Modbus ASCII on my M221 PLC (SoMachine Software)?

 

Than you

Share this post


Link to post
Share on other sites

@RichardK I have never use Modbus ASCII on M221 but I think if change protocol on communication setting it should be fine to use READ_VAR maybe wait for other to clarify with these.

1 person likes this

Share this post


Link to post
Share on other sites

@Wasan Good day Wasan, in a M221 PLC program I am using a counter and I must make sure the last counted value is remembered during power outages. Where can I put this system bit 1 (%S1) in a rung to do this? I search in the M221 Help but can't find any, just descriptions only. Please show me where to use this system bit.

 

Thank you

Edited by RichardK

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