资源简介
STM8 SPI从机通讯程序,调试通过,直接可用。
代码片段和文件信息
/**
******************************************************************************
* @file GPIO_IOToggle_PollingMode\main.c
* @brief This file contains the main function for GPIO IOToggle_PollingMode example.
* @author STMicroelectronics - MCD Application Team
* @version V1.1.0
* @date 02/27/2009
******************************************************************************
*
* 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.
*
* © COPYRIGHT 2009 STMicroelectronics
* @image html logo.bmp
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include “stm8s.h“
#include “define.h“
#include “stm8s_gpio.h“
#include “stm8s_tim4.h“
#include “spi_slave.h“
/* Private macro -------------------------------------------------------------*/
//#define countof(a) (sizeof(a) / sizeof(*(a)))
//#define BufferSize (countof(Tx_Buffer))
/**
* @addtogroup IOToggle_PollingMode
* @{
*/
/* Private function prototypes -----------------------------------------------*/
void Delay (u16 nCount);
/* Private functions ---------------------------------------------------------*/
void Delay(u16 nCount)
{
/* Decrement nCount value */
while (nCount != 0)
{
nCount--;
}
}
/* Public functions ----------------------------------------------------------*/
/**
* @brief Example firmware main entry point.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Library functions called:
* - GPIO_Init()
* - GPIO_ReadInputData()
* - GPIO_WriteHigh()
* - GPIO_WriteLow()
*/
u8 spidata;
u8 i;
void main(void)
{
//悬浮输入
GPIO_Init(SPI_CS_PORT SPI_CS GPIO_MODE_IN_FL_NO_IT );
SPI_SLAVE_Init(); /* SPI初始化*/
i=1;
while (1)
{
//spidata=SPI_SLAVE_SendByte(8);/*必须要先发一个随机数目的让SPI能进中断*/
//Delay(100);
spidata=SPI_SLAVE_SendByte(i);/*必须要先发一个随机数目的让SPI能进中断*/
}
}
/**
* @brief Reports the name of the source file and the source line number where
* the assert error has occurred.
* User can add his own implementation to report the file name and line number.
* ex: printf(“Wrong parameters value: file %s on line %d\r\n“ file line)
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
#ifdef FULL_ASSERT
void assert_failed(u8 *file u16 line)
#else
void assert_failed(v
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1954 2015-03-23 13:46 STM_SPI_SLAVE\stm8_interrupt_vector.c
文件 292 2015-03-20 16:03 STM_SPI_SLAVE\checkres.spy
文件 1794 2015-03-27 10:59 STM_SPI_SLAVE\wirestm.dep
文件 13153 2015-03-20 16:03 STM_SPI_SLAVE\wirestm.stp
文件 203 2015-03-27 10:59 STM_SPI_SLAVE\WireSTM.stw
文件 906 2015-03-27 10:30 STM_SPI_SLAVE\wirestm.pdb
文件 96842 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s.h
文件 13654 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_adc1.h
文件 11029 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_adc2.h
文件 4873 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_awu.h
文件 3474 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_beep.h
文件 24992 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_can.h
文件 17672 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_clk.h
文件 4566 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_exti.h
文件 12201 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_flash.h
文件 6289 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_gpio.h
文件 15333 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_i2c.h
文件 5008 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_itc.h
文件 4580 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_iwdg.h
文件 2809 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_rst.h
文件 12769 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_spi.h
文件 24970 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_tim1.h
文件 13568 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_tim2.h
文件 12475 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_tim3.h
文件 5133 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_tim4.h
文件 18985 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_tim5.h
文件 9165 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_tim6.h
文件 3453 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_type.h
文件 15112 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_uart1.h
文件 17364 2009-03-02 10:00 STM_SPI_SLAVE\library\inc\stm8s_uart2.h
............此处省略68个文件信息
相关资源
- AVR-ATmega16双机通信双向,并带反馈I
- sony IMX290 driver (SPI)
- Automotive SPICE PRM v4.5中文
- STVD代码量插件
- 乐鑫esp8266 NONOS SDK 3.0编程使用 SPI 驱动
- ADXL345加速度传感器SPI通信程序
- VHDL控制进行SPI读写
- SPI FLASH 仿真模型
- SPI按键显示接口设计
- IAR for STM8注册机
- dspic33的PWM调试程序
- dspic33f的AD采样程序
- ZigBee 协议在Linux上的实现
- PCAP01_SPI_main编程代码.zip
- 50nm工艺 CMOS bsim4模型
- tdc GPX2芯片配置程序
- IAR for STM8 3.10.4汉化补丁
- SPI协议Verilog实现
- STM8和STM32F103原理图库AD
- IAR for STM8 3.10.4汉化
- STM32F103X SPI2 DMA 驱动LCD.zip
- STM8定时器2输入捕获功能寄存器版
- STM8S单片机输出互补PWM可通过刹车输入
- RC带通滤波器pspice仿真电路
- SSP作SPI从机实验.rar
- 基于粒子群算法优化Spiking神经网络
- 使用 STM8S103F3 设计的数字电压表头
- 基于STM32F4xx,MS5611气压传感器使用S
- STCMCU-SPI演程
- ISD1700SPI通讯总结
评论
共有 条评论