datagram

package
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datagram

type Datagram struct {
	Command command.Type          // EtherCAT Command Type
	Index   uint8                 // The index is a numeric identifier used by the master for identification of duplicates/lost datagrams. It shall not be changed by EtherCAT slaves
	Address uint32                // Address (Auto Increment, Configured Station Address, or Logical Address)
	LRCM    Lrcm                  // LRCM represents the Len, R, C, M fields in the EtherCAT Datagram header.
	IRQ     uint16                // EtherCAT Event Request registers of all slaves combined with a logical OR
	Data    payload.MarshalerByte // Read/Write Data
	WKC     uint16                // Working Counter
}

EcatDatagram represents an EtherCAT datagram.

It contains various fields including the EtherCAT command type, index, address, LRCM (Length, Reserved, Circulating Frame, More EtherCAT Data), IRQ (EtherCAT Event Request registers of all slaves combined with a logical OR), data for read/write operations, and the working counter.

func (Datagram) Bytes

func (e Datagram) Bytes() []byte

Bytes returns the byte representation of the EtherCAT datagram.

Returns:

  • []byte: The byte representation of the EtherCAT datagram.

type Lrcm

type Lrcm struct {
	M   bool   // M: 1 bit (More EtherCAT Data)
	C   bool   // C: 1 bit (Circulating Frame)
	R   uint16 // R: 3 bit (Reserved)
	Len uint16 // Len: 11 bits (Paylod Length)
}

Lrcm represents the Len, R, C, M fields in the EtherCAT Datagram header.

----------------- LRCM ---------------------

| M: 1bit | C: 1bit | R: 3bit | Len: 11bit |

--------------------------------------------

func NEWLrcmFromUint16

func NEWLrcmFromUint16(l uint16) Lrcm

NEWLrcmFromUint16 creates an Lrcm instance from a uint16 value.

Parameters:

  • l: The uint16 value representing Lrcm fields.

Returns:

  • Lrcm: New Lrcm instance

func NewLrcm

func NewLrcm(isMore bool, isCirculating bool, len uint16) Lrcm

NewLrcm creates a new Lrcm instance with the specified values for M, C, and Len.

Parameters:

  • m: More EtherCAT Data field (1 bit, {0: last, 1: more})
  • c: Circulating Frame field (1 bit, {0: not, 1: circulating})
  • len: Payload Length field (11 bits, valid values: 0 to 2047)

Returns:

  • Lrcm: New Lrcm instance
  • error: An error is returned if the provided values are out of valid range.

func (Lrcm) Uint16

func (Lrcm Lrcm) Uint16() uint16

Uint16 returns the uint16 representation of the Lrcm instance.

Returns:

  • uint16: The uint16 value representing Lrcm fields.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL