1、 main.c(23): error C141: syntax error near '='
#include<reg52.h>
void Delay20ms() //@11.0592MHz 延时20ms 函数
{
unsigned char i, j;
i = 216;
j = 37;
do
{
while (--j);
} while (--i);
}
void main()
{
while(1)
{
if(P3^2 == 0)
{
Delay20ms() ;
while(P3^2 == 0) ;
Delay20ms();
P0^0 = ~P0^0;
}
}
}
解决方案:
sbit LED = P0^0; // 不能直接对P0^0操作
sbit KEY = P3^2; // 应该用sbit(C51 中的一种扩充数据类型),可以用他来访问芯片内部的 // RAM可寻址位或特殊功能寄存器中的可寻址位。
头文件为
#include<reg52.h> 时 ,需要用 sbit ,P 0^0 = 1 ;
#include<REGX52.H> 时 ,不用 sbit , P 0_0 = 1 ; //可以直接用
详情可以打开头文件看到 ——————————— #include<REGX52.H> 已经声明好了
———————————而 #include<reg52.h> 没有
2、 main.c(28): error C202: 'i': undefined identifier
main.c(28): error C141: syntax error near ')'
解决方案:
keil里 不可以在 for循环 里直接 int ,得放在外头
3、 uVision has not been properly closed due to source code translation for editor functionality such as dynamic syntax checking, code completion and browse information.
Functionality will be deactivated until next start.
每次只要一打开32的project就得闪退,然后再次打开又跳出这个警告。
如此反复好几遍,尝试了别人的各种删注册表、更改路径 都未果、
解决方法:
点击上面 魔法棒(options for Target )
点击 c / c++ 中的 Include paths 添加启动文件路径
然后我发现啊 main.c 倒是可以编译成功了,但只要关闭下次又得重启。
—————————————————————崩溃了—————————————————————
这里我转载下别人的解决方法
如何解决打开keil工程软件闪退问题_不是Gonga的博客-CSDN博客_keil软件闪退
—————————————————^_^————仍然不行———————自闭ing—————————
————————————————————————解决了!!!——————————————
我下载了最新 keil MDK537 版本, 我觉得应该是版本的问题,我原来514的版本,试了好多方法都不行
所以不妨可以去下载最新的版本!!!
开始界面长这样
这里我分享个537百度网盘链接:
链接:https://pan.baidu.com/s/1y0pnzD3ZoegagIuiYjMh2A
提取码:1314
ヽ(≧□≦)ノ ( 我自己从官网下的,效率太高了,下了我一晚上)ヽ(≧□≦)ノ
4、 这个就简单易懂了
解决方法:
代码最后一行 必得 空行
5、 重复定义了大概是
解决方法:
—————( ^_^ ) 数组一个标点错了,后面全部影响到了 ( ^_^ )———————————
真的想笑
6、 error C249: ‘DATA‘: SEGMENT TOO LARGE
应该是我数组放的太多了,单片机空间不够了
解决方法:
在数组之前加个code 即可
7、 error: #667: "asm" function is nonstandard
解决方法:
1. 魔法棒------>C/C++------>取消勾选 Strict ANSI C
2. 魔法棒------>Target------>选择 “ Use default compiler version 5 ”
8:一个警告虽然不重要:warning: #223-D: function “TIM4_Init“ declared implicitly
没有 宏定义 好
解决方式:(26条消息) warning: #223-D: function “TIM4_Init“ declared implicitly_0无欲则刚0的博客-CSDN博客
9:no cortex-m sw device found
这种情况 JLINK 烧录时好像要给 模块供电,它的VCC是不提供的