main.c(19): error: #18: expected a ")"
Build target 'Target 1'
compiling main.c...
main.c(16): error: #18: expected a ")"
IPOH_MODER&=~(3<<(2*10));
main.c(17): error: #18: expected a ")"
IPOH_MODER|=(1<<(2*10));
main.c(19): error: #18: expected a ")"
PIOH_ODR&=~(1<<10);
main.c(29): warning: #1-D: last line of file ends without a newline
}
main.c: 1 warning, 3 errors
".\out\LED-REG.axf" - 3 Error(s), 1 Warning(s).
这是错误
/* 新建工程寄存器模板 */
#include "stm32f4xx.h"
#define PERIPH_BASE ((unsigned int)0X40000000)
#define AHB1PERIPH_BASE (PERIPH_BASE+0X00020000)
#define GPIOH_BASE (AHB1PERIPH_BASE+0X0000IC00) //peripheral外设缩写
#define GPIOH_ODR *(unsigned int *)(GPIOH_BASE+0X14)
#define GIPOH_MODER *(unsigned int *)(GPIOH_BASE+0X00)
int main(void)
{
GIPOH_MODER&=~(3<<(2*10));
GIPOH_MODER|=(1<<(2*10));
GPIOH_ODR&=~(1<<10);
while(1);
}
/* 骗过系统不报错 */
void SystemInit(void)
{
}
这是程序
/* 新建工程寄存器模板 */
#include "stm32f4xx.h"
#define PERIPH_BASE ((unsigned int)0X40000000)
#define AHB1PERIPH_BASE (PERIPH_BASE+0X00020000)
#define GPIOH_BASE (AHB1PERIPH_BASE+0X0000IC00) //peripheral外设缩写
#define GPIOH_ODR *(unsigned int *)(GPIOH_BASE+0X14)
#define GIPOH_MODER *(unsigned int *)(GPIOH_BASE+0X00)
int main(void)
{
GIPOH_MODER&=~(3<<(2*10));
GIPOH_MODER|=(1<<(2*10));
GPIOH_ODR&=~(1<<10);
while(1);
}
/* 骗过系统不报错 */
void SystemInit(void)
{
}
代码贴出来!
/* 新建工程寄存器模板 */
#include "stm32f4xx.h"
#define PERIPH_BASE ((unsigned int)0X40000000)
#define AHB1PERIPH (PERIPH_BASE+0X00020000)
#define GPIOH_BASE (AHB1PERIPH_BASE+0X0000IC00) //peripheral外设缩写
#define GPIOH_ODR *(unsigned int *)(GPIOH_BASE+0X14)
#define GIPOH_MODER *(unsigned int *)(GPIOH_BASE+0X00)
int main(void)
{
AHB1PERIPH |=(1<<7);
GIPOH_MODER &=~(1<<2*10);
GIPOH_MODER|=(1<<2*10);
GPIOH_ODR &=~(1<<10);
while(1);
}
/* 骗过系统不报错 */
void SystemInit(void)
{
}
代码就上面一些~一个很简单的LED灯点亮的,感觉上没有符号用错?自己总是检查不出来~
/* 新建工程寄存器模板 */
#include "stm32f4xx.h"
#define PERIPH_BASE ((unsigned int)0X40000000)
#define AHB1PERIPH (PERIPH_BASE+0X00020000)
#define GPIOH_BASE (AHB1PERIPH_BASE+0X0000IC00) //peripheral外设缩写
#define GPIOH_ODR *(unsigned int *)(GPIOH_BASE+0X14)
#define GIPOH_MODER *(unsigned int *)(GPIOH_BASE+0X00)
int main(void)
{
AHB1PERIPH |=(1<<7);
GIPOH_MODER &=~(1<<2*10);
GIPOH_MODER|=(1<<2*10);
GPIOH_ODR &=~(1<<10);
while(1);
}
/* 骗过系统不报错 */
void SystemInit(void)
{
}
#define GPIOH_BASE (AHB1PERIPH_BASE+0X0000IC00)
这句话后面的数字应该是0X00001C00,不是字母I把?
(AHB1PERIPH_BASE+0X0000IC00) 错了,不是IC而是1C
嗯嗯好像是的~谢谢!
大兄弟,要细心一点呀!