Gehngiz

Schneider tm221 plc

7 posts in this topic

Hello,

 

Any one  have idea how to read and write variable for Schneider tm221 plc with Modbus function codes 3,6,16.

I attached file for power supply communicator with registers, I need to adjust power supply from 25% up to 100. Please need help.

Best regards,

 

Chyngyz

 

Modbus OPERATING INSTRUCTIONS.pdf

Share this post


Link to post
Share on other sites

Posted (edited)

@Gehngiz You need to read data to check communication first. For example I have to use Read_Var for reading modbus register (function code 03) by follow these step.

1. Check communication parameter from Power Supply manual.

M221_Read_Var_00.thumb.jpg.3ece4cd636ee2

2. Config communication paramete on PLC to match with Power Supply.

M221_Read_Var_01.thumb.jpg.3f9aadf8e71cd

3. Config Serial Port 1 to be Modbus master.

M221_Read_Var_02.thumb.jpg.06c6cbc138aad

4. Select function block Read_Var.

M221_Read_Var_03.jpg.be13ca13fda6304fd3e

5. Config Function Block Read_var by describe as these

Link: -> SL1

ObjType -> 3 for Read Multiple Register for 4X

Firstobj -> 0 for start read register at 0

Quantity -> 54 for Hexdacimal 35 means 54 data

Indexdata -> 0 for recieve data at %MW0

M221_Read_Var_04.thumb.jpg.fef35e8d76f96

6. Put %S5 at pin Execute for read data every 100ms

M221_Read_Var_05.thumb.jpg.98c40525caf9a

7. Create animation table for show data that recieve from power supply.

M221_Read_Var_06.jpg.272c8980bd665f4c4f8

8. add data to be display for all %MW0 to %MW54.

M221_Read_Var_07.thumb.jpg.77caad4c3ef96

9. Download and monitor program. If its OK data should put to %MW0 to %MW54.

For example program I have attached with this post.

 

M221_Read_Var_Power_Supply.smbp

M221_Read_Var_Power_Supply.smbp

M221_Read_Var_Power_Supply_01.smbp

Edited by Wasan
Add new Program 01

Share this post


Link to post
Share on other sites

Dear Wasan.

 

Thank you so much for your answer, i have one more question. How i can adjust power by putting value its mention between 25-100. Have to I put it in function code 3?

 

Best regards,

 

Gehngiz

Share this post


Link to post
Share on other sites

@Gehngiz You need ti use function code 06 for write holding register 4x. On M221 you need to use function WRITE_VAR to write data to them but I think you should read data first to understand how function block READ_VAR working.

Share this post


Link to post
Share on other sites

Dear Wasan.

 

I used function code 3, it works fine. I can read some values. But when I am using function code 6 its showing error 255,11. I am using both codes 3 and 6 same time.  

 

Best regards,

 

Gehngiz

Share this post


Link to post
Share on other sites

@Gehngiz Which register you need to write and how about source of value to be write? Please show us your program to check what to do.

Share this post


Link to post
Share on other sites

Dear Wasan,

Thank you so much for your effort, it works fine, if you have in youtube channel or some other way to donate some money I would like to do it for your help.

 

Best regrads,

 

Gehngiz

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