我想知道这个程序哪里用到中断了,里面有#include <avr/interrupt.h>和sei();
#include<avr/io.h>#include<util/delay.h>#include<avr/interrupt.h>unsignedcharzifu;voi...
#include <avr/io.h> #include <util/delay.h>
#include <avr/interrupt.h>
unsigned char zifu;void Port_Init(void);
void Usart_Init(void);
void Usart_PutChar(unsigned char data);
int main(void)
{
Port_Init();
Usart_Init();
zifu = 0X31;
Usart_PutChar(zifu);
sei();
while(1)
{
}
}
void Port_Init()
{
PORTD = 0X00;
DDRD |= (1 << PD1);
}
void Usart_Init()
{
UCSRA = 0X00;
UCSRC |= (1<<URSEL) | (1 << UCSZ1) | (1 << UCSZ0);
UBRRL = (F_CPU / 9600 / 16 - 1) % 256; UBRRH = (F_CPU / 9600 / 16 - 1) / 256;
UCSRB |= (1 << TXEN);
}
void Usart_PutChar(unsigned char data)
{
while( !(UCSRA & (1 << UDRE)) );
UDR = data;
} 展开
#include <avr/interrupt.h>
unsigned char zifu;void Port_Init(void);
void Usart_Init(void);
void Usart_PutChar(unsigned char data);
int main(void)
{
Port_Init();
Usart_Init();
zifu = 0X31;
Usart_PutChar(zifu);
sei();
while(1)
{
}
}
void Port_Init()
{
PORTD = 0X00;
DDRD |= (1 << PD1);
}
void Usart_Init()
{
UCSRA = 0X00;
UCSRC |= (1<<URSEL) | (1 << UCSZ1) | (1 << UCSZ0);
UBRRL = (F_CPU / 9600 / 16 - 1) % 256; UBRRH = (F_CPU / 9600 / 16 - 1) / 256;
UCSRB |= (1 << TXEN);
}
void Usart_PutChar(unsigned char data)
{
while( !(UCSRA & (1 << UDRE)) );
UDR = data;
} 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询