关于ATtiny13A的程序
[复制链接]
可调光手电筒电路及程序如下:
ATTINY13_cn.pdf
(1.56 MB, 下载次数: 635)
2011-12-16 11:05 上传
点击文件名下载附件
#include
#include
//IO--寄存器定义
#define PB0 0 //tiny13第5脚
#define PB1 1 //tiny13第6脚
#define PB2 2 //tiny13第7脚
#define PB3 3 //tiny13第2脚
#define PB4 4 //tiny13第3脚
#define PB5 5 //tiny13第1脚
#define SM0 3
#define SM1 4
#define SE 5
//控制寄存器EECR位名设置
#define EERE 0 //读使能
#define EEPE 1 //编程使能
#define EEMPE 2 //准备好中断使能
#define EERIE 3 //主机编程使能
#define EEPM0 4 //EEPROM编程模式位
#define EEPM1 5 //
//LED亮度基数设置
#define lum3 0xff //亮度1--最亮
#define lum2 0x50 //亮度2
#define lum1 0x10 //亮度3
#define lum0 0x00 //亮度4--关
#define led_dis() (PORTB&=~(1<
#define led_en() (PORTB|=(1<
#define pwm_en() (PORTB&=~(1<
#define pwm_dis() (PORTB|=(1<
unsigned char lum; //亮度
unsigned char count;
unsigned char count1;
bit flag;
bit time_flag;
//==========================================================