THINGS TO CUSTOMIZE IN THIS CODE FOR YOUR IMPLEMENTATION

Note: This list could very well be incomplete! Compiled using BoostC ver 6.95.
Please leave all Freemodbus comments in, it is a condition of using this code.
See http://freemodbus.berlios.de/ for more porting documentation.

SourceBoost IDE project file is modbus.__c in demo\PIC18 directory.
There is a possibly incomplete MPLAB project file in demo\PIC18, this was NOT used.

Use the SourceBoost IDE to set the type of processor you are using in the SourceBoost project.

******
NOTE: If you want to use the NOVO RTOS system, you must copy the following files to the demo\PIC18 directory:

novocfg_pic18t3e1ts2.h,  usually in C:\Program Files\SourcBoost\include.
novolib_pic18t3e1ts2.lib,  usually in C:\Program Files\SourcBoost\lib.

You may have to have a NOVO RTOS license to get these files, but I am not sure.
The default setup is for using the NOVO RTOS.
******

If you do NOT want to use the NOVO RTOS, comment out USING_NOVO definition in demo\PIC18\port\port.h
You also need to remove novo.h, novocfg_pic18t3e1ts2.h and novolib_pic18t3e1ts2.lib from the SourcBoost IDE
workspace. At some point you will want to change the NOVO .h and .lib files to custom files which match your
RTOS needs in terms of number of tasks and events.

If you change to PIC16 and are using NOVO RTOS, you will have to change the NOVO include and library files.

Set RTU frame PDU size via MB_SER_PDU_SIZE_MAX in mbrtu.h

TRANSMIT_ON_485( ) and RECEIVE_ON_485( ) macros in port.h need to be customized for turning an RS485 link around.
In particular, you need to set DIRECTION_485_PORT, DIRECTION_485_TRIS and TRANSMIT_485_BIT to values which
reference the PIC pin you are using to set the direction of your 485 link. If you do not need direction
control, leave the macros empty. In portserial.c, the code polls for txsta.TRMT to come true before calling
RECEIVE_ON_485. This poll can be removed if you are not using the macros.

Choose style of CRC routine in mbcrc.c - C with table, C without table, or assembly(PIC18F compatible).
CRC routine is currently set to assembly, you may want to change this if you are not using a PIC18F processor.

Enable modbus functions you want to handle in mbconfig.h.

Set limitations on the desired modbus functions in their respective folder under modbus\functions. 
For example, if you only want the modbus master to be able to read 4 holding registers at once, set
MB_PDU_FUNC_READ_REGCNT_MAX to 4 in modbus\functions\mbfuncholding.c.

Fill in function handler callbacks in demo.c to handle your specific case. Example: eMBRegHoldingCB

Set your device's slave address and the correct serial parameters in call to eMBInit() in demo.c

To test, verify that the appropriate callback in demo.c is called when the Modbus master does a corresponding
request. With empty CB's in demo.c, the modbus master should get an error 2 response.