Main Page
2.48
This download (example projects download from SBC65EC or SBC68EC product pages) contains example projects for using the Modtronix TCP/IP Stack with different target boards and compilers. Each folder contains one or more MPLAB IDE example project.
All examples are supplied with "*.mcp" MPLAB IDE project files (in "src" folder of example folder). To compile the project, simply install the MPLAB IDE and a compiler, open the project in MPLAB, select the PIC chip in MPLAB ("Configure", "Select Device..." menu) and click on the "Build All" toolbar button. This will compile the whole project and create the hex file.
MPLAB Workspace files (*.mcw) are also supplied for different hardware version of each board.
The name of the MPLAB project file indicates the following:
- What project it will compile
- For what target device the project is compiled
- What compiler is used
- If it creates code for a board with or without a bootloader
The name of the MPLAB project file has the following format: projectname_target_bootloader_compiler.mcp
- The projectname part gives the name of the project. For example "udp1", "tcp1"...
- The target part gives the name of the target device and it's hardware version. For example "65hw201" will indicate that the project creates code for the SBC65EC Hardware version 2.01.
- The bootloader part indicates if the project creates code for use with a bootloader board or not. If it is NOT present the code is created for a board with a bootloader. If it is "nobl", code is created for a board without a bootloader.
- The compiler part indicates what compiler is used, and can be "mc" for the MPLAB C18 Compiler, or "ht" for the Hi Tech PICC18 Compiler.
Some example project names and their meanings are:
- udp1_65hw211_mc.mcp Project file for the "UDP1" project. Uses the MPLAB C18 Compiler. Creates code for the SBC65EC Hardware V2.11 target board with a bootloader.
- tcp2_65hw201_nobl_ht.mcp Project file for the "TCP2" project. Uses the Hi Tech PICC18 Compiler. Creates code for the SBC65EC Hardware V2.01 target board without a bootloader.
Some Modtronix Ethernet enabled boards are delivered programmed with a network bootloader for updating the firmware. Such a board can be identified by a BLN Vm.nn label on the front of the board - normally stuck on the RTL8019AS 100 pin network chip. Where Vm.nn is the version number of the bootloader. These boards can be programmed without a PIC programmer.
When using the MPLAB C18 compiler and MPLAB, you have to ensure that the versions of both programs are correct. Click here for details. The MPLAB C18 projects included with this download have been configured for MPLAB C18 V3.02 or higher, and MPLAB V7.22 or higher.
When using the HI-TECH PICC18 compiler, V8.35PL3 or higher should be used. This project was tested with V8.35PL3.
Each MPLAB project will create code for a specific target board. The target board can be specified in one of two places:
- In the "projdefs.h" file (in "src" folder of project)
- In the MPLAB project.
Most projects included with this download use the MPLAB project file to specify the target board. To modify such a project for another target board, right click on the project in MPLAB, select "Build Options...", and in the "Macro Definitions" edit box modify the "BRD_XXX" define for the required board, for example "BRD_SBC65EC".
If the target board is defined in the "projdefs.h" file, the following line in this file has to be changed to compile the project for a different target board.
Additionally the PIC microcontroller has to be specified in MPLAB before building the project. This has to be the PIC used on the target board. This is done in the "Configure", "Select Device..." menu in MPLAB. For example, to compile for the SBC68EC, select the PIC18F6680 chip in MPLAB.
The following target boards are currently supported:
- SBC65EC, HW V2.01: Use BRD_SBC65EC define, select PIC18F6621 chip in MPLAB
- SBC65EC, HW V2.11 and higher: Use BRD_SBC65EC define, select PIC18F6627 chip in MPLAB
- SBC68EC, HW V2.21 and higher: Use BRD_SBC68EC define, select PIC18F6680 chip in MPLAB
- SBC44EC: Use BRD_SBC44EC define, select PIC18F452 chip in MPLAB
- SBC45EC: Use BRD_SBC45EC define, select PIC18F452 chip in MPLAB
* All SBC65EC boards with HW version higher than HW2.11, use the HW2.11 projects. * All SBC68EC boards with HW version higher than HW2.21, use the HW2.21 projects.
When compiling code for use with a bootloader, the code starts from address 0x800 in stead of at address 0. The bootloader lives in the code space 0x0 to 0x7ff.
To create a new MPLAB project for a target board with a bootloader, do the following:
- Include (uncomment) the "#define HAS_BOOTLOADER" line in "projdefs.h"
- For the HiTech compiler, include the "-A800h" linker command line parameter. When using MPLAB, right click on project and select "Build Options" from the context menu. In the "Build Options" dialog box, select the "PICC-18 Linker" tab. In the "Specify offset for ROM" edit box, enter 800.
- For MPLAB C18 compiler, ensure the "18f6627_v300.lkr" file is included with the MPLAB project. This file is included in the project tree in MPLAB under "Linker Scripts".
When compiling code for use without a bootloader, the code starts from the normal location (address 0) in stead of from address 0x800.
To create a new MPLAB project for a target board without a bootloader, do the following:
- Remove (comment out) the "#define HAS_BOOTLOADER" line in "projdefs.h"
- For the HiTech compiler, ensure the "-A800h" linker command line parameter is NOT present. When using MPLAB, right click on project and select "Build Options" from the context menu. In the "Build Options" dialog box, select the "PICC-18 Linker" tab. In the "Specify offset for ROM" edit box, enter 0.
- For MPLAB C18 compiler, ensure the "18f6627_v300_nobl.lkr" file is included with the MPLAB project. This file is included in the project tree in MPLAB under "Linker Scripts".
Some of the Modtronix Ethernet enabled boards have a Network Bootloader installed on them. The firmware on these boards can be updated without a PIC programmer. For details, click here.
When the project has been compiled for a target board without a bootloader, a PIC programmer has to be used to program the target board. For details, click here.
Some example projects have web pages that have to be put on the target board, and are used for web based control and monitoring of the target board. The source code for these web pages are always located in the "../src/webpages/" folder of the example source code.
Web files can not be uploaded to the Modtronix TCP/IP Stack individually. All files have to be compiled into a File System Image, and then this image is uploaded to the target. The Modtronix Network Bootloader application is used to create and upload this file to the target Ethernet board. The following methods can be used to upload the File System Image to the target board.
The simplest method is to use the built in FTP server of the Modtronix Network Bootloader. Simply click on the "Upload Web Page" button, and the File System Image is uploaded to the board at the given IP address.
A FTP client can be used to connect to the target board and upload the File System Image. The default user name is "admin" and the password is "pw". After connecting to the target board, simply upload the entire File System Image file. After doing this, the target will contain the new Web pages.
Total Commander is a great free application that can be used to do all ftp transfers. It can do much more then just ftp. To upload the File System Image with Total Command, do the following:
- Get a free download from www.ghisler.com
- Select [net][ftp connect] from menu
- Click on "new connection" button
- Enter any name in the "Session" box
- Enter the target IP address in the "Host name" box, the default value is "10.1.0.1"
- Enter your username and password in the "Username" and "Password" boxes. The default values are "admin" and "pw"
- Connect and download the File System Image (default file is default.img) file containing the HTML pages
A Terminal program capable of sending files via the Xmodem protocol can be used to send the File System Image file to the target. For this to work, the target has to be connected to the PC running the Terminal program (HyperTerminal on Windows for example) via its RS232 port. After powering up the target board, enter RS232 configuration mode by following the instructions displayed on the Terminal program. Then select "Download File System Image" from the menu, and send the created "File System Image" file via the Xmodem protocol. In HyperTerminal, this can be done by selecting the "Send File..." menu item in the "Transfer" menu. This will open the "Send File" dialog box. Select Xmodem protocol, and send the "File System Image" file created with the Modtronix Network Bootloader program. After doing this, the target will contain the new Web pages.
Generated on Wed Jul 11 11:34:38 2007 for Example Projects by
1.5.2