📄 main.lst
字号:
##############################################################################
# #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 KICKSTART 24/Dec/2007 11:03:40 #
# Copyright 1999-2005 IAR Systems. All rights reserved. #
# #
# Cpu mode = thumb #
# Endian = little #
# Stack alignment = 4 #
# Source file = C:\Manley\EKBoard\EKSTM32F\LCDDemo(lcd+led+buttom)\L #
# CDDemo\project\main.c #
# Command line = "C:\Manley\EKBoard\EKSTM32F\LCDDemo(lcd+led+buttom)\ #
# LCDDemo\project\main.c" -D VECT_TAB_FLASH -lC #
# "C:\Manley\EKBoard\EKSTM32F\LCDDemo(lcd+led+buttom)\ #
# LCDDemo\project\EWARM\BOOT_FLASH\List\" -lA #
# "C:\Manley\EKBoard\EKSTM32F\LCDDemo(lcd+led+buttom)\ #
# LCDDemo\project\EWARM\BOOT_FLASH\List\" -o #
# "C:\Manley\EKBoard\EKSTM32F\LCDDemo(lcd+led+buttom)\ #
# LCDDemo\project\EWARM\BOOT_FLASH\Obj\" -z3 --no_cse #
# --no_unroll --no_inline --no_code_motion --no_tbaa #
# --no_clustering --no_scheduling --debug --cpu_mode #
# thumb --endian little --cpu cortex-M3 --stack_align #
# 4 --require_prototypes --fpu None --dlib_config #
# "C:\Program Files\IAR Systems\Embedded Workbench #
# 4.0 Kickstart\arm\LIB\dl7mptnnl8f.h" -I #
# "C:\Manley\EKBoard\EKSTM32F\LCDDemo(lcd+led+buttom)\ #
# LCDDemo\project\EWARM\..\" -I #
# "C:\Manley\EKBoard\EKSTM32F\LCDDemo(lcd+led+buttom)\ #
# LCDDemo\project\EWARM\..\..\library\inc\" -I #
# "C:\Program Files\IAR Systems\Embedded Workbench #
# 4.0 Kickstart\arm\INC\" #
# List file = C:\Manley\EKBoard\EKSTM32F\LCDDemo(lcd+led+buttom)\L #
# CDDemo\project\EWARM\BOOT_FLASH\List\main.lst #
# Object file = C:\Manley\EKBoard\EKSTM32F\LCDDemo(lcd+led+buttom)\L #
# CDDemo\project\EWARM\BOOT_FLASH\Obj\main.r79 #
# #
# #
##############################################################################
C:\Manley\EKBoard\EKSTM32F\LCDDemo(lcd+led+buttom)\LCDDemo\project\main.c
1 /******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
2 * File Name : main.c
3 * Author : David JIANG
4 * Date First Issued : 2007.9.17
5 * Description : Main program body
6 ********************************************************************************
7 * History:
8 * 2007.9.17: V1.0
9 ********************************************************************************
10 * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
11 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
12 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
13 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
14 * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
15 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
16 *******************************************************************************/
17
18 /* Includes ------------------------------------------------------------------*/
19 #include "stm32f10x_lib.h"
20 #include "lcd.h"
21
22 /* Local includes ------------------------------------------------------------*/
23 /* Private typedef -----------------------------------------------------------*/
24 typedef enum {FAILED = 0, PASSED = !FAILED} TestStatus;
25
26 /* Private define ------------------------------------------------------------*/
27 /* Private macro -------------------------------------------------------------*/
28 /* Private variables ---------------------------------------------------------*/
29 vu32 ret; /* for return of the interrupt handling */
30 volatile TestStatus TestRx;
31
32 /* Private functions ---------------------------------------------------------*/
33 void RCC_Configuration(void);
34 void GPIO_Configuration(void);
35 void NVIC_Configuration(void);
36 void CAN_Config(void);
37 TestStatus CAN_Polling(void);
38 TestStatus CAN_Interrupt(void);
39 void SysTick_Config(void);
40 void LcdShow_Init(void);
41
42 void Led_Config(void);
43 void Button_Config(void);
44 void Led_RW_ON(void);
45 void Led_RW_OFF(void);
46
47 void delay(void);
48 void delay()
49 {
50 int i,j;
51 for (i=0; i<0xfffff; i++) j++;
^
Warning[Pe549]: variable "j" is used before its value is set
52 }
53 EXTI_InitTypeDef EXTI_InitStructure;
54 /*******************************************************************************
55 * Function Name : main
56 * Description : Main program
57 * Input : None
58 * Output : None
59 * Return : None
60 *******************************************************************************/
61 int main(void)
62 {
63
64 #ifdef DEBUG
65 debug();
66 #endif
67
68 /* System Clocks Configuration */
69 RCC_Configuration();
70
71 /* GPIO ports pins Configuration */
72 GPIO_Configuration();
73
74 /* NVIC Configuration */
75 NVIC_Configuration();
76
77 /* Configure the systick */
78 SysTick_Config();
79
80 LcdShow_Init();
81 Led_Config();
82 Button_Config();
83
84 GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource3);
85 /* Configure EXTI Line9 to generate an interrupt on falling edge */
86 EXTI_InitStructure.EXTI_Line = EXTI_Line3;
87 EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
88 EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
89 EXTI_InitStructure.EXTI_LineCmd = ENABLE;
90 EXTI_Init(&EXTI_InitStructure);
91
92 GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource4);
93 /* Configure EXTI Line9 to generate an interrupt on falling edge */
94 EXTI_InitStructure.EXTI_Line = EXTI_Line4;
95 EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
96 EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
97 EXTI_InitStructure.EXTI_LineCmd = ENABLE;
98 EXTI_Init(&EXTI_InitStructure);
99
100 while(1)
101 {
102 write_string("STM3"); /*STM32 LCD demo*/
103 delay();
104 write_string("TM32");
105 delay();
106 write_string("M32 ");
107 delay();
108 write_string("32 L");
109 delay();
110 write_string("2 LC");
111 delay();
112 write_string(" LCD");
113 delay();
114 write_string("LCD ");
115 delay();
116 write_string("CD D");
117 delay();
118 write_string("D DE");
119 delay();
120 write_string(" DEM");
121 delay();
122 write_string("DEMO");
123 delay();
124 }
125 }
126
127 /*******************************************************************************
128 * Function Name : RCC_Configuration
129 * Description : Configures the different system clocks.
130 * Input : None
131 * Output : None
132 * Return : None
133 *******************************************************************************/
134 void RCC_Configuration(void)
135 {
136 ErrorStatus HSEStartUpStatus;
137
138 /* RCC system reset(for debug purpose) */
139 // RCC_DeInit();
140
141 /* Enable HSE */
142 RCC_HSEConfig(RCC_HSE_ON);
143
144 /* Wait till HSE is ready */
145 HSEStartUpStatus = RCC_WaitForHSEStartUp();
146
147 if(HSEStartUpStatus == SUCCESS)
148 {
149 /* HCLK = SYSCLK */
150 RCC_HCLKConfig(RCC_SYSCLK_Div1);
151
152 /* PCLK2 = HCLK */
153 RCC_PCLK2Config(RCC_HCLK_Div1);
154
155 /* PCLK1 = HCLK/2 */
156 RCC_PCLK1Config(RCC_HCLK_Div2);
157
158 /* ADCCLK = PCLK2/6 */
159 RCC_ADCCLKConfig(RCC_PCLK2_Div6);
160
161 /* Flash 2 wait state */
162 FLASH_SetLatency(FLASH_Latency_2);
163
164 /* Enable Prefetch Buffer */
165 FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
166
167 /* PLLCLK = 4MHz * 9 = 36 MHz */
168 RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
169
170 /* Enable PLL */
171 RCC_PLLCmd(ENABLE);
172
173 /* Wait till PLL is ready */
174 while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
175 {
176 }
177
178 /* Select PLL as system clock source */
179 RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
180
181 /* Wait till PLL is used as system clock source */
182 while(RCC_GetSYSCLKSource() != 0x08)
183 {
184 }
185 }
186
187 /* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */
188 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC
189 | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -