/**
@page I2C_DataExchange I2C Communication Boards Data Exchange example
@verbatim
******************** (C) COPYRIGHT 2014 STMicroelectronics *******************
* @file I2C/I2C_TwoBoards/I2C_DataExchange/readme.txt
* @author MCD Application Team
* @version V2.2.0
* @date 30-September-2014
* @brief Description of the I2C Communication Boards Data Exchange example.
******************************************************************************
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
@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 STMicroelectronics</center></h3>
*/
没有合适的资源?快使用搜索试试~ 我知道了~
STM8S函数库,外设库最新
共330个文件
h:121个
c:115个
txt:44个
需积分: 46 48 下载量 22 浏览量
2018-09-28
21:36:06
上传
评论 1
收藏 10.65MB RAR 举报
温馨提示
STM8S函数库,外设库最新STM8S函数库,
资源推荐
资源详情
资源评论
收起资源包目录
STM8S函数库,外设库最新 (330个子文件)
STM8_OB.asm 595B
logo.bmp 7KB
stm8s_tim1.c 82KB
stm8s_tim5.c 48KB
stm8s_can.c 45KB
stm8s_tim2.c 45KB
stm8s_tim3.c 36KB
stm8s_i2c.c 32KB
stm8s_eval_i2c_ee.c 29KB
stm8s_uart4.c 28KB
stm8s_uart2.c 27KB
stm8s_flash.c 25KB
stm8s_uart1.c 25KB
stm8s_eval_spi_sd.c 25KB
stm8s_uart3.c 23KB
stm8s_adc1.c 22KB
stm8s_clk.c 21KB
stm8s_it.c 17KB
stm8s_it.c 15KB
stm8s_tim6.c 15KB
stm8s_it.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_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_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_tim4.c 12KB
main.c 11KB
stm8s_eval_lcd.c 11KB
stm8s_itc.c 11KB
main.c 10KB
main.c 9KB
main.c 9KB
main.c 9KB
stm8_128_eval.c 9KB
main.c 9KB
main.c 9KB
stm8s_gpio.c 8KB
main.c 8KB
main.c 8KB
main.c 8KB
main.c 7KB
main.c 7KB
stm8s_awu.c 6KB
main.c 6KB
main.c 6KB
stm8_interrupt_vector.c 6KB
main.c 6KB
main.c 6KB
main.c 6KB
stm8s_exti.c 6KB
main.c 6KB
main.c 5KB
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
共 330 条
- 1
- 2
- 3
- 4
资源评论
qq_39711418
- 粉丝: 6
- 资源: 35
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功