/ICC-AVR application builder : 2015/6/25 10:51:13
// Target : M16
// Crystal: 12.000Mhz
#include <iom16v.h>
#include <macros.h>
void port_init(void)
{
PORTA = 0x00;
DDRA = 0x00;
PORTB = 0x00;
DDRB = 0x00;
PORTC = 0x00; //m103 output only
DDRC = 0x00;
PORTD = 0x00;
DDRD = 0x00;
}
//TIMER0 initialize - prescale:1024
// WGM: Normal
// desired value: 100Hz
// actual value: 100.160Hz (0.2%)
void timer0_init(void)
{
TCCR0 = 0x00; //stop
TCNT0 = 0x8B; //set count
OCR0 = 0x75; //set compare
TCCR0 = 0x05; //start timer
}
#pragma interrupt_handler timer0_ovf_isr:iv_TIM0_OVF
void timer0_ovf_isr(void)
{
TCNT0 = 0x8B; //reload counter value
}
//call this routine to initialize all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();
timer0_init();
MCUCR = 0x00;
GICR = 0x00;
TIMSK = 0x01; //timer interrupt sources
SEI(); //re-enable interrupts
//all peripherals are now initialized
}
//ICC-AVR application builder : 2015/6/25 11:00:50
// Target : M16
// Crystal: 12.000Mhz
#include <iom16v.h>
#include <macros.h>
void port_init(void)
{
PORTA = 0x00;
DDRA = 0x00;
PORTB = 0x00;
DDRB = 0x00;
PORTC = 0x00; //m103 output only
DDRC = 0x00;
PORTD = 0x00;
DDRD = 0x00;
}
//TIMER1 initialize - prescale:1024
// WGM: 0) Normal, TOP=0xFFFF
// desired value: 1Hz
// actual value: 1.000Hz (0.0%)
void timer1_init(void)
{
TCCR1B = 0x00; //stop
TCNT1H = 0xD2; //setup
TCNT1L = 0x3A;
OCR1AH = 0x2D;
OCR1AL = 0xC6;
OCR1BH = 0x2D;
OCR1BL = 0xC6;
ICR1H = 0x2D;
ICR1L = 0xC6;
TCCR1A = 0x00;
TCCR1B = 0x05; //start Timer
}
#pragma interrupt_handler timer1_ovf_isr:iv_TIM1_OVF
void timer1_ovf_isr(void)
{
//TIMER1 has overflowed
TCNT1H = 0xD2; //reload counter high value
TCNT1L = 0x3A; //reload counter low value
}
//call this routine to initialize all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();
timer1_init();
MCUCR = 0x00;
GICR = 0x00;
TIMSK = 0x04; //timer interrupt sources
SEI(); //re-enable interrupts
//all peripherals are now initialized
}
//ICC-AVR application builder : 2015/6/25 11:38:33
// Target : M16
// Crystal: 12.000Mhz
#include <iom16v.h>
#include <macros.h>
void port_init(void)
{
PORTA = 0x00;
DDRA = 0x00;
PORTB = 0x00;
DDRB = 0x00;
PORTC = 0x00; //m103 output only
DDRC = 0x00;
PORTD = 0x00;
DDRD = 0x00;
}
//TIMER1 initialize - prescale:1024
// WGM: 0) Normal, TOP=0xFFFF
// desired value: 100Hz
// actual value: 100.160Hz (0.2%)
void timer1_init(void)
{
TCCR1B = 0x00; //stop
TCNT1H = 0xFF; //setup
TCNT1L = 0x8B;
OCR1AH = 0x00;
OCR1AL = 0x75;
OCR1BH = 0x00;
OCR1BL = 0x75;
ICR1H = 0x00;
ICR1L = 0x75;
TCCR1A = 0x00;
TCCR1B = 0x05; //start Timer
}
#pragma interrupt_handler timer1_ovf_isr:iv_TIM1_OVF
void timer1_ovf_isr(void)
{
//TIMER1 has overflowed
TCNT1H = 0xFF; //reload counter high value
TCNT1L = 0x8B; //reload counter low value
}
//call this routine to initialize all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();
timer1_init();
MCUCR = 0x00;
GICR = 0x00;
TIMSK = 0x04; //timer interrupt sources
SEI(); //re-enable interrupts
//all peripherals are now initialized
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
单片机设计,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答! 软件开发设计:PHP、QT、应用软件开发、系统软件开发、移动应用开发、网站开发C++、Java、python、web、C#等语言的项目开发与学习资料 硬件与设备:单片机、EDA、proteus、RTOS、包括计算机硬件、服务器、网络设备、存储设备、移动设备等 操作系统:LInux、IOS、树莓派、安卓开发、微机操作系统、网络操作系统、分布式操作系统等。此外,还有嵌入式操作系统、智能操作系统等。 云计算与大数据:数据集、包括云计算平台、大数据分析、人工智能、机器学习等,云计算是一种基于互联网的计算方式,通过这种方式,共享的软硬件资源和信息可以按需提供给计算机和其他设备。
资源推荐
资源详情
资源评论
收起资源包目录
毕设&课设&项目&竞赛-基于stm32的红外定位主模块信号采集以及解析程序,之后学长会加入485总线.zip (295个子文件)
delay.h.100110080336 6KB
ledLoctor.c.150606182754 1B
ledLoctor.c.150606182832 5KB
ledLoctor.c.150606182850 5KB
ledLoctor.c.150606182904 5KB
ledLoctor.c.150606183048 5KB
ledLoctor.c.150606183058 5KB
ledLoctor.c.150606183104 5KB
ledLoctor.c.150606183356 5KB
ledLoctor.c.150606183658 5KB
ledLoctor.c.150606183706 5KB
ledLoctor.c.150606183730 5KB
ledLoctor.c.150606183758 5KB
ledLoctor.c.150606183916 5KB
ledLoctor.c.150606184024 5KB
ledLoctor.c.150606184534 5KB
ledLoctor.c.150606190906 5KB
ledLoctor.c.150606191106 5KB
ledLoctor.c.150606191116 5KB
ledLoctor.c.150606191124 5KB
ledLoctor.c.150606191820 5KB
ledLoctor.c.150606192806 5KB
ledLoctor.c.150606192822 5KB
ledLoctor.c.150606193536 5KB
ledLoctor.c.150606193604 3KB
ledLoctor.c.150606193656 3KB
ledLoctor.c.150606193732 3KB
ledLoctor.c.150606193746 3KB
ledLoctor.c.150606193800 3KB
ledLoctor.c.150606193820 3KB
ledLoctor.c.150606193830 3KB
ledLoctor.c.150606193908 3KB
ledLoctor.c.150606193916 3KB
ledLoctor.c.150606193924 3KB
ledLoctor.c.150606193934 3KB
ledLoctor.c.150606194144 3KB
ledLoctor.c.150606194150 3KB
ledLoctor.c.150606194222 3KB
ledLoctor.c.150606195640 3KB
ledLoctor.c.150606195724 3KB
ledLoctor.c.150606195728 3KB
ledLoctor.c.150606195812 3KB
ledLoctor.c.150606195832 4KB
ledLoctor.c.150606195842 4KB
ledLoctor.c.150606195910 4KB
ledLoctor.c.150606200124 4KB
ledLoctor.c.150606200130 4KB
ledLoctor.c.150606200326 4KB
ledLoctor.c.150606200344 3KB
ledLoctor.c.150606200548 3KB
ledLoctor.c.150606200820 3KB
ledLoctor.c.150606200940 3KB
ledLoctor.c.150606201006 3KB
ledLoctor.c.150606201238 3KB
ledLoctor.c.150606201330 3KB
ledLoctor.c.150606201430 3KB
ledLoctor.c.150606201526 3KB
ledLoctor.c.150606201626 3KB
ledLoctor.c.150606201812 3KB
ledLoctor.c.150606201844 3KB
ledLoctor.c.150606202046 3KB
ledLoctor.c.150606202052 3KB
ledLoctor.c.150606202058 3KB
ledLoctor.c.150606202144 3KB
ledLoctor.c.150606202156 3KB
ledLoctor.c.150606202210 3KB
ledLoctor.c.150606202222 3KB
ledLoctor.c.150606202240 3KB
ledLoctor.c.150606202300 3KB
ledLoctor.c.150606202324 4KB
ledLoctor.c.150606202328 4KB
ledLoctor.c.150606202412 4KB
ledLoctor.c.150606202418 4KB
ledLoctor.c.150606202620 4KB
ledLoctor.c.150606203508 4KB
ledLoctor.c.150606203520 4KB
ledLoctor.c.150606203552 4KB
ledLoctor.c.150606203604 4KB
ledLoctor.c.150606203632 3KB
ledLoctor.c.150606203722 3KB
ledLoctor.c.150606203740 3KB
ledLoctor.c.150606203906 3KB
ledLoctor.c.150606203912 3KB
ledLoctor.c.150606203934 3KB
ledLoctor.c.150606203948 3KB
ledLoctor.c.150606204004 3KB
ledLoctor.c.150606204026 3KB
ledLoctor.c.150606204044 3KB
ledLoctor.c.150606204104 3KB
ledLoctor.c.150606204124 3KB
ledLoctor.c.150606204158 3KB
ledLoctor.c.150606204250 3KB
ledLoctor.c.150606204254 3KB
ledLoctor.c.150606204256 3KB
ledLoctor.c.150606204308 3KB
ledLoctor.c.150606204708 3KB
ledLoctor.c.150606204838 3KB
ledLoctor.c.150606205004 3KB
ledLoctor.c.150606205058 3KB
ledLoctor.c.150606205246 3KB
共 295 条
- 1
- 2
- 3
资源评论
妄北y
- 粉丝: 1w+
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 与spoon配套使用的jdk
- 基于单片机的便携式粮食水分测试仪的研究
- 测绘基坑支护工程变形监测报告1.pdf
- 基于PHP+swoole实现的微信机器人,依赖vbot和微信网页版的功能,帮助管理微信群/聊天/踢人等+源码+开发文档+运行教程
- com.xunmeng.pinduoduo_Release_cd290ca9_ARM64.apk
- 2788727d-25a0-41b2-b6b4-265d193edb95.doc
- 基于AVR单片机的伺服电机系统研究
- Lab-Electronic Craft Practicum-2-Simulation of a Single Tube Com
- 贪吃蛇基于TypeScript
- CS-CP1-2C3WF固件
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功