can protocol implementation for datacommunication1
TRANSCRIPT
CAN PROTOCOL IMPLEMENTATION FOR DATACOMMUNICATION
A Mini project report submitted in partial fulfillment of the requirements of the award of the degree of
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
Submitted by
B.Kishore Kumar (07N71A0428)
UNDER THE ESTEEMED GUIDANCE OF
MR.B.L.REDDY(ASST PROFESSOR)
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
DRK INSTITUTE OF SCIENCE AND TECHNOLOGY(Affiliated to Jawaharlal Nehru Technological University, Hyderabad)
BOWRAMPET (V), Via. AIRFORCE ACADEMY, HYDERABAD-500043(2007-2011)
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
DRK INSTITUTE OF SCIENCE AND TECHNOLOGY(Affiliated to Jawaharlal Nehru Technological University, Hyderabad)
BOWRAMPET (V), Via. AIRFORCE ACADEMY, HYDERABAD-500043(2007-2011)
CERTIFICATE
This is to certify that the project work entitled “CAN PROTOCOL IMPLEMENTATION FOR DATACOMMUNICATION” is a bonafide work in partial fulfillment of the
requirements for the degree of bachelor of technology in Electronics and Communication Engineering for the academic year 2010-2011.
B.Kishore Kumar 07N71A0428
Internal guide Head of the DepartmentMr.B.L.Reddy Prof.K.Subba rao(Asst. professor) (Dept of ECE)
ACKNOWLEDGEMENT
There are many people who have helped us directly and indirectly to complete our
project successfully. I would like to take this opportunity to thank one and all.
First of all I would like to express my deep gratitude towards my external guide Mr.G.Balwanth
reddy garu for helping me with each and every aspect of my project work which and helped me to get
through successfully. I am also very thankful to my internal guide Mr.B.L.Reddy garu for helping me in
clearing all my doubts during the project duration. I am also grateful to our HOD Prof.K.Subba Rao garu
for allowing me to do the project, and for his valuable suggestions during my project and all the
faculty of ECE Department of DRK Institute of Science and Technology, for their valuable suggestions,
which helped me in the successful completion of our project.
I owe my gratitude to my principal Prof.Sharif, for his kind attention and valuable
guidance to us throughout the course.
I would like to thank all my friends for their help and constructive criticism during my
project period. Finally, I am very much indebted to my parents for their moral support and
encouragement to achieve goals. I have no words to express my gratitude and still I am thankful to my
parents who have shown me this world and for every support they gave me.
B.Kishore Kumar
ABSTRACT
AIM:
The main aim of this project is to implementation for data communication based on CAN
protocol by using AT89S52 programmable microcontroller. Here we have connected
DESCRIPTION:
CAN is a multi-master broadcast serial bus standard for connecting electronic control units
(ECUs).Each node is able to send and receive messages, but not simultaneously: a message (consisting
primarily of an ID usually chosen to identify the message-type/sender and up to eight message bytes) is
transmitted serially onto the bus, one bit after another this signal pattern codes the message (in NRZ) and
is sensed by all nodes.
The devices that are connected by a CAN network are typically sensors, actuators and control devices. A
CAN message never reaches these devices directly, but instead a host processor and a CAN controller
are needed between these devices and the bus.
If the bus is free, any node may begin to transmit. If two or more nodes begin sending messages at the
same time, the message with the more dominant ID (which has more dominant bits, i.e., bit 0) will
overwrite other nodes' less dominant IDs, so that eventually (after this arbitration on the ID) only the
dominant message remains and is received by all nodes.
Bit rates up to 1 Mbit/s are possible at network lengths below 40 m. Decreasing the bit rate allows longer
network distances (e.g. 125 kbit/s at 500 m).
The CAN data link layer protocol is standardized in ISO 11898-1 (2003). This standard describes mainly
the data link layer — composed of the logical link control (LLC) sublayer and the media access control
(MAC) sublayer — and some aspects of the physical layer of the OSI reference model. All the other
protocol layers are the network designer's choice. The vehicle driver selection is done by using switches
which are placed after the micro controller unit.
The programming language used for developing the software to the microcontroller is
Embedded/Assembly. The KEIL cross compiler is used to edit, compile and debug this
program. Micro Flash programmer is used for burning the developed code on Keil in to the
microcontroller Chip. Here in our application we are using AT89C51 microcontroller which is
Flash Programmable IC.AT represents the Atmel Corporation represents CMOS technology is
used for designing the IC. This IC is one of the versions of 8051.
BLOCK DIAGRAM OF THE PROJECT
CANH CANL
SOFTWARE:
1. Embedded C
2. Keil IDE
3. Uc-Flash
HARDWARE:
1. Micro Controller
2. MCP 2515 CAN controller
3. Power supply
4. MAX232
5. MCP 2551 CAN DRIVER
6. LCD
CAN Transceiver
Display
Unit
Micro
Controller
CAN Controller
COMPUTERCAN Controller
Micro
Controller
CAN Transceiver
INDEX
TOPIC PAGE NO
CHAPTER1. INTRODUCTION
1.1 Introduction 2
1.2 Block Diagram 4
1.3 Flow Chart 5
CHAPTER2. DESCRIPTION OF HARDWARE COMPONENTS
2.1 AT89S52
2.1.1 A Brief History of 8051 7
2.1.2 Introduction to AT89S52 9
2.1.3 Features 10
2.1.4 Pin Description 11
2.2 POWER SUPPLY
2.2.1 Introduction 24
2.2.2 Transformer 24
2.2.3 Rectifier 25
2.2.4 Regulator 27
2.3 MAX232
2.3.1 RS-232 waveform 29
2.3.2 RS-232 Level converter 30
2.3.3 Microcontroller Interfacing with RS-232 Standard devices 31
2.4 MCP2515
2.4.1 Features 36
2.4.2 Pin Diagram 37
2.4.3 Descriptions 37
2.4.4 Overview 38
2.5 MCP2551
2.5.1 Features 52
2.5.2 Pin Diagram 53
2.5.3 Overview 54
2.6 LCD 59
CHAPTER3. CIRCUIT DIAGRAM 69
CHAPTER 4. SAMPLE PROGRAMS IN LAB
4.1.1 Example 1 71
4.1.2 Example 2 71
4.1.3 Example 3 72
4.1.4 Example 4 73
CHAPTER 5. SOFTWARE DEVELOPMENT
5.1 Introduction 75
5.2 Tools used 75
5.3 C51 Compiler & A51 macro assembler 76
5.4 Start µ vision 76
5.5 Flash magic 88
APPLICATIONS 92
FUTURE SCOPE 93
CONCLUSION 93
BIBILOGRAPHY 94
INDEX OF FIGURES
Title Page no.
Block diagram of the project 4
Flow chart 5
Pin diagram 89S52 IC 11
Functional block diagram of microcontroller 14
Oscillator and timing circuit 15
Interrupt sources 23
Block diagram of a regulated power supply system 24
Output waveform of a transformer 25
Rectifier and output of rectifier 26
Waveform of the rectified output smoothing 27
Regulator 29
RS-232 Level controller 30
Microcontroller interfacing with RS-232 31
RS-232 cables diagram 33
20-Lead TSSOP 37
SPI Block diagram 39
Example system implementation 40
CAN Buffers and protocol engine block diagram 42
CAN protocol engine block diagram 44
MCP2551 pin diagram and block diagram 53
8-bit LCD Interface 59
Main circuit diagram 69
KEIL software-internal stages 75
Project figures 81-89
INDEX OF TABLES
Title Page no.
Controls of Port 3 13
Alternate use of Port 3 21
Interrupt Enable Register 23,34
Pinout description 41
MCP2551 pinout 57
Pin assignment for <=80 characters display 60
Pin assignment for >80 characters display 61
HD44780 instruction set 62
Bit names 66