六,移植STM32 LCCD工程
1,移植GPIO的IOToggle应用
A,选择Workspace”窗口下的“DRV”用“Project”->“Add Files”把“D:workslccd-1.0.0Driversgpio.c”添加到工程;
D:workslccd-1.0.0Driversgpio.c的源码如下:
(参考GPIO/IOToggle/main.c)
B,修改D:workslccd-1.0.0Sourcemain.c的int main(void) 的while (1)前加上:
/* Configure the GPIO ports */
GPIO_Configuration();
while (1)里面加上:
{
printf("*** LCCD V1.0 running %d
",i++);
GPIO_Test();
}
并在文件前添加:
extern void GPIO_Configuration(void);
extern void GPIO_Test(void);
2,移植SYSTICK的应用
A,在D:workslccd-1.0.0Sourcemain.c的int main(void)添加:
/* Setup SysTick Timer for 1 msec interrupts */
if (SysTick_Config(SystemFrequency / 1000))
{
/* Capture error */
while (1);
}
B,在D:workslccd-1.0.0Sourcestm32f10x_it.c 的 void SysTick_Handler(void) 加上:
TimingDelay_Decrement(); 文件前加上:
extern void TimingDelay_Decrement(void);
C,选择Workspace”窗口下的“DRV”用“Project”->“Add Files”把“D:workslccd-1.0.0Drivers ime.c”添加到工程;
D:workslccd-1.0.0Drivers ime.c的源码如下:
(参考SysTick/main.c)
3,移植DMA的ADC1的应用
A,修改D:workslccd-1.0.0Sourcemain.c的int main(void) 的while (1)前加上:
/* ADC1 Configuration */
ADC_Configuration();
while (1)里面加上:
printf("*** LCCD V1.0 running %d adc =%d mv
",i++,(unsigned int)ADC_read());
并在文件前添加:
extern void ADC_Configuration(void);
extern unsigned int ADC_read(void);
B,在D:workslccd-1.0.0Sourcestm32f10x_it.c 的 void SysTick_Handler(void) 加上:
ADC_filter();
文件前加上:
extern unsigned int ADC_filter(void);
C,在D:workslccd-1.0.0Includestm32f10x_conf.h 中,打开注释:
#include "stm32f10x_adc.h"
#include "stm32f10x_dma.h"
D,选择Workspace”窗口下的“DRV”用“Project”->“Add Files”把“D:workslccd-1.0.0Driversadc.c”添加到工程;
D:workslccd-1.0.0Driversadc.c的源码如下:
(参考ADC/ADC1_DMA/main.c)
4,移植TIM的PWM应用
A,修改D:workslccd-1.0.0Sourcemain.c的int main(void) 的while (1)前加上:
/* TIM1 Configuration */
TIM2_Configuration();
/* TIM1 Configuration */
TIM2_Configuration();
并在文件前添加:
extern void TIM1_Configuration(void);
extern void TIM2_Configuration(void);
B,选择Workspace”窗口下的“DRV”用“Project”->“Add Files”把“D:workslccd-1.0.0Drivers im.c”添加到工程;
D:workslccd-1.0.0Drivers im.c的源码如下:
(参考TIM/PWM_Output/main.c)
5,移植EXTI的外部中断应用
A,修改D:workslccd-1.0.0Sourcemain.c的int main(void) 的while (1)前加上:
/* EXTI Configuration */
EXTI_Configuration();
并在文件前添加:
extern void EXTI_Configuration(void);
B,在D:workslccd-1.0.0Sourcestm32f10x_it.c 的 void SysTick_Handler(void) 后面加上:
void EXTI0_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line0) != RESET)
{
EXTI_PA0_IRQHandler();
/* Clear the EXTI_Line9 pending bit */
EXTI_ClearITPendingBit(EXTI_Line0);
}
}
在文件前加上:
extern void EXTI_PA0_IRQHandler(void);
C, 在D:workslccd-1.0.0Includestm32f10x_it.h 的 void SysTick_Handler(void) 后面加上
void EXTI0_IRQHandler(void);
D,在D:workslccd-1.0.0Includestm32f10x_conf.h 中,打开注释:
#include "stm32f10x_exti.h"
#include "misc.h"
E,选择Workspace”窗口下的“DRV”用“Project”->“Add Files”把“D:workslccd-1.0.0Driversexti.c”添加到工程;
D:workslccd-1.0.0Driversexti.c的源码如下:
(NVIC/Priority/main.c)
上一篇:9G-S08 CWS08开发过程简介
下一篇:9G-STM32 EWARM开发过程简介之三
推荐阅读最新更新时间:2024-03-16 14:26
- 热门资源推荐
- 热门放大器推荐