资源简介
最简单清晰的例子,主架构如下:
int main(void)
{
/*
ST固件库中的启动文件已经执行了 SystemInit() 函数,该函数在 system_stm32f4xx.c 文件,主要功能是
配置CPU系统的时钟,内部Flash访问时序,配置FSMC用于外部SRAM等。
*/
NVIC_Configuration();
CAN1_Configuration();
CAN2_Configuration();
while(1)
{
if(can1_rec_flag == 1) //如果CAN1接收到了一帧数据
{
can1_rec_flag = 0;
CAN1_WriteData(0x18412345); //以ID为 0x18412345向CAN上发送数据
}
if(can2_rec_flag == 1) //如果CAN1接收到了一帧数据
{
can2_rec_flag = 0;
CAN2_WriteData(0x18412345); //以ID为 0x18412345向CAN上发送数据
}
}
}
代码片段和文件信息
/**
******************************************************************************
* @file system_stm32f0xx.c
* @author MCD Application Team
* @version V1.2.0
* @date 01-August-2013
* @brief CMSIS Cortex-M0 Device Peripheral Access layer System Source File.
* This file contains the system clock configuration for STM32F0xx devices
* and is generated by the clock configuration tool
* STM32F0xx_Clock_Configuration_V1.0.0.xls
*
* 1. This file provides two functions and one global variable to be called from
* user application:
* - SystemInit(): Setups the system clock (System clock source PLL Multiplier
* and Divider factors AHB/APBx prescalers and Flash settings)
* depending on the configuration made in the clock xls tool.
* This function is called at startup just after reset and
* before branch to main program. This call is made inside
* the “startup_stm32f0xx.s“ file.
*
* - SystemCoreClock variable: Contains the core clock (HCLK) it can be used
* by the user application to setup the SysTick
* timer or configure other parameters.
*
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
* be called whenever the core clock is changed
* during program execution.
*
* 2. After each device reset the HSI (8 MHz Range) is used as system clock source.
* Then SystemInit() function is called in “startup_stm32f0xx.s“ file to
* configure the system clock before to branch to main program.
*
* 3. If the system clock source selected by user fails to startup the SystemInit()
* function will do nothing and HSI still used as system clock source. User can
* add some code to deal with this issue inside the SetSysClock() function.
*
* 4. The default value of HSE crystal is set to 8MHz refer to “HSE_VALUE“ define
* in “stm32f0xx.h“ file. When HSE is used as system clock source directly or
* through PLL and you are using different crystal you have to adapt the HSE
* value to your own configuration.
*
* 5. This file configures the system clock as follows:
*=============================================================================
* System Clock Configuration
*=============================================================================
* System Clock source | PLL(HSE)
*-----------------------------------------------------------------------------
* SYSCLK | 48000000 Hz
*-----------------------------------------------------------------------------
* HCLK | 48000000 Hz
*----------------
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 24914 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\CMSIS END USER LICENCE AGREEMENT.pdf
文件 243068 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Include\stm32f0xx.h
文件 2221 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Include\system_stm32f0xx.h
文件 26975 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Release_Notes.html
文件 9869 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\arm\startup_stm32f030x6.s
文件 10705 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\arm\startup_stm32f030x8.s
文件 10714 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\arm\startup_stm32f0xx.s
文件 9878 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\arm\startup_stm32f0xx_ld.s
文件 8682 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\gcc_ride7\startup_stm32f0xx.s
文件 8037 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\gcc_ride7\startup_stm32f0xx_ld.s
文件 64 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\gcc_ride7\vssver.scc
文件 10074 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\iar\startup_stm32f030x6.s
文件 11342 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\iar\startup_stm32f030x8.s
文件 11351 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\iar\startup_stm32f0xx.s
文件 10083 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\iar\startup_stm32f0xx_ld.s
文件 12650 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\system_stm32f0xx.c
文件 8078 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\TrueSTUDIO\startup_stm32f030x6.s
文件 8726 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\TrueSTUDIO\startup_stm32f030x8.s
文件 8735 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\TrueSTUDIO\startup_stm32f0xx.s
文件 8087 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F0xx\Source\Templates\TrueSTUDIO\startup_stm32f0xx_ld.s
文件 637831 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F10x\Include\stm32f10x.h
文件 2223 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F10x\Include\system_stm32f10x.h
文件 36386 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F10x\Release_Notes.html
文件 15899 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F10x\Source\Templates\arm\startup_stm32f10x_cl.s
文件 15636 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F10x\Source\Templates\arm\startup_stm32f10x_hd.s
文件 15825 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F10x\Source\Templates\arm\startup_stm32f10x_hd_vl.s
文件 12509 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F10x\Source\Templates\arm\startup_stm32f10x_ld.s
文件 13789 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F10x\Source\Templates\arm\startup_stm32f10x_ld_vl.s
文件 12898 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F10x\Source\Templates\arm\startup_stm32f10x_md.s
文件 14206 2013-10-12 04:36 CAN1与CAN2通讯例程(裸机版)\Libraries\CMSIS\Device\ST\STM32F10x\Source\Templates\arm\startup_stm32f10x_md_vl.s
............此处省略1118个文件信息
- 上一篇:comsol螺旋线圈建模
- 下一篇:STM32源程序大全
相关资源
- 基于STM32F4x9的LCD显示
- 2.4 GHz无线收发芯片A7105及其应用
- 周立功PCI CAN卡LINUX驱动ubuntu16.04内核
- 基于S32K144的CANbootloader
- SCI串口中断接收发送例程
- STM32F103 USART+DMA
- stm32f105-usart-DMA收发demo
- 基于ARM7处理器的CAN总线网络设计
- IEEE 802.15.4的CC2530无线数据收发设计
- IEEE 802.15.4的CC2530无线数据收发设计
- SFP光模块收发模块标准英文版.pdf
- Can EC-MPS reduce gastrointestinal side effect
- stm32F4+w5300
- 佳能时尚扫描仪CanoScan LiDE 500F
- CanoScan佳能4200f扫描仪驱动 v8.6.1.1a 官
- 佳能CanoScan 9000F扫描仪驱动 官方版
- 佳能canon lbp3000激光打印机驱动 for w
- STM32F103VCT6TR - High-density performance lin
- 基于MC68HC908GZ32的CAN-LIN网关设计
- FreeModbus_Slave+STM32F407+USART2代码亲测可
- 如何在CANVAS中使用D3.JS
- 基于CAN总线与ZigBee的瓦斯实时监测及
- STM32F407 串口配置 串口1~6 六串口同时
- STM32F407_6个串口同时使用的代码
- Delphi XE10 Seattle移动开发指南完整版
- CiA-402-2-version-3.0.0
- STM32F407实时时钟_DS1302实时时钟模块和
- 串口数据收发器
- ISO14229协议
- CAN和1939全套资料
评论
共有 条评论