The source code obtained by using the Slave Configuration tool of double blessing has the following
2014/12/26 11:24 1,021 1.TXT
2014/12/26 11:24 0 2.txt
2012/04/11 20:43 22,131 aoeappl.c
2012/04/11 20:43 1,578 aoeappl.h
2012/04/11 20:43 1,757 bootmode.c
2012/04/11 20:43 749 Bootmode.h
2012/04/11 20:43 57,363 cia402appl.c
2012/04/11 20:43 43,902 cia402appl.h
2012/04/11 20:43 50,868 coeappl.c
2012/04/11 20:43 1,755 coeappl.h
2012/04/11 20:43 24,151 diag.c
2012/04/11 20:43 5,746 diag.h
2014/04/08 15:36 337 Dirtree.bat
2012/04/11 20:44 20,193 ecataoe.c
2012/04/11 20:44 9,276 ecataoe.h
2012/04/11 20:44 40,417 ECATAPPL.C
2012/04/11 20:44 6,232 ecatappl.h
2012/04/11 20:44 5,736 ecatcoe.c
2012/04/11 20:44 3,626 ecatcoe.h
2012/04/11 20:44 24,095 ecateoe.c
2012/04/11 20:44 6,926 ecateoe.h
2012/04/11 20:44 15,512 ecatfoe.c
2012/04/11 20:44 7,722 ecatfoe.h
2012/04/11 20:44 101,393 ecatslv.c
2012/04/11 20:44 21,611 Ecatslv.h
2012/04/11 20:44 6,467 ecatsoe.c
2012/04/11 20:44 4,006 ecatsoe.h
2013/01/08 13:52 37,184 ecat_def.h
2012/04/11 20:44 17,575 el9800appl.c
2012/04/11 20:44 23,075 el9800appl.h
2012/04/11 20:44 40,016 el9800hw.c
2012/04/11 20:44 8,199 el9800hw.h
2012/04/11 20:44 11,044 emcy.c
2012/04/11 20:44 4,598 Emcy.h
2012/04/11 20:44 10,046 eoeappl.c
2012/04/11 20:44 7,605 eoeappl.h
2012/04/11 20:44 19,707 esc.h
2012/04/11 20:44 663 EtherCATSampleLibrary.h
2012/04/11 20:44 9,572 fc1100hw.c
2012/04/11 20:44 4,698 fc1100hw.h
2012/04/11 20:44 13,423 foeappl.c
2012/04/11 20:44 1,813 foeappl.h
2013/01/11 11:08 43,814 mailbox.c
2012/04/11 20:44 6,798 mailbox.h
2012/04/11 20:44 13,035 mcihw.c
2012/04/11 20:44 5,398 mcihw.h
2012/04/11 20:44 65,013 OBJDEF.C
2012/04/11 20:44 10,335 objdef.h
2012/04/11 20:44 10,624 SAMPLEAPPL.C
2012/04/11 20:44 6,379 sampleappl.h
2012/04/11 20:44 10,555 sampleapplicationinterface.c
2012/04/11 20:44 6,322 SampleApplicationInterface.h
2012/04/11 20:44 65,923 sdoserv.c
2012/04/11 20:44 26,002 Sdoserv.h
2012/04/11 20:44 403,968 TcHelper.dll
2012/04/11 20:44 829 TcHelper.h
2012/04/11 20:44 2,406 TcHelper.lib
2012/04/11 20:44 38,440 testappl.c
2012/04/11 20:44 29,615 testappl.h
59 Files 1,439,244 bytes
From the communication level, the Slave software protocol stack is divided into two tiers: the Data Link layer (DL,
Link layer) and the application layer (AL, application layer, respectively, implement the ETHERCAT protocol to
and application-level communication protocols.
Data link layer is the data exchange layer of ESC and slave microprocessor, ESC and slave microprocessor
can be either SPI (Serial peripheral Interface, serial Peripheral Interface) or MCI (Micro
Controller Interface, microcontroller interface) two modes of transmission of data, the protocol stack will be two modes
Encapsulated as a unified interface for direct invocation of upper layer protocols. Based on the ETHERCAT protocol, real-time and number
According to the requirements of the volume, the use of MCI parallel microcontroller interface to transmit data, the following functional modules with
To implement the underlying communication:
SPIHW: Serial Mode processor interface module. Defines the microprocessor and ESC in serial mode
Communication interface function, which is called when the upper application communicates, and completes the exchange of the underlying data.
MCIHW: Parallel Controller Interface module. The microcontroller and ESC in parallel mode are defined.
interface function, which is called when the upper application communicates, and the exchange of the underlying data is completed.
the application layer is the real implementation EtherCAT part of the agreement, including state machine processing, periodic over
Process data processing and non-cyclical mailbox data processing , the application layer includes the following functional modules:
ECATSLV: Processes the EtherCAT state machine module. The state machine conversion request is initiated by the master
The station writes the request state to the A1control register, retrieving the current form from the query
To pass the register value as a parameter into the Al_controlind () function, which
For the core function to handle the transformation of the state machine, configure the opening of the SM channel according to the state of the master request
or off, check that the SM channel parameters are configured correctly, and so on.
Ecatappl:ethercat slave Application Layer interface, the entire protocol stack runs the core module ,
EtherCAT slave state machine and process data interface. The definition of the Main () function, the input and output path data
Object mapping processing, ESC and processor local memory input and output process data exchange, etc.;
Mailbox: Process the EtherCAT Mailbox Service module. Including the initialization of the mailbox communication interface,
Mailbox Channel parameter configuration, according to the current state machine to turn on or off the mailbox service, mailbox communication loss
Post-Failure mailbox repeat request, mailbox data read and write, and different service classes based on master request
Call the corresponding service function to deal with, this article mainly studies the COE mailbox service type processing.
The Ecatcoe:coe (CANopen overethercat) processing function defines the module. including the Coe
Interface initialization, processing of the currently requested Coe service, and the COE that has not been processed for saving
The processing of the service.
SDOSERV:SDO Service processing module. Processing of all SDO and SDO information services, including
The main station sends the upload, downloads the SDO service request processing, after processing completes the SDO response data by
The main station to actively read.
Objdef: Access the Coe object Dictionary module. Read-write Object dictionary, get the object dictionary entrance,
and the specific processing function of the object dictionary is implemented by the module.
The application layer interface module for the Coeappl:coe service. The actual application of the COE service is handled to
and the processing of the Coe object dictionary. Includes initialization of object dictionaries, adding objects to object dictionaries, moving
The implementation of a handler function, except for an entry in the object dictionary and a clear object dictionary.
Beckoff ethercat Slave Code Architecture parsing