PicBasic project to demonstrate Control Area Network (CAN).

The following are basic language program files for use with the Diversified Engineering Can Net project boards.  The master program, DeMasterTyping.pbp, receives a character from the PC and sends it to one of three nodes via the CAN network.  The node then echoes the character back to the master node which sends the character back to the PC.  The PC runs a terminal emulator such as Hyper Terminal.  The programs don't really do anything useful except demonstrate the Microchip MCP2510 CAN control network.  Firmware source code may be download individually, or all of it may be downloaded by clicking the zip file, DETyping.zip.  All firmware is coded for the Micro Engineering Labs PicBasic Pro Compiler.  It is assumed that you are familiar with these products.  I use the MicroCode studio development environment (Mecanique or Reynolds Electronics) with the Warp 13a (Newfound Electronics) programmer and MELABS EPIC programmer.  The DE boards utilize the PIC 16F87x family of micro controllers.

replica watches uk 41 mm stainless steel case, triangle pit replica watches bezel 18ct white gold material. Polished and uk replica watches polished, the beauty of the two materials combined into one, classic and full of rolex replica ornamental.

Code has not been optimized for speed.  Several hardware features of the DE boards, such as the LCD, keypad, A/D converters, etc., are not implemented in these examples.  Source code has not been "cleaned up" concerning comments, etc., but it does work as is.  CAN node addresses are hard coded in the master program and in each node (see listings.)  The NodeID variable in the DeNodeTyping.pbp source code must be located and changed for compilation for each individual node.  A question mark character sent from the PC toggles node identification echo on and off, so you can prove that the program is, indeed, working.  Each SPI transaction with the CAN chip includes all the overhead for setting required registers.  This may be modified, but do so with care, as the CAN protocol is tricky.  Diversified Engineering includes assembler source code with their products.  Software and schematics may be downloaded from their web site.  MicroChip has an application note (AN212) concerning Diversified Engineering's CAN educational kit as well as other useful information.  You may down load a useful program for calculation of bit timings at Intrepid Control Systems, Inc: www.intrepidcs.com/mcp2510/   CAN is a product developed by Robert Bosch GmbH

The master program may have to be modified to reflect the serial communication baud rate of the host PC's terminal emulation software.  Files with the .bas extension are include files as documented in the program listings.  The above description is not intended to be an exhaustive treatment of the software, project, micro controller applications, or programming in general.

Since the completion of this project, I have also developed code for the PIC18C858.  You may contact the author for further details.  This was in conjunction with a consulting project of a proprietary nature.  Releases may apply.

All source code Copyright 2002, James S. McLaughlin.  You may use this software for any non-commercial purpose.  If you require licensing, please contact the author.

PIC and PICmicro are registered trademarks of Microchip Technology Inc.

Files for programming the Diversified Engineering boards:

Master and Node software listings:

DeNodeTyping.pbp - programs the project nodes and the IO nodes.

DeMasterTyping.pbp - programs the master board.

Include files for the above:

CanCfg.bas - Configure the MCP2510 can controller chip.

CanError.bas - Detect and correct error conditions on the can network.

CanRxDeclare.bas - Declarations for receive buffers, etc.

CanTxDeclare.bas - Declarations for transmit buffers, etc.

MCP2510.bas - Declarations for the can controller, adapted from Microchip.  Excludes bit definations.

ReceiveCan.bas - Receive structure for can control chip, SPI interface.

TransCan.bas - Transmit structure for the can control chip, SPI interface.

DETyping.zip - All the above files in a zip.

 

Other information.

Zip file containing some example source code for the 18Pic family of processors (not working code.)

CAN-18Pic.zip

Questions or comments may be directed to Steve McLaughlin.