/**************************************************
文件名:test6.c
功能:串口通信程序,使用中断方式将从串口获得的数据发送回串口
说明:时钟:7.3728MHz
*****************************************************/
#include <avr/io.h>
#include<avr/delay.h>
#include <avr/interrupt.h>
#include <avr/signal.h>
#define uchar unsigned char
#define uint unsigned int
/***************************************************
*名称SIGNAL(SIG_UART0_RECV)
*功能 UART0接收中断
*入口参数无
*出口参数:无
*****************************************************/
SIGNAL(SIG_UART0_RECV)
{
uchar txc=UDR0;
UDR0=txc;
}
/***************************************************
*名称main()
*功能 串口通信
*入口参数:无
*出口参数:无
***************************************************/
int main(void)
{
//uart 初始化
UBRR0L=7;//57.6k baud 7.3728MHz:50
//接收使能、发送使能、接收中断允许
UCSR0B=_BV(RXCIE0)|_BV(RXEN0)|_BV(TXEN0);
sei();//打开全局中断
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
学习使用AVR单片机中断方式实验串口通信 开发平台 atmega128 包含程序 │Makefile 13.78 KB │test6.c 977 bytes │test6.eep 13 bytes │test6.elf 3.93 KB │test6.hex 750 bytes │test6.lss 5.06 KB │test6.lst 2.96 KB │test6.map 14.37 KB │test6.o 2.54 KB │test6.pnproj 60 bytes │test6.sym 1.62 KB
资源推荐
资源详情
资源评论
收起资源包目录
3.8.串口通信实验2.rar (13个子文件)
3.8.串口通信实验2
test6.hex 750B
test6.lss 5KB
test6.lst 3KB
Makefile 14KB
test6.eep 13B
test6.c 977B
test6.elf 4KB
test6.o 3KB
test6.c.bak 1KB
test6.pnproj 60B
test6.map 14KB
test6.sym 2KB
.dep
test6.o.d 1KB
共 13 条
- 1
资源评论
chensz08
- 粉丝: 2
- 资源: 27
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功