/**
@page I2C_DataExchange I2C Communication Boards Data Exchange example
@verbatim
******************** (C) COPYRIGHT 2011 STMicroelectronics *******************
* @file I2C/I2C_TwoBoards/I2C_DataExchange/readme.txt
* @author MCD Application Team
* @version V2.1.0
* @date 18-November-2011
* @brief Description of the I2C Communication Boards Data Exchange example.
******************************************************************************
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
******************************************************************************
@endverbatim
@par Example Description
This is a typical example of how to use the I2C software library to ensure the
steps of an I2C communication between slave Receiver/transmitter and master
transmitter/receiver using interrupts.
- Hardware Description
To use this example, you need to load it on two STM8 boards (let's call them
Board A and Board B) then connect these two boards through I2C lines and GND.
@verbatim
*------------------------------------------------------------------------------*
| BOARD A BOARD B |
| ____________________ ____________________ |
| | | | | |
| | | | | |
| | __________ | | __________ | |
| | |I2C Master|____|_______SDA_______|____|I2C Slave | | |
| | | Device |____|_______SCL_______|____| Device | | |
| | |__________| | | |__________| | |
| | O LD1 | | O LD1 | |
| | O LD2 RESET | | O LD2 RESET | |
| | _ | | _ | |
| | O LD4 |_| | | O LD4 |_| | |
| | | | | |
| | GND O--|-----------------|--O GND | |
| |____________________| |____________________| |
| |
| |
*------------------------------------------------------------------------------*
@endverbatim
- Software Description
This example requires two boards(Master and Slave)
- Phase 1:
In master board I2C peripheral is configured in Master Transmitter with Interrupt,
where in Slave board I2C peripheral is configured in Slave Receiver with Interrupt.
The master will send Data to Slave according to the defined buffer size.
- Phase 2:
In master board I2C peripheral is configured in Master Receiver in polling mode,
where in Slave board I2C peripheral is configured in Slave Transmitter with
Interrupt.
Once the master has initiated the communication (Start condition), the slave
will send back the data to the master according to the defined buffer size.
At the end of the data transfer, a data consistency check will be performed
in master sides. In case of mismatch between sent and received data, LED4 will toggle.
Otherwise LED1 will toggle.
Communication error are handled in slave sides, their occurrence is signaled by
puting LED2 On.
The File "main.h" allows different possibilities of configuration of this example:
- Addressing mode : 7-bit or 10-bit
- I2C speed: Fast mode or Standard mode
@par Directory contents
- I2C/I2C_TwoBoards/I2C_DataExchange/X/stm8s_conf.h Library Configuration file
- I2C/I2C_TwoBoards/I2C_DataExchange/X/stm8s_it.c Interrupt handlers
- I2C/I2C_TwoBoards/I2C_DataExchange/X/stm8s_it.h Interrupt handlers header file
- I2C/I2C_TwoBoards/I2C_DataExchange/X/main.c Main program
- I2C/I2C_TwoBoards/I2C_DataExchange/X/main.h Main Header file
- X stands for Master or Slave
@par Hardware and Software environment
- This example runs on STM8S and STM8A High density, Medium density and Low
density devices.
- This example has been tested with STMicroelectronics STM8/128-EVAL evaluation
board and can be easily tailored to any other development board.
- STM8/128-EVAL Set-up
- LED1, LED2 and LED4
- Connect I2C Master SCL pin (PE.01) to I2C Slave SCL (PE.01)
- Connect I2C Master SDA pin (PE.02) to I2C Slave SDA (PE.02)
@note
- Pull-up resistors should be connected to I2C SCL and SDA Pins in case of
other boards use.
Pull-up resistors are already implemented on the STM8/128-EVAL evaluation
boards.
@par How to use it ?
In order to make the program work, you must do the following :
- Copy all source files from this example folder to the template folder under
Project\Template
- Open your preferred toolchain
- Rebuild all files and load your image into target memory
- Run the example
@note
- High-Density STM8A devices are the STM8AF52xx STM8AF6269/8x/Ax,
STM8AF51xx, and STM8AF6169/7x/8x/9x/Ax microcontrollers where the Flash memory
density ranges between 32 to 128 Kbytes
- Medium-Density STM8A devices are the STM8AF622x/4x, STM8AF6266/68,
STM8AF612x/4x, and STM8AF6166/68 microcontrollers where the Flash memory
density ranges between 8 to 32 Kbytes
- High-Density STM8S devices are the STM8S207xx, STM8S007 and STM8S208xx microcontrollers
where the Flash memory density ranges between 32 to 128 Kbytes.
- Medium-Density STM8S devices are the STM8S105x and STM8S005 microcontrollers
where the Flash memory density ranges between 16 to 32-Kbytes.
- Low-Density STM8S devices are the STM8S103xx, STM8S003 and STM8S903xx microcontrollers
where the Flash density is 8 Kbytes.
* <h3><center>© COPYRIGHT 2011 STMicroelectronics</center></h3>
*/
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
STM8S标准例程 (324个子文件)
STM8_OB.asm 595B
logo.bmp 7KB
stm8s_tim1.c 84KB
stm8s_tim5.c 50KB
stm8s_can.c 48KB
stm8s_tim2.c 46KB
stm8s_tim3.c 37KB
stm8s_i2c.c 32KB
stm8s_eval_i2c_ee.c 29KB
stm8s_uart2.c 29KB
stm8s_uart1.c 26KB
stm8s_flash.c 25KB
stm8s_eval_spi_sd.c 25KB
stm8s_uart3.c 24KB
stm8s_adc1.c 23KB
stm8s_clk.c 22KB
stm8s_it.c 17KB
stm8s_it.c 15KB
stm8s_tim6.c 15KB
stm8s_it.c 14KB
stm8s_it.c 14KB
stm8s_it.c 14KB
stm8s_it.c 14KB
stm8s_spi.c 14KB
stm8s_it.c 14KB
stm8s_it.c 13KB
stm8s_adc2.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_it.c 13KB
stm8s_tim4.c 12KB
main.c 11KB
stm8s_eval_lcd.c 11KB
stm8s_itc.c 10KB
main.c 9KB
main.c 9KB
main.c 9KB
stm8_128_eval.c 9KB
main.c 9KB
main.c 9KB
main.c 9KB
stm8s_gpio.c 8KB
main.c 8KB
main.c 8KB
main.c 7KB
main.c 7KB
main.c 7KB
stm8s_awu.c 6KB
main.c 6KB
main.c 6KB
main.c 6KB
stm8_interrupt_vector.c 6KB
stm8s_exti.c 6KB
main.c 6KB
main.c 6KB
main.c 5KB
main.c 5KB
main.c 5KB
main.c 5KB
main.c 5KB
stm8s_beep.c 5KB
main.c 5KB
main.c 5KB
main.c 5KB
main.c 5KB
main.c 5KB
main.c 4KB
main.c 4KB
main.c 4KB
共 324 条
- 1
- 2
- 3
- 4
thankyou0
- 粉丝: 1
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Python的图像阴影检测与去除源码(高分期末大作业项目).zip
- 基于C++/Qt实现的井字棋游戏
- 基于 Python 编程语言的 Web 框架Django
- Python和Flask实现的基于体检数据的城市公共健康可视分析系统源码+使用说明.zip
- 基于python实现的华为智慧工地-安全帽检测
- buck-boost_2023-12-16_12-12-13.eprj
- 后端开发关于数据库和API开发的介绍
- 机器学习和数据挖掘课程设计-米其林餐厅数据挖掘管理系统源码+使用文档说明.zip
- html html html展示我与ai的对化
- 数据结构课程设计-全国交通出行咨询模拟系统C语言实现源码.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页