?? pwm_study.c
字號:
#include <avr/io.h>
#define sbi(x,y) (x|=(1<<y))
#define cbi(x,y) (x&=~(1<<y))
#define uchar unsigned char
#define uint unsigned int
void waitms (unsigned int time) //延時子函數(shù)
{
while(time)time--;
}
int main (void)
{
DDRB=0xff;
PORTB=0Xff;//1111,1111
DDRB=0x00;
PORTB=0Xff;//1111,1111
OCR1B=0x00ff;
OCR1A=0x00ff;
TCCR1A=0Xf2;
TCCR1B=0x19;
TCNT1=0;
ICR1=0x00ff;
while(1)
{
if(OCR1B>=0x00ff)
{
OCR1B=0;
}
OCR1B++;
waitms(15000);
}
return (0);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -