📄 user_lpc2.c
字号:
/**************************************************************************
MODULE: USER
CONTAINS: MicroCANopen Object Dictionary and Process Image implementation
COPYRIGHT: Embedded Systems Academy, Inc. 2002-2004.
All rights reserved. www.microcanopen.com
This software was written in accordance to the guidelines at
www.esacademy.com/software/softwarestyleguide.pdf
DISCLAIM: Read and understand our disclaimer before using this code!
www.esacademy.com/disclaim.htm
LICENSE: THIS VERSION CREATED FOR FREE DISTRIBUTION
FOR KEIL SOFTWARE www.keil.com
FOR PHILIPS SEMICONDUCTORS www.philipsmcu.com
VERSION: 1.21, Pf 02-FEB-04
---------------------------------------------------------------------------
HISTORY: 1.21, Pf 02-FEB-04, Release for Philips LPC2129
1.20, Pf 19-AUG-03, First Published Version
Functionality in this module was located in module MCO in
previous releases.
***************************************************************************/
#include "mco.h"
#include "mcohw.h"
#include "string.h"
#if (NR_OF_RPDOS != 2)
#if (NR_OF_TPDOS != 2)
ERROR: This example is for 2 TPDOs and 2 RPDOs only
#endif
#endif
// Global timer/conter variable, incremented every millisecond
extern WORD volatile gTimCnt;
/**************************************************************************
MACROS FOR OBJECT DICTIONARY ENTRIES
***************************************************************************/
#define GETBYTE(val,pos) ((val >> pos) & 0xFF)
#define GETBYTES16(val) GETBYTE(val, 0), GETBYTE(val, 8)
#define GETBYTES32(val) GETBYTE(val, 0), GETBYTE(val, 8), GETBYTE(val,16), GETBYTE(val,24)
#define SDOREPLY(index,sub,len,val) 0x43 | ((4-len)<<2), GETBYTES16(index), sub, GETBYTES32(val)
#define SDOREPLY4(index,sub,len,d1,d2,d3,d4) 0x43 | ((4-len)<<2), GETBYTES16(index), sub, d1, d2, d3, d4
#define ODENTRY(index,sub,len,offset) {index, sub, len, offset}
/**************************************************************************
GLOBAL VARIABLES
***************************************************************************/
// This structure holds all node specific configuration
BYTE volatile gProcImg[PROCIMG_SIZE];
// Table with SDO Responses for read requests to OD
BYTE MEM_CONST SDOResponseTable[] = {
// Each Row has 8 Bytes:
// Command Specifier for SDO Response (1 byte)
// bits 2+3 contain: '4'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -