zoukankan      html  css  js  c++  java
  • B&R配方机制例程

    B&R配方机制例程

    1. 添加库文件 MpWebXs,MpFile,MpRecipe

    2. 添加mapp文件夹

      configuration->PC_any->mapp文件夹

    3. 添加MpRecipe配置
      mapp文件夹右击添加XML Recipe文件

    4. 添加程序

    5. 在程序中添加MpRecipeXml功能块,配置功能块

      PROGRAM _CYCLIC
          (* Insert code here *)
          MpRecipeXml_0.MpLink := ADR(gRecipeXml);
          MpRecipeXml_0.Enable := 1;
          MpRecipeXml_0.DeviceName := ADR('address');
          MpRecipeXml_0.FileName := ADR('recipe');
          MpRecipeXml_0();
      END_PROGRAM
      
    6. 创建文件存储地址

      Physical View->PC_any右击->Configuration->File devices->右击添加

    7. 创建需要保存的数据,放在一个结构体里面

    8. 声明结构体变量,在初始化程序中初始化

      PROGRAM _INIT
          (* Insert code here *)
          saveParameter.saveBOOL := 1;
          saveParameter.saveREAL := 3.14;
          saveParameter.saveSTRING := 'this is a test program by Z.K.';
          saveParameter.saveUDINT := 120;
      END_PROGRAM
      
    9. 在程序中添加MpRecipeRegPar功能块并在程序中配置功能块

      PROGRAM _CYCLIC
          MpRecipeRegPar_0.MpLink := ADR(gRecipeXml);
          MpRecipeRegPar_0.PVname := ADR('Program:saveParameter');
          MpRecipeRegPar_0.Enable := 1;
          MpRecipeRegPar_0();
      END_PROGRAM
      
    10. 测试程序

    11. PROGRAM _INIT
          (* Insert code here *)
          saveParameter.saveBOOL := 1;
          saveParameter.saveREAL := 3.14;
          saveParameter.saveSTRING := 'this is a test program by Z.K.';
          saveParameter.saveUDINT := 120;
      
      END_PROGRAM
      PROGRAM _CYCLIC
          (* Insert code here *)
          MpRecipeXml_0.MpLink := ADR(gRecipeXml);
          MpRecipeXml_0.Enable := 1;
          MpRecipeXml_0.DeviceName := ADR('address');
          MpRecipeXml_0.FileName := ADR('recipe');
          MpRecipeXml_0();
      
      
          MpRecipeRegPar_0.MpLink :=  ADR(gRecipeXml);
          MpRecipeRegPar_0.PVName := ADR('Program:saveParameter');
          MpRecipeRegPar_0.Enable := 1;
          MpRecipeRegPar_0(); 
      
      END_PROGRAM
      


  • 相关阅读:
    I Hate It
    hdu 2112 HDU Today ( Dijkstra )
    hdu 1280 前m大的数
    hdu 4252 A Famous City
    hdu 2647 Reward
    hdu 2845 Beans
    hdu 3548 Enumerate the Triangles ( 优 化 )
    hdu 3552 I can do it! (贪心)
    HDU 3033 I love sneakers!(分组背包变形)
    hdu 1712 ACboy needs your help 分组背包
  • 原文地址:https://www.cnblogs.com/zhengkang/p/5712446.html
Copyright © 2011-2022 走看看