.. first line of object.rst template .. first line of pou-object.rst template .. first line of prg-object.rst template .. <% set key = ".fld-Projektinformationen.ProjectInfo" %> .. _`.fld-Projektinformationen.ProjectInfo`: .. <% merge "object.Defines" %> .. <% endmerge %> .. _`ProjectInfo`: ProjectInfo (PRG) ----------------- PROGRAM ProjectInfo .. <% merge "object.Doc" %> | Die Projektinfo ist eine Ansammlung zur Anwendung der Klasse im ProgrammCode. .. note:: Die Beschreibung ist Beispielhaft und an das Projekt CanOpenMaster angelehnt. | *************************************************************************************************************************************************************** + **Einbinden des Bibliothek CanOpenCheck** -> Typische vorgehensweise: | 1.) Einbinden der Bibliothek und Instanzierung des FB's | | VAR: | ``_CanOpenCheck : ELA_CANOpenCheck.CanOpenCheck_FB;`` | | 2.) Anlegen der Rückgabevariablen im Projekt | | VAR: | ``pzaDeviceState : POINTER TO ARRAY [0..3] OF CIA405.DEVICE_STATE; // DEVICESTATE`` | ``pzaLocalCanState : POINTER TO ARRAY [0..3] OF CIA405.CANOPEN_KERNEL_ERROR; // DEVICEERROR`` | | Der FB gibt die Informationen für Devices 0(Master)..127(Slaves) bekannt. | Da die Rückgabe über Pointer erfolgt, kann das Array der eigen Applikation kleiner ausfallen. | .. table:: Device +--------------+-------------------------------------------------+ | 0 | Master | +--------------+-------------------------------------------------+ | 1..127 | Slaves | | | | +--------------+-------------------------------------------------+ | | 3.) Versorgen der Bausteineingänge | | Code: | ``_CanOpenCheck._wCANTimeout := wCANTimeout; (* Timoutzeit in ms. Default = 50; Abweichenden Wert hier einmalig angeben *)`` | ``_CanOpenCheck._byNetzwerk := 1 ; // CanController, 1:= CAN0, 2:= CAN1 ....`` | ``_CanOpenCheck._MaxNodeID := 3 ; // `` | | | 4.) Aufruf der Methode | | ``_CanOpenCheck();`` | | 5.) Abfrage der eigenen Node ID | | Code: | ``_CanOpenCheck._byLocalID;`` | | 6.) Abfrage des Gerätestatus | | Code: | ``pzaDeviceState^[0]; // Debugausgabe: Status MASTER"`` | ``pzaDeviceState^[1]; // Debugausgabe: Status Slave ID 1`` | ``pzaDeviceState^[2]; // Debugausgabe: Status Slave ID 2`` | | 7.) Abfrage des CanStatus | | Code: | ``pzaLocalCanState^[0]; // Debugausgabe: Kernel Status MASTER`` | ``pzaLocalCanState^[1]; // Debugausgabe: Kernel Status Slave ID 1`` | ``pzaLocalCanState^[2]; // Debugausgabe: Kernel Status Slave ID 2`` | | *************************************************************************************************************************************************************** + **Beispiele** | | 1.) Aussprung wenn Slave ID1 nicht bereit | | Code: | ``IF pzaDeviceState^[1] <> CIA405.DEVICE_STATE.OPERATIONAL`` | ``THEN`` | ``RETURN`` | ``END_IF`` | | | *************************************************************************************************************************************************************** | + **Typische Device States** | | .. table:: DEVICE_STATE (ENUM)¶ +----------------------+------------------------------------------------------------------------+---------------+ | ENUM | Bedeutung: | Wert | +======================+========================================================================+===============+ | INIT | | 0 | +----------------------+------------------------------------------------------------------------+---------------+ | RESET_COMM | | 1 | +----------------------+------------------------------------------------------------------------+---------------+ | RESET_APP | | 2 | +----------------------+------------------------------------------------------------------------+---------------+ | PRE_OPERATIONAL | | 3 | +----------------------+------------------------------------------------------------------------+---------------+ | STOPPED | | 4 | +----------------------+------------------------------------------------------------------------+---------------+ | OPERATIONAL | | 5 | +----------------------+------------------------------------------------------------------------+---------------+ | UNKNOWN | | 6 | +----------------------+------------------------------------------------------------------------+---------------+ | NOT_AVAIL | | 7 | +----------------------+------------------------------------------------------------------------+---------------+ | + **Typische Kernal Errors** | | .. table:: CANOPEN_KERNEL_ERROR (ENUM)¶ +---------------------------------+----------------------------------------------------------------+---------------+ | ENUM | Bedeutung: | Wert | +=================================+================================================================+===============+ | CANOPEN_KERNEL_NO_ERROR | There is no error | 0 | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_KERNEL_OTHER_ERROR | More information is provided by output ERRORINFO. | 1 | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_KERNEL_DATA_OVERFLOW | Lost counter or Tx/Rx error counter is above 0. | 2 | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_KERNEL_TIMEOUT | A timeout occurred. | 3 | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_KERNEL_CANBUS_OFF | CAN Bus is in BUSOFF or busalarm state. | 4 | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_KERNEL_CAN_ERROR_PASSIVE| CAN Bus is in Error Passive state | 5 | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_INTERNAL_FB_ERROR | internal error | 6 | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_NO_MORE_MEMORY | There is not enough memory. | 7 | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_WRONG_PARAMETER | Wrong parameter passed to the function | | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_NODEID_UNKNOWN | Unknown NodeID. | | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_NETID_UNKNOWN | Unknown CAN Network ID (not part of I/O config | | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_REQUEST_ERROR | A request error happened. | | +---------------------------------+----------------------------------------------------------------+---------------+ |CANOPEN_SDOCHANNEL_UNKNOWN | Unknown SDO channel. | | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_NO_DRIVER | CAN Driver not found. | | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_CONFIGURATION_ERROR | At least one SDO abort in configuration phase of a slave. | | +---------------------------------+----------------------------------------------------------------+---------------+ | CANOPEN_GUARDING_ERROR | A guarding error (Heartbeat or Nodeguarding) | | +---------------------------------+----------------------------------------------------------------+---------------+ .. <% endmerge %> .. <% merge "object.iotbl" %> .. <% endmerge %> .. last line of prg-object.rst template .. last line of pou-object.rst template .. last line of object.rst template