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

📄 corps.tex

📁 CANopen源代码
💻 TEX
📖 第 1 页 / 共 2 页
字号:
\item Move \emph{objdict.xml, objdict.html, objdict.c} in\\ \emph{CanOpen/Your\_application}Returns \emph{CanOpen/Your\_application} and compile your code by : \\make -f Makefilexxx\\\end{enumerate} \subparagraph{Important notes}\begin{itemize}\item The file (schema) to verify the grammar of \emph{objdict.xml} is\\ \emph{CanOpen/XML\_TOOLS/jaxe/objdict.xsd}\item The file (xslt) to compute \emph{objdict.html} is\\\emph{CanOpen/XML\_TOOLS/jaxe/objdict.xsl}\item After having edited \emph{objdict.xml}, you \textsc{must} verify it, because most of the verifications ofyour entries are done here. To make that verification, you are notobliged to use Jaxe. You can also download the Apache for Java XML tools.\\Then, the command line is something like~:\begin{verbatim}java dom.ASBuilder  -f -a ./objdict.xsd  -i ./objdict.xml\end{verbatim}\end{itemize} \section{FAQ}\subsubsection{Does the code compiles on Windows ?}Yes, In fact, we use the CANopen layer in a huge project on Windows XP.For the Adlink 7841, we are using the driver provided by Adlink. We have hadsome problems with it, especially while waiting the messages received on event. Well, we have got round (more or less..) the bugs, and we have  done amaster node, compiled with Visual Studio C++.We plan to replace the Adlink 7841, while Adlink is not able todistibute a good driver,  by a Peaksystem board.Because some files in the project are in C++, and the CANopen layer in C,I think we have put a compilation option /TC or /TP. See the MSDN documentationabout that.You have to interface the library to the CAN board you are using. To do that,add a new directory \emph{CanOpenDriverxxx} in \emph{CanOpen/} and put your code inside, as we have done forHC12 and Linux.In \emph{CanOpen/include}, create also a new directory and put the two files \emph{applicfg.h, timerhw.h}.\subsubsection{How to fit the library to an other microcontr鬺er ?}First, be sure that you have at least 40K bytes of program memory, and about 2k of RAM.It is not a such hard work. Be kind not to put specific code for your microcontroler in the code which is target independant. Put a prefix for the object files you create. Example on HC12 :\\nmtMaster.c $\Longrightarrow$ hc12\_nmtMaster.o\subsubsection{[LINUX] : How to use an other board than Adlink 7841 orPeaksystem board ?}If you have a driver, it should be easy. copy and rename thedirectory\\ \emph{CanOpen/CanOpenDriverLinux}and change the content of \emph{receiveMsgHandler(), f\_can\_receive(), f\_can\_send()}. Add others specific functions, for example to open and close your board.If you have no driver, you have to develop it before.\subsubsection{[HC12] : What board are you using ? }A T-board from elektronikladen with a MC9S12DP256 or MC9S12DG256.\subsubsection{[HC12] : Does the code compile with an other compiler than GNU gcc ?}It is known to work with Metrowerks CodeWarrior. Here are some tipsfrom Philippe Foureys. :\\\paragraph {Interrupt functions}\subparagraph{Code for GCC}\begin{verbatim}// prototypevoid __attribute__((interrupt))timer3Hdl(void):// functionvoid __attribute__((interrupt))timer3Hdl(void){...}\end{verbatim}\subparagraph{Code for CodeWarrior}\begin{verbatim}// protoypevoid interrupt timer3Hdl(void);// functionpragma CODE_SEG__NEAR_SEG_NON_BANKEDvoid interrupt timer3Hdl(void){...}pragma CODE_SEG_DEFAULT\end{verbatim}\paragraph {Interrupt lock, unlock}\subparagraph{Code for GCC}\begin{verbatim}void unlock (void){  __asm__ __volatile__("cli");}void lock (void){  unsigned short mask;  __asm__ __volatile__("tpa\n\tsei":"=d"(mask));}\end{verbatim}\subparagraph{Code for CodeWarrior}\begin{verbatim}void unlock (void){  __asm("cli");}void lock (void){  unsigned short mask;  __asm {  tpa:tsei:"=d"(mask); }}\end{verbatim}\paragraph {Initialize function}\subparagraph{Code for GCC}\begin{verbatim}void initCanHCS12 (void){    //Init the HCS12 microcontroler for CanOpen   initHCS12();   // Init the HCS12  CAN driver  const canBusInit bi0 = {    0,    /* no low power                 */     0,    /* no time stamp                */    1,    /* enable MSCAN                 */    0,    /* clock source : oscillator (In fact, it is not used)   */    0,    /* no loop back                 */    0,    /* no listen only               */    0,    /* no low pass filter for wk up */	CAN_Baudrates[CAN_BAUDRATE_250K],    {      0x00,    /* Filter on 16 bits. See Motorola Block Guide V02.14 fig 4-3 */      0x00, 0xFF, /* filter 0 hight accept all msg      */      0x00, 0xFF, /* filter 0 low accept all msg        */      0x00, 0xFF, /* filter 1 hight filter all of  msg  */      0x00, 0xFF, /* filter 1 low filter all of  msg    */      0x00, 0xFF, /* filter 2 hight filter most of  msg */      0x00, 0xFF, /* filter 2 low filter most of  msg   */      0x00, 0xFF, /* filter 3 hight filter most of  msg */      0x00, 0xFF, /* filter 3 low filter most of  msg   */    }  }; \end{verbatim}\subparagraph{Code for CodeWarrior}\begin{verbatim}void initCanHCS12 (void){    //Init the HCS12 microcontroler for CanOpen   initHCS12();   // Init the HCS12  CAN driver  const canBusInit bi0 = {    0,    /* no low power                 */     0,    /* no time stamp                */    1,    /* enable MSCAN                 */    0,    /* clock source : oscillator (In fact, it is not used)   */    0,    /* no loop back                 */    0,    /* no listen only               */    0,    /* no low pass filter for wk up */    {     1, /* clksrc */     3, /* brp    */     0, /* sjw    */     0, /* samp   */     1, /* tseg2  */     12,/* tseg1  */    },	    {      0x00,    /* Filter on 16 bits. See Motorola Block Guide V02.14 fig 4-3 */      0x00, 0xFF, /* filter 0 hight accept all msg      */      0x00, 0xFF, /* filter 0 low accept all msg        */      0x00, 0xFF, /* filter 1 hight filter all of  msg  */      0x00, 0xFF, /* filter 1 low filter all of  msg    */      0x00, 0xFF, /* filter 2 hight filter most of  msg */      0x00, 0xFF, /* filter 2 low filter most of  msg   */      0x00, 0xFF, /* filter 3 hight filter most of  msg */      0x00, 0xFF, /* filter 3 low filter most of  msg   */    }  }; \end{verbatim}\subsubsection{[HC12] : Does the code works in banked memory ?}No. Today it seems that the port of gcc is bogged for using thebanked memory. So, unfortunately, we are limited to 48 Kbytes of memory code. \subsubsection{[HC12] : What GCC version are you using ?}We are using the stable RPM release 2.2 :\begin{itemize}\item GNU Gcc 3.0.4. Build 20030501\item Newlib 1.10.0 Build 20030421\item GNU Binutils 2.12.1 Build 20030427\end{itemize}\subsubsection{Is canfestival2 conform to DS301 v.4.02 ? }Thanks to Philippe Foureys (IUT of Valence),a slave node have been tested with the \emph{National InstrumentCanOpen Conformance Test}.It passed the test with success. \\Some very small unconformity have been found in very unusualsituations, for example in the SDO code response to wrong messages.\newpage % Simple saut de page\appendix % Pour num閞oter les chapitres qui suivent comme annexes\section{Warnings and errors messages management}%********************************\subsection{Warnings messages}\small{\begin{tabular}{|p{1.7cm}|p{1.7cm}|p{1.7cm}||p{2cm}|p{2cm}|p{2cm}|p{2cm}|}\hline\scriptsize{\textbf {DEBUG \_WAR \_CONSOLE \_ON}} & \scriptsize{\textbf{DEBUG \_CAN}} & \textbf{print\-Msg\-War\-To\-Console} & \textbf{Printing long message on console} & \textbf{Printing short message on console.} (number and value only) & \textbf{Sending number and value in a PDO.}, only if the node is a slave, in operational state.\\\hline DEF   & DEF     &  1 &     & yes &  \\\hlineDEF   & DEF     &  0 &     &     &  \\\hlineDEF   & UNDEF   &  1 & yes &     &  \\\hlineDEF   & UNDEF   &  0 &     &     &  \\\hlineUNDEF & X       &  X &     &     &  \\\hline\end{tabular}}\subsection{Errors messages}\small{\begin{tabular}{|p{1.7cm}|p{1.7cm}|p{1.7cm}|p{2cm}||p{2cm}|p{2cm}|p{2cm}|p{2cm}|}\hline\scriptsize{\textbf {DEBUG \_ERR \_CONSOLE \_ON}} & \scriptsize{\textbf{DEBUG \_CAN}} & \scriptsize{\textbf{PDO \_ERROR}} &\textbf{print\-Msg\-Err\-To\-Console} & \textbf{Printing long message on console} & \textbf{Printing short message on console.} (number and value only) & \textbf{Sending number and value in a PDO.}, only if the node is a slave, in operational state.\\\hline DEF   & DEF     &  X     & 1    &     & yes & yes  \\\hlineDEF   & DEF     &  X     & 0    & yes &     & yes  \\\hlineDEF   & UNDEF   &  X     & 1    &     &     & yes  \\\hlineDEF   & UNDEF   &  X     & 0    &     &     & yes  \\\hlineUNDEF & X       &  DEF   & X    &     &     & yes  \\\hlineUNDEF & X       &  UNDEF & X    &     &     &      \\\hline\end{tabular}}\section {Web resources}\subsubsection*{CIA : Can in Automation}Many documentation on CANopen.\\\href{http://www.can-cia.de}{http://www.can-cia.de}\subsubsection*{Resources and training in CANopen}\href{http://www.esacademy.com}{http://www.esacademy.com}\subsubsection*{Elektronikladen HCS12 T-board}\href{http://www.elektronikladen.de/en\_hcs12tb.html}{http://www.elektronikladen.de/en\_hcs12tb.html}\subsubsection*{Gnu gcc compiler for HC12}\href{http://m68hc11.serveftp.org/m68hc11_port.php}{http://m68hc11.serveftp.org/m68hc11\_port.php}\subsubsection*{Motorola documentation on HC12}\href{http://www.freescale.com/webapp/sps/site/prod\_summary.jsp?code=MC9S12DP256}{http://www.freescale.com/webapp/sps/site/prod\_summary.jsp?code=MC9S12DP256}\subsubsection*{Lauterbach debugger for HC12}\href{http://www.lauterbach.com}{http://www.lauterbach.com}\subsubsection*{PHP. Script language}\href{http://www.php.net}{http://www.php.net}\subsubsection*{Jaxe, XML editor written in Java}\href{http://jaxe.sourceforge.net}{http://jaxe.sourceforge.net}

⌨️ 快捷键说明

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