title: Freemodbus on PIC18F with MPLAB X XC8
body: <p>I'm trying to adapt the freemodbus library into a microcontroller PIC18F from microchip, on the MPLAB X ide and XC8 compiler.</p>
  <p>I've corrected as much as I could and currently the problems that I have are about sintaxis,</p>
  <p>I wonder if somebody can help me with the next issues, on my files I've done the types declarations to match with my compiler, like UCHAR = uint8...</p>
  <p>In the file <a href="http://www.sourceboost.com/Products/BoostC/ExampleCode/Modbus/html/modbus/include/mbframe.h.html" rel="nofollow noreferrer" title="mbframe.h">mbframe.h</a></p>
  <pre><code>typedef eMBErrorCode( *peMBFrameReceive ) ( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength );
  </code></pre>
  <p>I'm getting the error:</p>
  <blockquote>
  <p>modbus/functions/../includes/mbframe.h:77: error: (194) &quot;)&quot; expected</p>
  </blockquote>
  <p>The parameters are being defined there (pucRcvAddress, pucFrame, pusLength ) ok?</p>
  <p>About peMBFrameReceive I think it's declared in the file <a href="http://ucxpresso.googlecode.com/svn/trunk/nano1768/uCXpresso/extensions/lib/modbus/mb.c/" rel="nofollow noreferrer" title="mb.c">mb.c</a>:</p>
  <pre><code>static peMBFrameReceive peMBFrameReceiveCur;
  </code></pre>
  <p>It has not an error but a warning</p>
  <blockquote>
  <p>modbus/mb.c:65: warning: (374) missing basic type; int assumed</p>
  </blockquote>
  <p>And in the mb.h</p>
  <pre><code>    /*! \ingroup modbus
   * \brief Errorcodes used by all function in the protocol stack.
   */
  typedef enum {
      MB_ENOERR, /*!&lt; no error. */
      MB_ENOREG, /*!&lt; illegal register address. */
      MB_EINVAL, /*!&lt; illegal argument. */
      MB_EPORTERR, /*!&lt; porting layer error. */
      MB_ENORES, /*!&lt; insufficient resources. */
      MB_EIO, /*!&lt; I/O error. */
      MB_EILLSTATE, /*!&lt; protocol stack in illegal state. */
      MB_ETIMEDOUT /*!&lt; timeout error occurred. */
  } eMBErrorCode;
  </code></pre>
  <p>What I understand is that &quot;typedef eMBErrorCode(...&quot; is the definition and &quot;static ...&quot; is the declaration.</p>
  <p>And it cannot find the type &quot;peMBFrameReceive&quot;, becasuse it has an error, so do you know whats wrong with the definition?</p>
  <p>Thanks and my best regards</p>