c51编程疑问 请各路大神帮忙 5
#include<reg51.h>#include<stdio.h>#defineuintunsignedintsbitoutled=P1;sbitgndH=P2^4;s...
#include<reg51.h>
#include<stdio.h>
#define uint unsigned int
sbit outled=P1;
sbit gndH=P2^4;
sbit gndL=P2^5;
sbit key1=P0^0;//out
sbit key2=P0^1;
sbit key3=P0^2;
sbit key4=P0^3;
sbit key5=P0^4;//in
sbit key6=P0^5;
sbit key7=P0^6;
sbit key8=P0^7;
bit clock;
bit BJ;
sbit fm=P3^7; //蜂鸣报警口,低电平有效
uint s;
uint t;
void main()
{ uint a;
t=0;s=0;
IT0=1;
EX0=1;
EA=1;
while(1)
{
a=10*t+s;
Delay(100);
led8(a);
}
}
void ex0() interrupt0 //中断子程序
{
t=Sm();
s=Sm();
}
出错出在最后的中断子程序 不明白怎么错了 请大神指出 多谢~
TEST1.C(179): error C132: 'interrupt0': not in formal parameter list
TEST1.C(179): error C141: syntax error near '{'
TEST1.C(180): error C244: 't': can't initialize, bad type or class
TEST1.C(180): error C132: 't': not in formal parameter list
TEST1.C(181): error C244: 's': can't initialize, bad type or class
TEST1.C(181): error C132: 's': not in formal parameter list
TEST1.C(182): error C141: syntax error near '}' 展开
#include<stdio.h>
#define uint unsigned int
sbit outled=P1;
sbit gndH=P2^4;
sbit gndL=P2^5;
sbit key1=P0^0;//out
sbit key2=P0^1;
sbit key3=P0^2;
sbit key4=P0^3;
sbit key5=P0^4;//in
sbit key6=P0^5;
sbit key7=P0^6;
sbit key8=P0^7;
bit clock;
bit BJ;
sbit fm=P3^7; //蜂鸣报警口,低电平有效
uint s;
uint t;
void main()
{ uint a;
t=0;s=0;
IT0=1;
EX0=1;
EA=1;
while(1)
{
a=10*t+s;
Delay(100);
led8(a);
}
}
void ex0() interrupt0 //中断子程序
{
t=Sm();
s=Sm();
}
出错出在最后的中断子程序 不明白怎么错了 请大神指出 多谢~
TEST1.C(179): error C132: 'interrupt0': not in formal parameter list
TEST1.C(179): error C141: syntax error near '{'
TEST1.C(180): error C244: 't': can't initialize, bad type or class
TEST1.C(180): error C132: 't': not in formal parameter list
TEST1.C(181): error C244: 's': can't initialize, bad type or class
TEST1.C(181): error C132: 's': not in formal parameter list
TEST1.C(182): error C141: syntax error near '}' 展开
1个回答
展开全部
#include<reg51.h>
#include<stdio.h>
#define uint unsigned int
#define outled P1;
sbit gndH = P2^4;
sbit gndL = P2^5;
sbit key1 = P0^0;//out
sbit key2 = P0^1;
sbit key3 = P0^2;
sbit key4 = P0^3;
sbit key5 = P0^4;//in
sbit key6 = P0^5;
sbit key7 = P0^6;
sbit key8 = P0^7;
bit clock;
bit BJ;
sbit fm = P3^7; //蜂鸣报警口,低电平有效
uint s;
uint t;
void main()
{
uint a;
t = 0;s = 0;
IT0 = 1;
EX0 = 1;
EA = 1;
while(1) {
a = 10 * t + s;
// Delay(100);
// led8(a);
}
}
void ex0() interrupt 0 //中断子程序
{
// t = Sm();
// s = Sm();
}
#include<stdio.h>
#define uint unsigned int
#define outled P1;
sbit gndH = P2^4;
sbit gndL = P2^5;
sbit key1 = P0^0;//out
sbit key2 = P0^1;
sbit key3 = P0^2;
sbit key4 = P0^3;
sbit key5 = P0^4;//in
sbit key6 = P0^5;
sbit key7 = P0^6;
sbit key8 = P0^7;
bit clock;
bit BJ;
sbit fm = P3^7; //蜂鸣报警口,低电平有效
uint s;
uint t;
void main()
{
uint a;
t = 0;s = 0;
IT0 = 1;
EX0 = 1;
EA = 1;
while(1) {
a = 10 * t + s;
// Delay(100);
// led8(a);
}
}
void ex0() interrupt 0 //中断子程序
{
// t = Sm();
// s = Sm();
}
意法半导体(中国)投资有限公司
2023-06-12 广告
2023-06-12 广告
STM32是一种32位的微控制器,由意法半导体(STMicroelectronics)公司设计和生产。STM32是一种非常常见的嵌入式系统芯片,广泛应用于物联网、汽车、工业控制、医疗设备等领域。STM32具有以下特点:1. 体积小巧:STM...
点击进入详情页
本回答由意法半导体(中国)投资有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询