Posted 9 Apr 2021 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 13 Apr 2021 (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. 2. Config communication paramete on PLC to match with Power Supply. 3. Config Serial Port 1 to be Modbus master. 4. Select function block Read_Var. 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 6. Put %S5 at pin Execute for read data every 100ms 7. Create animation table for show data that recieve from power supply. 8. add data to be display for all %MW0 to %MW54. 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 13 Apr 2021 by Wasan Add new Program 01 Share this post Link to post Share on other sites
Posted 15 Apr 2021 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
Posted 16 Apr 2021 @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
Posted 16 Apr 2021 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
Posted 17 Apr 2021 @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
Posted 19 Apr 2021 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