没有合适的资源?快使用搜索试试~ 我知道了~
首页瑞萨CAN通信例程--基于M16C29
瑞萨CAN通信例程--基于M16C29
5星 · 超过95%的资源 需积分: 48 59 下载量 176 浏览量
更新于2023-03-16
评论
收藏 564KB PDF 举报
瑞萨CAN通信例程--基于M16C29瑞萨CAN通信例程--基于M16C29
资源详情
资源评论
资源推荐
/Rev.1.00 October 2005 Page 1 of 94
APPLICATION NOTE
M16C/29 Group
CAN Demo Set Program
1. Summary
This document describes the program for the CAN demonstration set for the M16C/29 group of Renesas
microcomputers.
For CAN protocol, please refer to the CAN specification (Robert Bosch GmbH) and ISO11898.
2. Introduction
The application examples explained here apply for the use of the following microcomputer under the
conditions described below.
• Microcomputer: M16C/29 group
Other M16C family microcomputers that contain the SFR (peripheral function control registers) similar to
those of the M16C/29 group can use the program described here. However, since some functions may have
been changed in functional additions, etc., be sure to consult the user’s manual of your microcomputer for
confirmation. Please carefully evaluate the suitability of your microcomputer before using this application
note.
The sample program presented here operates under the conditions described below.
• Power supply voltage: 5 V
• Main clock input oscillation frequency: 20 MHz
• M16C/29 starter kit (M3A-0284) (However, the additional devices listed below are required.)
Additional devices: CAN transceiver (HA13721)
Capacitors (C12, C13, and C14 in the starter kit circuit diagram)
Resistor (R8 or termination resistor in the starter kit circuit diagram)
3. Outline Specifications of the Sample Program
The sample program presented here is an example program for performing CAN communication.
It uses two M16C/29 starter kits (boards (1) and (2)) to perform CAN transmission/reception.
Board (1):
SW3 and SW4 may be used to change the transmit or receive IDs.
The variable resistor (VR) and SW2 are used to perform CAN transmission.
The LED display pattern is changed by the received data.
Board (2):
CAN transmission is performed by pressing SW2–4.
The first byte of received data is displayed on LEDs.
REJ05B0776-0100
REJ05B0776-0100/Rev.1.00 October 2005 Page 2 of 94
M16C/29 Group
CAN Demo Set Program
Figure 1 shows how the boards (1) and (2) should be connected when this program is used. Figure 2 shows a
block diagram of the M16C/29.
Board (1)
Board (2)
CANH
CANL
CANH CANL
SW2-4
M16C/29 starter kit
M16C/29 starter kit
SW2-4
CANH CANL
VR
Figure 1. Connection diagram
M16C/29
P01
P00
P2
8
CRX
CTX
CAN
transceiver
HA13721FP
CANH
CANL
P82
P83
P97
SW2
SW4
SW3
SW1
RESET
AN0
LED1 LED2
5 V
20 MHz
VR
Figure 2. Block diagram
REJ05B0776-0100/Rev.1.00 October 2005 Page 3 of 94
M16C/29 Group
CAN Demo Set Program
Table 1 lists the microcomputer pins used. Table 2 lists the function of each switch (SW).
Table 1. Microcomputer Pins Used
Pin name Input/output Function
P00, P01 Output LED output
P20 - P27 Output LED output
P92 (CRx) Input CANout
P93 (CTx) Output CANin
P82 Input Switch 2 input
P83 Input Switch 3 input
P84 Input Switch 4 input
P100 Input Variable resistor
* Used on only board (1)
Table 2. Switch Functions
Switch
name
SW1 SW2 SW3 SW4
Board (1)
Hardware
reset
CAN transmit Shows receive ID
(Transmit ID + 1 while
SW4 is held down)
Shows transmit ID
(Receive ID + 1 while
SW3 is held down)
Board (2)
Hardware
reset
CAN transmit
(DATA1)
CAN transmit
(DATA2)
CAN transmit
(DATA3)
REJ05B0776-0100/Rev.1.00 October 2005 Page 4 of 94
M16C/29 Group
CAN Demo Set Program
4. Detailed Specifications of the Sample Program
This sample program permits you to perform CAN transmission by operating the switches or variable
resistor on each board. Although CAN communication allows 0 to 8 bytes of data to be transmitted at a time,
this program always transmits 1 byte of data. When either board receives data, it changes a 7-segment LED
turn-on pattern according to the received data.
4.1 Switch Functions
4.1.1 Board (1)
SW1: Resets the board.
SW2: Performs CAN transmission.
Three types of data “01
16
,” “02
16
,” and “03
16
” are used, which are transmitted sequentially each
time you press SW2.
SW3: Shows the receive ID.
This switch shows the receive ID while you hold it down.
The receive ID is incremented by 1 when you press SW4 while it is displayed. Any receive ID in
the range 00
16
to FF
16
can be set.
SW4: Shows the transmit ID.
This switch shows the transmit ID while you hold it down.
The transmit ID is incremented by 1 when you press SW3 while it is displayed. Any transmit
ID in the range 00
16
to FF
16
can be set.
4.1.2 Board (2)
SW1: Resets the board.
SW2: Performs CAN transmission.
Data “01
16
” is transmitted.
SW3: Performs CAN transmission.
Data “02
16
” is transmitted.
SW4: Performs CAN transmission.
Data “03
16
” is transmitted.
REJ05B0776-0100/Rev.1.00 October 2005 Page 5 of 94
M16C/29 Group
CAN Demo Set Program
4.2 LED Display
4.2.1 Board (1)
The LED display pattern is changed by the first byte of received data. Furthermore, pressing SW3 on this
board shows the received ID, and pressing SW4 on this board shows the transmit ID, both in hexadecimal.
There are three LED display patterns that are changed by received data. These LED display patterns are
shown in Table 3 and Figure 3.
Table 3. LED Display Patterns
Received data LED1 LED2
Display pattern 1 01 Counterclockwise Clockwise
Display pattern 2 02 Clockwise Counterclockwise
Display pattern 3 03 Clockwise using both LEDs
LED1 LED2
LED1 LED2
LED1 LED2
Display pattern 2
Display pattern 1
Display pattern 3
Figure 3. Display pattern
4.2.2 Board (2)
Shows the received data on LEDs (in hexadecimal).
剩余93页未读,继续阅读
baorubin123
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 27页智慧街道信息化建设综合解决方案.pptx
- 计算机二级Ms-Office选择题汇总.doc
- 单链表的插入和删除实验报告 (2).docx
- 单链表的插入和删除实验报告.pdf
- 物联网智能终端项目设备管理方案.pdf
- 如何打造品牌的模式.doc
- 样式控制与页面布局.pdf
- 武汉理工Java实验报告(二).docx
- 2021线上新品消费趋势报告.pdf
- 第3章 Matlab中的矩阵及其运算.docx
- 基于Web的人力资源管理系统的必要性和可行性.doc
- 基于一阶倒立摆的matlab仿真实验.doc
- 速运公司物流管理模式研究教材
- 大数据与管理.pptx
- 单片机课程设计之步进电机.doc
- 大数据与数据挖掘.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1