⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 canopdriver.h

📁 开放源码的CanOpen源码(C)
💻 H
字号:
/*******************************************************************************

    CANopDriver.h - User interface for using CANopenNode
    
    Copyright (C) 2004  Janez Paternoster, Slovenia

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


    Author: janez.paternoster@siol.net

    History:
    2004/06/25 [JP]  File Created
    2004/08/09 [JP]  Revised, some changes

*******************************************************************************/

#ifndef _CO_DRIVER_H
#define _CO_DRIVER_H


#include "CANopDefines.h"
   

/*******************************************************************************
   Functions implemented by user, called from CANopDriver
*******************************************************************************/
unsigned char ReadNodeID(void);
unsigned char ReadBitRate(void);
void User_InitResetNode(void);
void User_InitResetComm(void);
void User_Main(void);
void User_1msISR(void);
void User_IsrHigh(void);

/*******************************************************************************
   Variables and Object Dictionary Entries from CANopDriver
*******************************************************************************/
 //pay attention on multibyte variables if they are updated in interrupts
 //CANopen nodeID
   extern unsigned char CO_NodeID;
 //CANopen Bit rate
   extern unsigned char CO_BitRate;
 //Operating state of this node
   extern volatile unsigned char CO_NMToperatingState;
 //Operating state of monitored nodes
  #if CO_NO_CONS_HEARTBEAT > 0
   extern volatile unsigned char CO_HBcons_NMTstate[CO_NO_CONS_HEARTBEAT];
  #endif

 //PDO Data, all are free for use
   #if CO_NO_RPDO > 0
    extern volatile tData8bytes CO_RPDO[CO_NO_RPDO];        //RPDO data, UPDATED IN HIGH INTERRUPT
    extern volatile unsigned char CO_RPDOcount[CO_NO_RPDO]; //counter of recived PDOs, incremented each time PDO is recived, may be erased by user
   #endif
   #if CO_NO_TPDO > 0
    extern volatile tData8bytes CO_TPDO[CO_NO_TPDO];        //TPDO data, TRANSMITTED FROM LOW INTERRUPT
   #endif
   
  //Standard CANopen object, free for use 
   extern UNSIGNED32 ODE_Manufacturer_Status_Register;   /*index 0x1002*/
  //synchronization of nodes: one node sends SYNC message, on all nodes: 
   //ODE_SYNCcounter counts SYNC messages starting on communication reset,
   //ODE_SYNCtime counts miliseconds since last SYNC message.
   extern UNSIGNED16 ODE_SYNCcounter;  /*index 0x2103*/ //UPDATED IN BOTH INTERRUPTS
   extern UNSIGNED16 ODE_SYNCtime;     /*index 0x2104*/ //UPDATED IN BOTH INTERRUPTS

/*******************************************************************************
   Variables and Function for sending raw can messages.
   Don't use it if there is no need to!
   
   Flag bits, array index and BuffNo can be form 0 to (CO_NO_USR_CAN_BUFF-1)
*******************************************************************************/
   #if CO_NO_USR_CAN_BUFF > 0
      extern CO_CanMessage CO_TXCAN_OtherMsgs[];
      char CO_CanSendOther(unsigned char BuffNo);
   #endif
   
/*******************************************************************************
   User Object Dictionary Entries
*******************************************************************************/
   //this entery should be replaced with DIP switches on printed board
   extern UNSIGNED8  ODE_CANnodeID;    /*index 0x2101*/
   extern UNSIGNED8  ODE_CANbitRate;   /*index 0x2102*/


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -