PROFEBUS通讯

我现在采用PROFIBUS对PLC和变频器进行通讯。请问我在做程序的时候要做哪些程序才能让通讯正常的运行?

问题补充:
非常感谢个位的回答.假如我用S7300和变频器进行通讯采用以太网.且我已经加上了以太网模块我想请问我在做程序的时候还要做那些处理,来使我的通讯能够顺利的进行呢?

最佳答案

 首先纠正一下楼上的错误:EM277是PROFIBUS-DP从站模块,不能做主站;而变频器需要接受主站的控制,所以不可以通过EM277模块控制变频器.S7-200与西门子MicroMaster系列变频器(如MM440、MM420、MM430以及MM3系列、新的SINAMICS G110 )用USS通信协议通信.

 300与Profibus DP与MM440 通信

 在STEP7中新建项目,插入S7-300站,设为DP主站,地址为2,组态窗口中将MM440插入DP网络,并设为DP从站,地址为4。其中MM440的数据区大小为4PKW和2PZD。 
 Build up new project in STEP7, insert S7-300 station and set to master, address is 2. Insert MM440 in hardware configuration window and set to slave, address is 6. MM440 includes 4PKW and 2PZD data area.

  

 
  

 设置MM440参数 
                Set parameters in MM440

  

  P0700 = 6        //命令源为CB板

                                 //Command resource is CB board

  P0918 = 4        //设定MM440的DP地址 MM4面板中的DP地址为0,P918才有效

                                 //Set DP address of MM440

  P1000 = 6        //频率设定源为CB板

                                 //Frequency resource is CB board

 报文结构分析:

 每条报文都是以字符STX(=02hex)开始,接着是长度的说明(LGE)和地址字节(ADR)。然后是采用的数据字符。报文以数据块的检验符(BCC)结束。这里我们只是对数据部分进行操作,故只研究有效的数据字符PZD和PKW。MM440通讯中PZD可以有2、4、6、8个字,PKW则是4个字。组态时我们选择了4PKW,2PZD。

 PKW数据结构如下:

 PKE                         IND                          PWE                         PWE

  
   
   
   
   
  A
  B
  C
  D
   
   
   
   
   
   
   
   
   
   
   
  

  

 其中PKE为参数识别标记,最高4位为任务或应答识别标志,其他三位为基本参数号。PWE为参数数据。IND为索引,指定参数的页号与数据分组号,PROFIBUS DP通讯与USS通讯有所不同:

 PROFIBUS DP通讯:数据分组编号使用IND的B区,参数选择位使用C区,A、D未使用。

 USS通讯:数据分组编号使用C区,参数选择位使用B区,A、D未使用。

  

 PZD的第一个字为变频器的控制字一,具体各位的含义如下表。在通讯中第10位必须设为“1”,实验中以047F启动MM440,以047E停止。第二个PZD为主设定值,按4000H进行标定。

  

 Telegram structure analyzes:

 Every piece of Telegram begins with STX, LGE and ADR follow, and then is the user data. The telegram is end with BCC. The user data contains PZD and PKW. The PZD of MM440 can be 2, 4, 6, 8 bytes long, PKW is 4 bytes long. In the configuration, we choose 4PKW/2PZD. The PKW data structure is as upside.

 PKE is the marker of parameter, the high 4 bits are the request or the response reference, the other 3 bits are the parameter number, PWE is the value of parameter. IND is the index of the parameter, it points the page number and the data group number of the parameter. There are some difference between PROFIBUS DP and USS communication:

 PROFIBUS DP: Data group number uses the B section of IND, the parameter choosing bit uses C section of IND, it doesn’t use A and D section.

  

 The first word of PZD is the Control Word 1 of MM440, the detail means of bits are as the table below. The tenth bit of Control Word 1 must be”1”, we use 047F as the ON command of MM440 and 047E as the stop command. The second word of PZD is the main set point, it scales as 4000H.

  

 
  

  

  

 建立数据块DB1,其中存放PZD和PKW数据。 
           Build up DB1, and put PZD and PKW in it.

 
  

 在OB1中调用通信功能块SFC14/15,完成对从站的读写。 
            Use communication blocks SFC14/15 in OB1, to realize reading and writing function.

  

 PZD:

  

 
  

 PKW:

 
 建变量表监视PZD的第一个字为变频器的控制字一,具体各位的含义如下表。在通讯中第10位必须设为“1”,实验中以047F启动MM440,以047E停止。PKW修改参数。

  

 
 

提问者对于答案的评价:
很详细非常的感谢
 

原创文章,作者:ximenziask,如若转载,请注明出处:https://www.zhaoplc.com/plc358560.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2021年7月5日 上午10:31
下一篇 2021年7月5日 上午10:31

相关推荐

发表回复

登录后才能评论