📄 main.c
字号:
#include <iom88.h>
#include "UART.h"
#include "TIMER0.h"
#include "XBeePro.h"
unsigned char key_flag=0;
void main(void)
{
DDRD_Bit7 = 1; // PD7设为输出
PORTD_Bit7 = 1; // 输出高电平,PD7指示灯亮
DDRD_Bit4 = 0; // PD4设为输入
UartInit();
Timer0Init();
asm("sei"); // Global enable interrupts
UartPutString("Hello World!\r");
UartPutString("XBeePro module is initalized!\r");
while(tx_counter)
{
}
while (1)
{
if(key_flag == 1)
{
if(XBeeProChangeChannel() == 1)
{
PORTD_Bit7 ^= 1; //指示通道转换命令执行成功
}
asm("cli"); // 关闭中断,
key_flag = 0;
asm("sei"); // 打开中断
}
while (rx_counter) //如果接收缓冲区中有数据
{
UartPutChar(UartGetChar()); //将其输出
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -