怎么将C语言转成汇编代码51单片机的
#include<reg51.h>//包含51单片机寄存器定义的头文件sbitsound=P1^7;//将sound位定义为P1.7引#definef1(a)(65536...
#include<reg51.h> // 包含51单片机寄存器定义的头文件
sbit sound=P1^7; //将sound位定义为P1.7引
#define f1(a) (65536-a)/256
#define f2(a) (65536-a)%256
unsigned char i = 460;
unsigned int j = 0;
void main(void)
{
EA = 1; //开总中断.
ET1 = 1; //定时器T1中断允许 .
TMOD = 0x10; //TMOD=0001 000B,使用定时器T1的模式1
TH1 = f1(i); //定时器T1的高8位赋初值.
TL1 = f2(i); //定时器T1的高8位赋初值.
TR1 = 1; //启动定时器T1
while(1) { //无限循环.
i = 460;
while(j < 2000);
j = 0;
i = 360;
while(j < 2000);
j = 0;
}
}
void Time1(void) interrupt 3 using 0 //“interrupt”声明函数为中断服务函数.
{
TR1 = 0; //定时器T1
sound = ~sound;
TH1 = f1(i); //定时器T1的高8位重新赋初值.
TL1 = f2(i); //定时器T1的高8位重新赋初值.
j++;
TR1 = 1; //启动定时器T1
} 展开
sbit sound=P1^7; //将sound位定义为P1.7引
#define f1(a) (65536-a)/256
#define f2(a) (65536-a)%256
unsigned char i = 460;
unsigned int j = 0;
void main(void)
{
EA = 1; //开总中断.
ET1 = 1; //定时器T1中断允许 .
TMOD = 0x10; //TMOD=0001 000B,使用定时器T1的模式1
TH1 = f1(i); //定时器T1的高8位赋初值.
TL1 = f2(i); //定时器T1的高8位赋初值.
TR1 = 1; //启动定时器T1
while(1) { //无限循环.
i = 460;
while(j < 2000);
j = 0;
i = 360;
while(j < 2000);
j = 0;
}
}
void Time1(void) interrupt 3 using 0 //“interrupt”声明函数为中断服务函数.
{
TR1 = 0; //定时器T1
sound = ~sound;
TH1 = f1(i); //定时器T1的高8位重新赋初值.
TL1 = f2(i); //定时器T1的高8位重新赋初值.
j++;
TR1 = 1; //启动定时器T1
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询