Wiki source code of Управление шпинделем по Modbus на примере Toshiba VF-S11 и платы расширения PLCM-B1-G2
Last modified by writer on 2023/06/06 17:25
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
21.1 | 1 | You will need a frequency converter (hereinafter referred to as the FC) with support for Modbus RTU control, such as Toshiba VF-S11, to control the spindle via Modbus via the PLCM-B1-G2 expansion board. |
![]() |
1.1 | 2 | |
![]() |
21.1 | 3 | Modbus spindle control setting procedure: |
![]() |
1.1 | 4 | |
![]() |
21.1 | 5 | 1. Set FC to the control mode using the Modbus RTU protocol (RS-485) and remember the COM port settings in FC (count of bits per second, data bits, parity and stop bits). |
![]() |
1.1 | 6 | |
![]() |
21.1 | 7 | Example for Toshiba VF-S11. |
![]() |
1.1 | 8 | |
![]() |
21.1 | 9 | |=(% style="text-align: center; width: 150px;" %)Function code|=(% style="text-align: center; width: 100px;" %)Value|=(% style="text-align:center" %)Description |
10 | |(% style="width:150px" %)F800|(% style="width:100px" %)3|Transfer rate: 9600 bits per sec | ||
11 | |(% style="width:150px" %)F801|(% style="width:100px" %)1|Parity check enabled | ||
12 | |(% style="width:150px" %)F802|(% style="width:100px" %)1|Device number on the bus | ||
13 | |(% style="width:150px" %)F829|(% style="width:100px" %)1|Communication Protocol: Modbus RTU | ||
![]() |
1.1 | 14 | |
15 | (% style="margin-left: 30.0px;" %) | ||
![]() |
21.1 | 16 | 2. Connect FC to the PLCM-B1-G2 expansion board via RS-485 interface. |
![]() |
1.1 | 17 | |
18 | (% style="margin-left: 30.0px;" %) | ||
![]() |
21.1 | 19 | 3. Purchase the "[[MODBUS protocol support>>url:http://pumotix.ru/#soft||shape="rect"]]" option or activate a trial period for this option in the menu "Configuration" → "License Manager" → "Common". |
![]() |
1.1 | 20 | |
21 | (% style="margin-left: 30.0px;" %) | ||
![]() |
21.1 | 22 | 4. Enable and configure Modbus in the menu "Configuration" → "Modbus Setup". |
![]() |
1.1 | 23 | |
![]() |
21.1 | 24 | Create new Modbus-master. Number of COM port is PLCM. The rest of the settings should be exactly the same as in the FC (in the screenshot, an example of a standard configuration of the COM port of Toshiba VF-S11). |
![]() |
1.1 | 25 | |
![]() |
21.1 | 26 | [[image:modbus_master_en.png||alt="master_plcm.png" data-xwiki-image-style-alignment="center" height="300" width="367"]] |
![]() |
1.1 | 27 | |
![]() |
21.1 | 28 | You need to add registers to control the FC and read statuses from FC. For example you need to configure registers named **SpindleMode**, **SpindleRPM** and **SpindleStatus**. |
![]() |
1.1 | 29 | |
![]() |
21.1 | 30 | We recommend using exactly these names, since in the future, registers will be accessed from background operations by their names. |
![]() |
1.1 | 31 | |
![]() |
15.1 | 32 | (% class="non-break" %) |
![]() |
21.1 | 33 | |=(% style="text-align: center;" %)Name|=(% style="text-align: center;" %)Master|=(% style="text-align: center;" %)Address|=(% style="text-align: center;" %)Register|=(% style="text-align: center;" %)Register type |
![]() |
13.1 | 34 | |SpindleMode|PLCM|1|64000|Output |
35 | |SpindleRPM|PLCM|1|64001|Output | ||
36 | |SpindleStatus|PLCM|1|64769|Input | ||
![]() |
1.1 | 37 | |
![]() |
8.1 | 38 | {{success}} |
![]() |
21.1 | 39 | Register numbers must be specified as decimal values. |
![]() |
8.1 | 40 | {{/success}} |
![]() |
1.1 | 41 | |
![]() |
12.1 | 42 | {{warning}} |
![]() |
21.1 | 43 | These values can be indicated in HEX (hexadecimal) in the instructions for the frequency converter. For example, 0x1001, 0x1002. |
![]() |
12.1 | 44 | {{/warning}} |
![]() |
1.1 | 45 | |
46 | (% style="margin-left: 30.0px;" %) | ||
![]() |
21.1 | 47 | 5. Create new background operation (macro) through [[the macro manager>>doc:Руководство пользователя.Описание M-кодов.Управление макросами и фоновыми операциями.WebHome]]. |
![]() |
1.1 | 48 | |
![]() |
21.1 | 49 | The main task of the background macro is to monitor the current state and spindle speed and send the values to the frequency converter via Modbus. |
![]() |
1.1 | 50 | |
![]() |
21.1 | 51 | An example of background operation **modbus_spindle.bm** for ModBus spindle control via FC Toshiba VF-S11 posted in attachment. This file must be added to background operations list. |
![]() |
1.1 | 52 | |
![]() |
21.1 | 53 | **[[Download background operation>>attach:modbus_spindle.zip]]** |
![]() |
1.1 | 54 | |
![]() |
12.1 | 55 | {{warning}} |
![]() |
21.1 | 56 | Access to Modbus registers from macros is done by the name of the Modbus register case sensitive! For example **SpindleRPM** and **SpindleRpm** are different registers. |
![]() |
12.1 | 57 | {{/warning}} |
![]() |
1.1 | 58 | |
59 | (% style="margin-left: 30.0px;" %) | ||
![]() |
21.1 | 60 | 6. Enable the background operation. Make sure that the operation has started and is working properly. This will be indicated by the green indicator to the right of the operation name. |
![]() |
1.1 | 61 | |
![]() |
21.1 | 62 | [[image:Macros_Manager_wndw.png||alt="2021-11-29 14_18_03-Управление макросами.png" data-xwiki-image-style-alignment="center" height="500" width="681"]] |
![]() |
1.1 | 63 | |
![]() |
21.1 | 64 | The spindle should now turn on and off if everything is configured correctly. The spindle speed accordingly must also change at the FC when it changing in PUMOTIX. |