The perfect choice of one-stop service for diversification of architecture.
1.1 software
A PC with STEP7 micro / win smart software (including Modbus protocol library) installed. In this example, STEP7 micro win smart v2.0 is used.
1.2 hardware
G120 is equipped with one frequency converter of cu240e-2 control unit, one asynchronous motor, one S7-200 smartplc, one standard drive-cliq cable and one twisted pair shielded cable. In this example, the firmware version v4.6 of the control unit cu240e-2 of G120 is used.
Note: before using microwin software to create a project, confirm that the Modbus library file already exists.
Figure 1-1 S7-200 smart interface
2. Hardware wiring 2.1 cu240e-2 control unit interface
The terminal block of cu240e-2 control unit is shown in Figure 2-1. The RS485 interface is at the bottom of the control unit. There are five wiring terminals, from left to right. Terminal 2 is rs485p and terminal 3 is rs485n. These two terminals are used for transmitting and receiving communication data.
Figure 2-1 terminal diagram of control unit
2.2 G120 and S7-200 smart wiring
Figure 2-2 wiring diagram of PLC and controller
S7-200 smart serves as the Modbus communication master station, and the wiring of its communication port and frequency converter slave station is shown in Figure 2-2. Terminal resistors need to be used at the head and end of the communication network. For S7-200 smart, a resistance of 120 ohms needs to be connected between communication port terminals 3 and 8. For the frequency converter, turn the cu240e-2 terminal resistance dial switch at the end of the communication network to the on position (the position is in Figure 2-1, label â¨); For cu240e-2 in the middle position, the terminal resistance dial switch must be turned to the off position. In this example, S7-200 smart uses the CPU's own communication port to communicate with the frequency converter.
3. Communication settings
3.1 setting communication interface
This routine uses PLC Ethernet interface and drive-cliq cable to set communication interface, as shown in Figure 3-1 below.
Step 1: double click communication to open the communication setting window;
Step 2: select the network interface card and set it to "ICP / IP. Auto. 1", and the system will automatically collect the CPU.
Figure 3-1 setting communication interface
3.2 establish the connection between PC and PLC
After selecting "network interface", the CPU is automatically searched, as shown in Figure 3-2.
Step 1: after searching the CPU, select the searched CPU and click "IP address" of the CPU.
Step 2: click "OK" to complete the network connection.
Figure 3-2 establishing S7-200 CPU and controller connection
4. Frequency converter parameter setting
4.1 frequency converter address setting
The Modbus communication address of the frequency converter can be set through the bus address dial switch on the control unit, as shown in Figure 4-1. When the positions of address dial switches are off, it can also be set with parameter p2021. (Note: after changing the address, it can take effect only after power on again)
Figure 4-1 address switch setting
4.2 frequency converter parameter setting
Modbus communication can only be carried out after setting some basic communication parameters of the frequency converter, as shown in Table 4-2:
Table 4-2 parameter setting of frequency converter
4.3 description of G120 common registers
The common registers of G120 frequency converter are also the registers used in this example, as shown in table 4-3. For more G120 register information, see the G120 operator's manual.
Table 4-3 description of common registers
5. PLC programming
5.1 initialization procedure
Initialization module MBus using Modbus Protocol_ CTRL, initialize the CPU port of S7-200 smart, which is dedicated to MODBUS master station communication, as shown in Figure 5-1.
Figure 5-1 initialization
Function block Description:
Note: the "function block description" here and below only introduces the main pin functions in the function block. For the pin functions not described, please refer to the help document of STEP7 micro win smart v2.0 software.
EN enable: it must be ensured that each scanning cycle is enabled (sm0.0 is used)
Mode mode: when it is 1, the Modbus protocol function is enabled; when it is 0, it is restored to the system PPI Protocol. Baud baud rate: the supported communication baud rate is 4800960019200, and 9600 is set here. Parity verification: verification mode selection (G120 adopts even verification)
0 = no verification
1 = odd comparison test
2 = even comparison
Port port: set the physical communication port (0 = RS-485 integrated in the CPU, 1 = RS-485 or RS-232 on the optional CM01 signal board).
Timeout: the time that the master station waits for the response from the slave station, in milliseconds. The typical setting value is 1000 milliseconds (1 second), and the allowable setting range is 1-32767. Note: this value must be set large enough to ensure that the slave station has time response.
Done bit: after initialization, this bit will be automatically set to 1.
Error: initialization error code.
5.2 master station read / write function block
5.2.1 write control word
Figure 5-2 write control word
Function block Description:
Note: the "function block description" here and below only introduces the main pin functions in the function block. For the pin functions not described, please refer to the help document of STEP7 micro win smart v2.0 software.
EN enable: only one read-write function (i.e. mbus_msg) can be enabled at the same time. Note: G120 only operates on one holding register for write instructions at the same time; 125 holding registers are allowed to be operated at the same time for read instructions.
First read / write request bit: each new read / write request must be triggered by a pulse.
Slave slave address: selectable range 1-247
RW request mode: 0 = read, 1 = write
Count data number: the number of data (bits or words) for communication. Note: the maximum amount of data read / written by MODBUS master station is 120 words (referring to each mbus_msg instruction).
Dataptr data pointer:
If it is a read instruction, the read back data is placed in this data area;
2. If it is a write instruction, the written data is placed in this data area.
Done completion bit: read / write function completion bit.
Error code: the error code is valid only when the done bit is 1.
Common control words:
047e: preparation for operation
047f: forward start
0c7f: reverse start
04fe: fault confirmation
5.2.2 write speed setting
Figure 5-3 write speed value
5.2.3 read status word and actual speed value
Figure 5-4 read status word 1 and actual speed value
5.2.4 read ramp time
Figure 5-5 reading parameters p1120 and p1121
5.2.5 write ramp down time
Figure 5-6 write parameter p1121
6. Allocate inventory storage
Before compiling the program, first assign the available global V memory address to the Modbus library, as shown in Figure 6-1.
Step 1: select "program block" - > "library", right-click and select "inventory storage area";
Step 2: click "suggested address" and select the address of V memory;
Step 3: click "OK" to exit.
Figure 6-1 allocation of inventory storage area
7. Debugging program
After editing the program, debug the program, as shown in Figure 7-1 below.
Step 1: click "save" to save the edited program;
Step 2: click "compile" to compile the program;
Step 3: click "download" to download the program to the CPU of PLC; step 4: click "run" to start the program.
Figure 7-1 commissioning procedure
8. Monitoring status table
Through the monitoring status table, you can modify the process data and the change status of monitoring process data, as shown in Figure 8-1.
Figure 8-1 status table
Control word: vw100 = 16#047f indicates that the start command has been given.
Status word: vw300 = 16#ef37 indicates the status of the frequency converter, see r0052.
Main setting value: vw200 = 16#1000 indicates that the speed setting value has been given, and 16#0-4000 corresponds to the value of speed 0-p2000.
Actual speed value: vw302 = 16#1000 indicates that the actual speed of the motor has run to 375 rpm. Ramp rise time: vw400 = 1000. From the register list, we can see that the calibration coefficient of the register of 40322 is 100, so parameter p1120 = 1000 / 100 = 10.
Ramp down time: vw402 = 2000, the read down time; vw500 = 2000, the set down time; vw402 = vw500, indicating that the write instruction has taken effect. From the register list, you can see that the calibration coefficient of the register of 40323 is 100, so the parameter p1121 = 2000 / 100 = 20.
9. Modbus error codes
Done completion bit: the completion bit of Modbus function block, which is used to determine whether the operation of the function block is completed;
Error code: the error code is valid only when the done bit is 1. The Modbus error code and its meaning are shown in table 9-1.
Table 9-1 MODBUS error codes
{"site":{"site_id":3483,"site_type":1,"site_domain":"digahousing.com","domain_mode":1,"original_domain":"digahousing.com","language_code":"ar","is_init_domain":0,"is_shop":false,"is_ssl":1,"lang_prefix":"/","animate_name":"animate__fadeIn"},"page":{"page_id":33356,"page_type":"ai_article_detail","page_code":423,"page_url":"/ai-article/configuration-and-debugging-method-of-modbus-communication-between-siemens-s7.html","page_source":"","allowAnimat":0,"content_id":3218,"content_type":5,"detail_thumb":"https://img.yfisher.com/1620815740208.jpg","detail_title":"Configuration and Debugging Method of Modbus Communication Between Siemens S7-200 Smart and G120 Fre","moq":1},"translateList":{"A new item has been added to your Shopping Cart":"تمت إضافة عنصر جديد إلى سلة التسوق الخاصة بك","account":"الحساب","Account Name":"أسم الحساب","Account Number":"رقم حساب","Account is not exists":"الحساب ليس موجودا","account security":"أمن الحساب","Active Commission":"لجنة نشطة","Add a review on the product":"أضف مراجعة على المنتج","Add to":"اضف إليه","Add to Cart":"أضف إلى السلة","address book":"دليل العناوين","affiliate links":"روابط تابعة","all":"الكل","All Orders":"جميع الطلبات","Already commented":"وعلق بالفعل","Are you sure to cancel this withdrawal?":"هل أنت متأكد من إلغاء هذا الانسحاب؟","Are you sure to delete the selected items?":"هل من المؤكد أنك تحذف العناصر المحددة؟","Are you sure you want to delete it?":"هل أنت متأكد أنك تريد حذف ذلك؟","Awaiting Payment":"انتظار الدفع","Awaiting Shipment":"في انتظار الشحن","Back":"خلف","Bank Transfer":"حوالة بنكية","bank address":"عنوان البنك","basic information":"معلومات اساسية","Buy":"يشتري","Buy Now":"اشتري الآن","bank name":"اسم البنك","city":"مدينة","Copy successful":"نسخ ناجحة","Copy failed":"فشل النسخة","Can Extract":"يمكن استخراج","Currency Type":"نوع العملة","Cancel":"إلغاء","Cancel the success":"إلغاء النجاح","Cancelled":"ألغيت","Choose a country":"اختر بلد","Choose Coupon":"اختر كوبون","Choose items":"اختر العناصر","Clear":"صافي","Clear Search":"مسح البحث","Comment Successful!":"التعليق ناجح!","Comment Failed!":"فشل التعليق!","Commission Details":"تفاصيل اللجنة","Commission":"عمولة","Commission Status":"حالة اللجنة","commodity payment":"دفع السلع","completed":"completed","Completed":"منجز","Condition not met":"الحالة لم تتحقق","Confirm":"يتأكد","Confirm password is inconsistent with new password":"تأكيد كلمة المرور غير متناسقة بكلمة مرور جديدة","Congratulations":"تهانينا","Congratulations! You are got a coupon.":"تهانينا! لديك قسيمة.","Congratulations! You are got all coupons.":"تهانينا! لديك كل كوبونات.","Continue":"استمر","Continue Shopping":"مواصلة التسوق","Copy the code and use it directly in the shopping cart.":"انسخ التعليمات البرمجية واستخدامها مباشرة في عربة التسوق.","Country":"بلد","Coupon code":"رمز الكوبون","Coupon List":"قائمة الكوبون","Date":"تاريخ","days after receiving":"أيام بعد استلامها","Design customization":"تصميم التخصيص","Do not use any discount":"لا تستخدم أي خصم","Earliest":"باكرا جدا","Export successful":"تصدير ناجح","Export failed":"فشل التصدير","email":"البريد الإلكتروني","email format does not match":"تنسيق البريد الإلكتروني غير متطابق","Estimated Delivery Time":"يقدر وقت التسليم","Effective Order Count":"عدد الطلبات الفعالة","Effective Sale Amount":"مبلغ البيع الفعال","Expense":"مصروف","expired":"منتهية الصلاحية","export a report?":"تصدير تقرير؟","Failed to upload files.":"Failed to upload files.","FAQ":"FAQ","Find Parts":"العثور على أجزاء","for order over":"للطلب أكثر من ذلك","Free":"حر","Free Quote & Information Request":"طلب اقتباس مجاني ومعلومات","Free Shipping":"الشحن مجانا","Get":"احصل على","Get coupons":"الحصول على كوبونات","Get discount":"الحصول على خصم","Get it":"احصل عليه","Get it after logging in and use it in the shopping cart.":"احصل عليه بعد تسجيل الدخول واستخدامها في عربة التسوق.","Go to Page":"انتقل إلى صفحة","Highest Price":"اغلى سعر","home":"الصفحة الرئيسية","Hot Sale":"عرض ساخن","Income":"دخل","Incorrect form format":"تنسيق شكل غير صحيح","inquiry":"استفسار","join guide":"دليل الانضمام","Last 30 days":"آخر 30 يومًا","Last 7 days":"اخر 7 ايام","Links report":"تقرير الروابط","Loading":"جار التحميل","Lowest Price":"أقل سعر","Match Product":"تطابق المنتج","Merchant Free Shipping":"التاجر شحن مجاني","message":"رسالة","Most Popular":"الأكثر شعبية","my account":"حسابي","my coupons":"كوبونات بلدي","my inquiry":"استفساري","my orders":"طلباتي","my reviews":"مشاريعي","my wishlist":"قائمة امنياتي","name":"اسم","New Arrival":"قادم جديد","Newest":"الأحدث","No Quotation":"لا اقتباس","No time limit":"لا يوجد حد زمني","Not deleted":"لم يتم حذفها","not valid yet":"غير صالح بعد","Off":"عن","Offers and Discounts":"العروض والخصومات","ok":"موافق","Only DOC,DOCX,PDF,PNG,JPEG and JPG files can be uploaded":"يمكن تحميل ملفات DOC و DOCX و PDF و PNG و JPEG و JPG فقط","optional":"اختياري","order notes":"ترتيب ملاحظات","Order over":"النظام","order id":"رقم التعريف الخاص بالطلب","order status":"حالة الطلب","order amount":"كمية الطلب","Orders Report":"تقرير الأوامر","Other":"آخر","Password contains at least numbers and letters length should be 6-20":"تحتوي كلمة المرور على الأرقام على الأقل ويجب أن يكون طول الحروف 6-20","Password is invalid":"كلمة المرور غير صالحة","Password length should be 6-20":"يجب أن يكون طول كلمة المرور 6-20","Paypal":"باي بال","paypal payment":"الدفع باي بال","Pending":"قيد الانتظار","Pending Commission":"اللجنة المعلقة","personal info":"معلومات شخصية","Please click ’click to continue’ to retry.":"يرجى النقر فوق \"انقر للمتابعة\" لإعادة المحاولة.","Please contact customer service for cash withdrawal":"يرجى الاتصال بخدمة العملاء للحصول على السحب النقدي","Please enter a valid email address":"يرجى إدخال عنوان بريد إلكتروني صالح","Please enter the verification code":"الرجاء إدخال رمز التحقق","Please login in first":"يرجى تسجيل الدخول أولا","Please select attribute":"يرجى اختيار السمة","Please select country/region":"يرجى اختيار البلد / المنطقة","Please select superior":"يرجى اختيار متفوقة","Please select the number of ratings.":"يرجى اختيار عدد التصنيفات.","Please select your country":"الرجاء تحديد بلدك","Please upload the invoice file":"يرجى تحميل ملف الفاتورة","Processing":"يعالج","Product Name":"اسم المنتج","Please fill in the delivery address before selecting the payment method":"يرجى ملء عنوان التسليم قبل اختيار طريقة الدفع","promotion center":"مركز الترويج","Promotion Link Click Amount":"رابط الترويج انقر فوق مبلغ","Promoted link clicks":"نقرات الارتباط التي تمت ترقيتها","Promotion Order Count":"عدد أوامر الترويج","Promotion Reports":"تقارير الترويج","read more":"اقرأ أكثر","Received commission":"تلقت عمولة","Refund":"استرداد","Refuse":"رفض","Region":"منطقة","Register Success":"سجل النجاح","Remittance":"التحويلات","Reviews":"المراجعات","reports":"تقارير","Sale ends in":"بيع ينتهي في","Save in wishlist":"حفظ في قائمة الأمنيات","Search":"بحث","swift code":"رمز السرعة","Select how to share":"حدد كيفية المشاركة","Select premium items to increase your chances of making money":"حدد العناصر المتميزة لزيادة فرصك في كسب المال","Share items to your channels.when other purchase a from your link, you can get commission.":"مشاركة العناصر إلى قنواتك. عند الشراء الآخر A من الرابط الخاص بك ، يمكنك الحصول على العمولة.","Share Product":"مشاركة المنتج","shipment successful":"شحنة ناجحة","Shipping":"الشحن","Shipping Address":"عنوان الشحن","Size guide":"دليل المقاسات","Small Text":"نص صغير","Small Title":"عنوان صغير","Sort By":"صنف حسب","Sales Amount":"مبلغ المبيعات","State/Province/Territory":"الدولة / المقاطعة / الإقليم","Successfully delete":"حذف بنجاح.","Successfully save":"حفظ بنجاح.","Thank you for trying":"شكرا على المحاولة","The account has been deactivated, please contact customer service to activate":"تم إلغاء تنشيط الحساب ، يرجى الاتصال بخدمة العملاء لتفعيلها","the content can not be blank":"المحتوى لا يمكن أن يكون فارغا","The coupon code has been copied and used in the shopping cart.":"تم نسخ رمز القسيمة وتستخدم في عربة التسوق.","The file name cannot exceed 100 characters":"لا يمكن أن يتجاوز اسم الملف 100 حرف","The file size cannot exceed 2MB":"لا يمكن أن يتجاوز حجم الملف 2 ميجابايت","The number of withdrawals on the day has been capped":"تم توج عدد عمليات السحب في اليوم","The subscription is successful, thank you for your participation":"الاشتراك ناجح، شكرا لك على مشاركتك","The user center is out of service. Please contact customer service":"مركز المستخدم خارج الخدمة. يرجى الاتصال بخدمة العملاء","There is no amount to withdraw":"لا يوجد مبلغ للانسحاب","There is no data to export":"لا توجد بيانات للتصدير","This is Text":"هذا هو النص","This is title":"هذا هو العنوان","This transaction has failed.":"فشلت هذه المعاملة.","Time to shop":"الوقت للتسوق","Tips":"نصائح","To be commented":"ليتم تعليقها","Total":"المجموع","Tutorial":"الدورة التعليمية","This Supplier/Shipping Company does not deliver to your selected Country/Region.":"لا تقدم هذه الشركة/شركة الشحن إلى بلدك/منطقتك المختارة.","Update password success":"تحديث نجاح كلمة المرور","Upload Image":"تحميل الصور","Upload up to 6 pictures":"تحميل ما يصل إلى 6 صور","uploading":"تحميل","used":"تستخدم","user center":"مركز المستخدم","Upload Invoice":"تحميل فاتورة","valid now":"صالح الآن","Validity period":"فترة الصلاحية","View Cart & Checkout":"عرض العربة","views":"الآراء","Valid for":"صالحة ل","Welcome to the website":"مرحبا بكم في الموقع","Western Union":"الاتحاد الغربي","When your buyers received and confirmed orders, you can get commission right now!":"عندما تلقى المشترين أوامر مؤكدة ، يمكنك الحصول على العمولة الآن!","Withdrawal":"انسحاب","Withdrawal success":"نجاح الانسحاب","Withdrawal Method":"طريقة السحب","Write a Review":"أكتب مراجعة","Withdrawal Amount":"كمية السحب","Yes":"نعم","Yesterday":"في الامس","You are clicking too fast":"أنت تنقر بسرعة كبيرة","You are got a coupon.":"لديك قسيمة.","You can select a maximum of 90 days":"يمكنك تحديد 90 يومًا كحد أقصى","You can withdraw the commission to your Paypal account.":"يمكنك سحب اللجنة إلى حساب PayPal الخاص بك.","You haven’t chosen an address yet":"لم تختار عنوان حتى الآن","You haven’t selected a product yet":"أنت لم تختار منتج حتى الآن","Your rating":"تقييمك","Your review":"مراجعتك","Your shipping address error":"خطأ عنوان الشحن الخاص بك"}}