我是初学者,我尝试使用 AVR ATmega32 编写用于 IR 通信的代码。
这是我编写的红外发射器程序。
#include <xc.h>
#define F_CPU 8000000UL
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "USART_RS232_H_file.h"
#include "USART_Interrupt.h"
char check,data,invdata,count=0;
char g=0;
ISR(TIMER0_OVF_vect)
{
g = ~g;
if (g!=0)
PORTD |= (1<<7);
if (g==0)
PORTD &= ~(1<<7);
TCNT0 = 0xF4;
}
void Timer_dalay()
{
TIMSK=(1<<TOIE0); /* Enable timer interrupt */
TCNT0 = 0xF4; /* load TCNT0, count for 13us */
TCCR0 = (1<<CS01); /* Timer0, normal mode, /8 prescalar */
}
int main()
{
DDRD |= 0xFF; /* set PORTD as output port */
USART_Init(1200); /* set baud rate 1200 */
sei(); /* enable global interrupt */
Timer_dalay(); /* call timer function */
char j,d=0;
while(1)
{
USART_TxChar('$'); /* send the special character '$' */
}
}
我有两个错误。
- 目标“main.o”的配方失败
2.USART_RS232_H_file.h:没有这样的文件或目录
我用谷歌搜索并搜索了很多网站。但我找不到解决方案。请问你能帮帮我吗?