2021-11-24 19:35:48 索煒達(dá)電子 1016
項目編號:M5
文件大小:2.5M
源碼說明:帶中文注釋
開發(fā)環(huán)境:C編譯器
簡要概述:
功能介紹:
1、LED0在不同模式下根據(jù)不同時間進(jìn)行翻轉(zhuǎn)。
2、按KEY_UP,翻轉(zhuǎn)LED1,切換模式,分別為
不工作模式 共0.5秒
搖頭模式 (順n個5.625度 停頓x個0.1秒 逆n個5.625度 停頓x個0.1秒) 共0.2x秒
轉(zhuǎn)圈模式1 (順1圈,停頓y個0.1秒) 共0.1y秒
轉(zhuǎn)圈模式2 (逆1圈,停頓z個0.1秒) 共0.1z秒
自定義模式 (自行修改代碼) 共3.5秒
3、按KEY0,翻轉(zhuǎn)LED1,電機(jī)順時針旋轉(zhuǎn)5.625度。按KEY1,翻轉(zhuǎn)LED1,逆時針旋轉(zhuǎn)5.625度。(鍵盤外部中斷)
接線
+ —> 5V
- —> GND
IN1 —> PF1
IN2 —> PF2
IN3 —> PF3
IN4 —> PF4
效果圖
搖頭模式
// 24 * 5.625 = 135
n = 24;
// 0.2 * 10 = 2
x = 10;
(順n個5.625度 停頓x個0.1秒 逆n個5.625度 停頓x個0.1秒) 共0.2x秒
轉(zhuǎn)圈模式1
// 0.1 * 5 = 0.5
y = 5;
(順1圈,停頓y個0.1秒) 共0.1y秒
轉(zhuǎn)圈模式2
// 0.1 * 0 = 0
z = 0;
(逆1圈,停頓z個0.1秒) 共0.1z秒
自定義模式
目錄│文件列表:
└ STM32_28BYJ-48_apply_demo1
│ keilkilll.bat
│ KEY.TXT
├ CORE
│ │ core_cm3.c
│ │ core_cm3.h
│ └ startup_stm32f10x_hd.s
├ HARDWARE
│ ├ BEEP
│ │ │ beep.c
│ │ │ beep.c.orig
│ │ └ beep.h
│ ├ EXTI
│ │ │ exti.c
│ │ │ exti.c.orig
│ │ └ exti.h
│ ├ KEY
│ │ │ key.c
│ │ └ key.h
│ ├ LED
│ │ │ led.c
│ │ └ led.h
│ └ STEP
│ │ step.c
│ │ step.c.orig
│ └ step.h
├ OBJ
│ │ beep.crf
│ │ beep.d
│ │ beep.o
│ │ core_cm3.crf
│ │ core_cm3.d
│ │ core_cm3.o
│ │ delay.crf
│ │ delay.d
│ │ delay.o
│ │ exti.crf
│ │ exti.d
│ │ exti.o
│ │ KEY.axf
│ │ KEY.build_log.htm
│ │ key.crf
│ │ key.d
│ │ KEY.hex
│ │ KEY.htm
│ │ KEY.lnp
│ │ key.o
│ │ KEY.sct
│ │ KEY_KEY.dep
│ │ led.crf
│ │ led.d
│ │ led.o
│ │ main.crf
│ │ main.d
│ │ main.o
│ │ misc.crf
│ │ misc.d
│ │ misc.o
│ │ startup_stm32f10x_hd.d
│ │ startup_stm32f10x_hd.o
│ │ step.crf
│ │ step.d
│ │ step.o
│ │ stm32f10x_exti.crf
│ │ stm32f10x_exti.d
│ │ stm32f10x_exti.o
│ │ stm32f10x_gpio.crf
│ │ stm32f10x_gpio.d
│ │ stm32f10x_gpio.o
│ │ stm32f10x_it.crf
│ │ stm32f10x_it.d
│ │ stm32f10x_it.o
│ │ stm32f10x_rcc.crf
│ │ stm32f10x_rcc.d
│ │ stm32f10x_rcc.o
│ │ stm32f10x_usart.crf
│ │ stm32f10x_usart.d
│ │ stm32f10x_usart.o
│ │ sys.crf
│ │ sys.d
│ │ sys.o
│ │ system_stm32f10x.crf
│ │ system_stm32f10x.d
│ │ system_stm32f10x.o
│ │ usart.crf
│ │ usart.d
│ └ usart.o
├ STM32F10x_FWLib
│ ├ inc
│ │ │ misc.h
│ │ │ stm32f10x_adc.h
│ │ │ stm32f10x_bkp.h
│ │ │ stm32f10x_can.h
│ │ │ stm32f10x_cec.h
│ │ │ stm32f10x_crc.h
│ │ │ stm32f10x_dac.h
│ │ │ stm32f10x_dbgmcu.h
│ │ │ stm32f10x_dma.h
│ │ │ stm32f10x_exti.h
│ │ │ stm32f10x_flash.h
│ │ │ stm32f10x_fsmc.h
│ │ │ stm32f10x_gpio.h
│ │ │ stm32f10x_i2c.h
│ │ │ stm32f10x_iwdg.h
│ │ │ stm32f10x_pwr.h
│ │ │ stm32f10x_rcc.h
│ │ │ stm32f10x_rtc.h
│ │ │ stm32f10x_sdio.h
│ │ │ stm32f10x_spi.h
│ │ │ stm32f10x_tim.h
│ │ │ stm32f10x_usart.h
│ │ └ stm32f10x_wwdg.h
│ └ src
│ │ misc.c
│ │ stm32f10x_adc.c
│ │ stm32f10x_bkp.c
│ │ stm32f10x_can.c
│ │ stm32f10x_cec.c
│ │ stm32f10x_crc.c
│ │ stm32f10x_dac.c
│ │ stm32f10x_dbgmcu.c
│ │ stm32f10x_dma.c
│ │ stm32f10x_exti.c
│ │ stm32f10x_flash.c
│ │ stm32f10x_fsmc.c
│ │ stm32f10x_gpio.c
│ │ stm32f10x_i2c.c
│ │ stm32f10x_iwdg.c
│ │ stm32f10x_pwr.c
│ │ stm32f10x_rcc.c
│ │ stm32f10x_rtc.c
│ │ stm32f10x_sdio.c
│ │ stm32f10x_spi.c
│ │ stm32f10x_tim.c
│ │ stm32f10x_usart.c
│ └ stm32f10x_wwdg.c
├ SYSTEM
│ ├ delay
│ │ │ delay.c
│ │ └ delay.h
│ ├ sys
│ │ │ sys.c
│ │ └ sys.h
│ └ usart
│ │ usart.c
│ └ usart.h
└ USER
│ JLinkSettings.ini
│ KEY.map
│ KEY.uvguix.Administrator
│ KEY.uvoptx
│ KEY.uvprojx
│ main.c
│ startup_stm32f10x_hd.lst
│ stm32f10x.h
│ stm32f10x_conf.h
│ stm32f10x_it.c
│ stm32f10x_it.h
│ system_stm32f10x.c
│ system_stm32f10x.h
└ DebugConfig
└ KEY_STM32F103ZE.dbgconf