我正在编写 AVR 微控制器,并在 WINAVR 套件的程序员记事本中。
我正在尝试分离我的代码,但是 sepeaet .c 文件我无法使用 AVR 预定义变量。(AVR 提供的变量指向某些 BIT)
例如,此代码将在我的 main.c 文件中运行。但不在另一个 random.c 文件中:
UBRR0H = (unsigned char)(ubrr>>8);
它给出了错误:
random.c:6: error: 'UBRR0H' undeclared (first use in this function)
在我的 main.c 文件中,它只有以下内容:
#include <stdio.h>
#include <stdlib.h>
#include <util/delay.h>
#include <string.h>
#include <avr/interrupt.h>
#include "lcd.h"
#include "random.h"