libcpp4ec
C++ for EtherCat Library
 All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | List of all members
cpp4ec::EcMaster Class Reference

Class EcMaster. More...

#include <EcMaster.h>

Public Member Functions

 EcMaster ()
 Default Constructor.
 
 EcMaster (std::string ecPort, unsigned long cycleTime=1000000, bool useDC=false)
 Constructor. More...
 
 ~EcMaster ()
 Destructor.
 
void setPort (std::string ecPort)
 Set the ethercat port. More...
 
void setCycleTime (unsigned long cycleTime)
 Set the cycle time of the PDO thread. More...
 
void setDC (bool useDC)
 Set Distributed clocks. More...
 
void setSync0Shift (int Shift)
 Set Sync0 Shift. More...
 
void setSlaveInfo (bool slaveInfo)
 Set slave information. More...
 
bool preconfigure () throw (EcError)
 Preconfiguration. More...
 
bool configure () throw (EcError)
 Configuration. More...
 
bool start () throw (EcError)
 Starts comunication. More...
 
bool stop () throw (EcError)
 Stops communication. More...
 
bool reset () throw (EcError)
 Resets configuration. More...
 
std::vector< EcSlave * > getSlaves ()
 Get slaves vector. More...
 
void update (void) throw (EcError)
 Update the outputs. More...
 

Detailed Description

Class EcMaster.

The EcMaster is the manager of the EtherCat state machine and communications.These are examples of how to use the EcMaster class:

Examples:
demo1.cpp, demo2.cpp, demo3.cpp, and demo4.cpp.

Constructor & Destructor Documentation

cpp4ec::EcMaster::EcMaster ( std::string  ecPort,
unsigned long  cycleTime = 1000000,
bool  useDC = false 
)

Constructor.

Parameters
ecPortethercat port
cycleTimeThe period of the thread that sends PDO.
useDCif true the slaves use DC synchronization.

Member Function Documentation

bool cpp4ec::EcMaster::configure ( )
throw (EcError
)

Configuration.

Configures the master and slaves. In this functions is setted to Operational the EtherCAT State Machine.

Examples:
demo1.cpp, demo2.cpp, demo3.cpp, and demo4.cpp.
std::vector<EcSlave*> cpp4ec::EcMaster::getSlaves ( )
inline

Get slaves vector.

Returns
the slaves vector.
Examples:
demo2.cpp, demo3.cpp, and demo4.cpp.
bool cpp4ec::EcMaster::preconfigure ( )
throw (EcError
)

Preconfiguration.

Preconfigures the master and slaves. In this functions is set to Preoperational the EtherCAT State Machine.

Examples:
demo1.cpp, demo2.cpp, demo3.cpp, and demo4.cpp.
bool cpp4ec::EcMaster::reset ( )
throw (EcError
)

Resets configuration.

The EtherCAT State Machine is taken to the initial state.

Examples:
demo1.cpp, demo2.cpp, demo3.cpp, and demo4.cpp.
void cpp4ec::EcMaster::setCycleTime ( unsigned long  cycleTime)
inline

Set the cycle time of the PDO thread.

Parameters
cycleTime
void cpp4ec::EcMaster::setDC ( bool  useDC)
inline

Set Distributed clocks.

Parameters
useDCif true the slaves use DC synchronization.
void cpp4ec::EcMaster::setPort ( std::string  ecPort)
inline

Set the ethercat port.

Parameters
ecPortethercat port
void cpp4ec::EcMaster::setSlaveInfo ( bool  slaveInfo)
inline

Set slave information.

Parameters
slaveInfoif true prints on EtherCATsoemInfo.txt the slave information.
void cpp4ec::EcMaster::setSync0Shift ( int  Shift)
inline

Set Sync0 Shift.

Parameters
Shift
bool cpp4ec::EcMaster::start ( )
throw (EcError
)

Starts comunication.

The realtime task for comunication starts sendding PDOs and the mottor are switched on.

Examples:
demo1.cpp, demo2.cpp, demo3.cpp, and demo4.cpp.
bool cpp4ec::EcMaster::stop ( )
throw (EcError
)

Stops communication.

The realtime task for comunication is stopped and the mottors are shutted down.

Examples:
demo1.cpp, demo2.cpp, demo3.cpp, and demo4.cpp.
void cpp4ec::EcMaster::update ( void  )
throw (EcError
)

Update the outputs.

Update the output values. It sends the output PDO to the RT task, to be sent to devices.

Examples:
demo2.cpp, demo3.cpp, and demo4.cpp.

The documentation for this class was generated from the following files: