单片机,DDRA=0xff; PORTA=0xff; 是什么寄存器啊..
#include<hidef.h>/*commondefinesandmacros*/#include<mc9s12dg128.h>/*derivativeinforma...
#include <hidef.h> /* common defines and macros */
#include <mc9s12dg128.h> /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"
unsigned char d=0xaa;
void TimerOverflow(void)
{
PORTA=d;
d=~d;
while(TCNT<50000); //延时
TCNT=0;
}
void main(void)
{
EnableInterrupts;
TSCR1=0x80; //定时器使能
TSCR2=0x07; //分频系数为128
DDRA=0xff;
PORTA=0xff;
for(;;)
{
TimerOverflow();
}
for(;;)
{}
} 展开
#include <mc9s12dg128.h> /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"
unsigned char d=0xaa;
void TimerOverflow(void)
{
PORTA=d;
d=~d;
while(TCNT<50000); //延时
TCNT=0;
}
void main(void)
{
EnableInterrupts;
TSCR1=0x80; //定时器使能
TSCR2=0x07; //分频系数为128
DDRA=0xff;
PORTA=0xff;
for(;;)
{
TimerOverflow();
}
for(;;)
{}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询