GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - seehma/DeviceInfo: Fetch Ethercat Master Device Data in TwinCAT Solutions

BranchesTags
Open more actions menu

Latest commit

 

History

43 Commits
43 Commits

Folders and files

NameName
Last commit message
Last commit date
.Zeugwerk
.Zeugwerk
 
 
.github/workflows
.github/workflows
 
 
doc
doc
 
 
src
src
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Read Ethercat-Master Device names

This small library acts as a sample project to show how to read Ethercat-Master names in TwinCAT.

Dependencies

It references ZCore library from Zeugwerk Framework. This can be easily installed via Twinpack library Package Manager.

Usage

  • instantiate GetDeviceData function block
  • call Cyclic() method on every PLC cycle
  • start reading by calling method DeviceNamesAsync('');, leave AmsNetId empty to read from a local PLC
  • Fetch result from VAR_INPUT arrays of the object

deviceinfo

Example

PROGRAM MAIN
VAR
  _deviceInfo : DeviceInfo.DeviceInfo;
  _slaveInfo : DeviceInfo.SlaveInfo;
  _step : ZCore.Step(0, 50);
  _start : BOOL;
  _ecatMasterCount : UINT;
  _ecatName : ZCore.ZString;
  _ecatAmsNetId : Tc2_System.T_AmsNetID;
END_VAR
----------------------------------
_deviceInfo.Cyclic();
_slaveInfo.Cyclic();

CASE _step.Index OF
  0:
    IF _start 
    THEN 
      _start := FALSE;
      _step.SetNext(10);
    END_IF
    
  10:
    IF _step.OnEntry()
    THEN
      _deviceInfo.ReadDeviceNamesAsync('');
    END_IF

    IF _deviceInfo.Done 
    THEN
      _ecatMasterCount := _deviceInfo.EthercatMasterCount;
      _ecatName := _deviceInfo.NameArray[0];
      _ecatAmsNetId := _deviceInfo.NetIdArray[0];
      _step.SetNext(20);
    END_IF  
    
  20:
    IF _step.OnEntry()
    THEN
      _slaveInfo.ReadSlaveNamesAsync('', _deviceInfo.DeviceIdArray[0]);
    END_IF
    
    IF _slaveInfo.Done
    THEN
      _step.SetNext(0);
    END_IF
    
END_CASE

About

Fetch Ethercat Master Device Data in TwinCAT Solutions

Resources

Readme
MIT license
Activity

Stars

4 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.