Read and Write Data From Microsoft Excel To Allen-Bradley ControLogix Using RSLinx

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ส.ค. 2024
  • Learn how to use Microsoft Excel VBA to read and write data from Microsoft Excel to ControLogix using RSLinx.
    Note that to read the values from the Allen-Bradley PLC, the Microsoft Excel spreadsheet need not be a Excel Macro-Enabled Workbook. However, if you have to write to the Allen-Bradley PLC, the Microsoft Excel spreadsheet has to be a Excel Macro-Enabled Workbook.
    Below is a quick overview of what you need to do in order to read to the ControlLogix PLC from Microsoft Excel spreadsheet via RSLinx Gateway.
    1) Create a topic
    A topic name with a lock means that the topic is currently connected via DDE connection.
    2) Copy DDE/OPC Link from the Edit pull down menu.
    Select the item and click on OK. The Data Table Address will be copied to your clipboard.
    3) In your Microsoft Excel spreadsheet, right-click on any cell and select Paste Special from the context menu.
    Select Paste link and then click on OK button.
    4) You should see a Microsoft Excel formula for DDE.
    To write a value to the ControlLogix PLC from Microsoft Excel spreadsheet via RSLinx Gateway, is a bit involved. Please see the TH-cam video below.
    Below is the VBA source code to write value to the Allen-Bradley ControlLogix PLC.
    Sub Button1_Click()
    DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="NEW_TOPIC")
    DDEItem = "Local:2:I.Data.1"
    Set RangeToPoke = Worksheets("Sheet1").Range("B14")
    Application.DDEPoke DDEChannel, DDEItem, RangeToPoke
    Application.DDETerminate DDEChannel
    End Sub
    #rockwell, #allenbradley, #ControlLogix,

ความคิดเห็น • 9

  • @ceilingwalker1
    @ceilingwalker1 6 หลายเดือนก่อน +1

    Awesome video! Thank you.

  • @cascadeanalog320
    @cascadeanalog320 9 หลายเดือนก่อน +2

    Thank you

  • @user-hf1wj8bl9x
    @user-hf1wj8bl9x 5 หลายเดือนก่อน +1

    Hi your vidoes are awesome. Btw in real scenario in what purpose does this industry need to take data in plc and put in excel? This can be done in sql rite?

  • @iamgarrettlyons
    @iamgarrettlyons ปีที่แล้ว +1

    Now how would I write to a program tag that is a UDT -> "Program:ProgramName.TagName.Member[0]"?

    • @RabiGurungXybernetics
      @RabiGurungXybernetics  ปีที่แล้ว +1

      To write a value to the ControlLogix PLC from Microsoft Excel spreadsheet via RSLinx Gateway, is a bit involved. Please see the TH-cam video timeline at 7:00.
      Below is the VBA source code mentioned in the video to write value to the Allen-Bradley ControlLogix PLC.
      Sub Button1_Click()
      DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="NEW_TOPIC")
      DDEItem = "Local:2:I.Data.1"
      Set RangeToPoke = Worksheets("Sheet1").Range("B14")
      Application.DDEPoke DDEChannel, DDEItem, RangeToPoke
      Application.DDETerminate DDEChannel
      End Sub
      Let me know if you have further question(s).

    • @iamgarrettlyons
      @iamgarrettlyons ปีที่แล้ว +1

      @@RabiGurungXybernetics I figured it out! Thanks for the video!

    • @RabiGurungXybernetics
      @RabiGurungXybernetics  ปีที่แล้ว +1

      You are welcome!