资源简介
stm32在ubuntu linux下开发测试源文件
详见博客:
http://blog.csdn.net/embbnux/

代码片段和文件信息
/*************************************************************************************
* Test-program for Olimex “STM32-H103” header board for “STM32F103RBT6”.
* After program start green LED (LED_E) will blink.
*
* Program has to be compiled with optimizer setting “-O0“.
* Otherwise delay via while-loop will not work correctly.
*************************************************************************************/
#include “stm32f10x.h“
#include “stm32f10x_rcc.h“
#include “stm32f10x_gpio.h“
int main(int argc char *argv[])
{
GPIO_InitTypeDef GPIO_InitStructure;
u32 delay;
/* GPIOC Periph clock enable */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOF ENABLE);
/* Configure PC12 to mode: slow rise-time pushpull output */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; // GPIO No. 12
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; // slow rise time
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; // push-pull output
GPIO_Init(GPIOF &GPIO_InitStructure); // GPIOC init
while(1)
{
/* make some float calculations */
float x = 42 y = 23 z = 7;
int i = 0;
for ( i = 0; i < 6; i++ )
{
z = (x*y)/z;
};
/* GPIO PC12 set pin=high LED_E off */
GPIOF->BSRR = GPIO_BSRR_BS6;
/*GPIO_WriteBit(GPIOCGPIO_Pin_12Bit_SET);*/
/* delay --> compiler optimizer settings must be “-O0“ */
delay=5000000;
while(delay)
delay--;
/* GPIO PC12 reset pin=low LED_E on */
GPIOF->BSRR = GPIO_BSRR_BR6;
/*GPIO_WriteBit(GPIOCGPIO_Pin_12Bit_RESET);*/
/* delay --> compiler optimizer settings must be “-O0“ */
delay=5000000;
while(delay)
delay--;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1597 2013-12-27 18:30 main.c
文件 10464 2013-12-26 19:21 startup.c
- 上一篇:Hadoop的WordCount代码
- 下一篇:电子日历课程设计 数电设计
相关资源
- STM32F103RC+ADC+DMA多通道采样LCD显示
- I2C读写AT24C02 基于STM32F103 cube116540
- 基于stm32f103ve的程序——跑马灯实验
- 基于STM32RCT6的步进电机驱动程序
- stm32f407上的两个can发送和接收例程
- STM32 led 时钟
- STM32 2.4G通信例程
- 直流无刷电机方波驱动 stm32 例程代码
- STM32中文资料
- STM32蓝牙和串口程序
- uboot到linux logo显示不间断 补丁
- STM32f103超声波模块例程
- stm32f103c8t6 4 oled.rar
- stm32f030 IAP Demo(原创)
- UNIX/LINUX编程实践教程的源码
- Linux任务管理器
- linux应用层的华容道游戏源代码
- STM32基于rt_thread操作系统的SDHC卡文件
- NRF24L01实现51与STM32双向通讯
- STM32F103 串口程序(完整版)
- stm32 ds18b20 温度传感器 测试通过
- ubuntu9.10 可加载内核模块和字符设备驱
- stm32官方例程
- STM32F103定时器中断程序
- [免费]基于stm32f103ze 的OLED驱动代码
- STM32F103RBT6驱动UC1698控制芯片的160160黑
- MP3文件ID3v2ID3v2APEv2标签读取
- STM32F103 DS18B20 V3.5.0固件库驱动程序工
- STM32定时器使用入门。看了这个程序会
- SIM908 SDIO FSMC STM32 FIFO
评论
共有 条评论