Pular para o conteúdo principal

Estrutura da API do mestre

A interface central do mestre EtherCAT: ela gerencia a inicialização, o gerenciamento de estado, o controle dos escravos e a comunicação PDO de toda a rede EtherCAT.

Estrutura da API​

Cada função identifica a instância do mestre por um uint16_t master_index (retornado por Initialize()).

As funções públicas são incluídas por ethercat.h e chamadas diretamente com o índice do mestre (sem manipulador de DLL, sem tabela de ponteiros de função):

C SDK (ethercat.h)                     // chamada direta, sem manipulador de DLL
│
├── Ciclo de vida: Initialize, Dispose, Start, Stop
├── Rede: SetNetwork, GetNetworkInfo, QuickSlaveCount
├── Máquina de estados: SetState, SetStateSequence, SetStateWithTimeout
├── IO: CopySlaveInputPdo, WriteSlaveOutputPdo
│
├── Propriedades do escravo: GetSlaveVendorId, GetSlaveName, GetSlaveState...
│ ├── Leitura/escrita de PDO: CopySlaveInputPdo, WriteSlaveOutputPdo
│ ├── CoE/SDO: sdo_read_typed_ex, sdo_write_typed_ex, sdo_read_u16
│ │ ├── CiA 402: CiA402_Enable, CiA402_SetMode, CiA402_ParseState
│ │ └── EMCY: EmcyGetHistory, EmcyClearHistory
│ ├── SoE: soe_read_u16, soe_write_u16, soe_read_string
│ ├── FoE: foe_upload, foe_download
│ ├── EoE: eoe_ping, eoe_set_receive_hook
│ ├── AoE: aoe_sub_create, aoe_sub_add
│ ├── VoE: voe_register_notification
│ ├── FSoE: fsoe_manager_create, fsoe_manager_get_info
│ ├── DC: SetSyncBySlaveIndex, GetSlaveHasDC
│ └── Parâmetros de inicialização: AddStartupParameter, ClearStartupParameters, ApplyStartupParameters
│
├── Configuração: LoadConfigJson, AutoConfigureSM, EcInit, EcClose
├── DC: ConfigureDCAll, EnableDriftCompensation
├── Gerenciamento de grupos: SetSlaveGroup, SetGroupCycleDivider
├── Redundância: GetRedundancyStatus
├── Diagnóstico: GetDiagnosticsSnapshot, GetBreakPoints
├── Registradores/watchdog: WriteSlaveRegister, ReadSlaveRegister, SetSlaveWatchdog
├── Gateway de caixa de correio: gateway_create / gateway_start / gateway_stop / gateway_get_statistics(master/gateway.h)
│
├── Callbacks de evento:
│ ├── SetLogCallback
│ ├── RegisterProcessDataCyclicCallbackSync
│ ├── RegisterSlaveStateChangeCallbackSync / RegisterSlaveStateChangeCallbackAsync
│ ├── RegisterEmergencyEventCallback
│ ├── RegisterSlaveDiscoveryCallbackSync / RegisterSlaveDiscoveryCallbackAsync
│ ├── RegisterPDOFrameLossCallback
│ ├── RegisterRedundancyModeChangedCallback
│ ├── RegisterSlavePreOpReconfigCallback
│ └── SetDCSyncLostCallback