?? pwm.c
字號:
//PWM.c : source file for the PWM project
//
#include "PWM.h"
#include "PWMADC.h"
#include "PWMTimer.h"
/////////////////////////////////////////////////////////////////////////////
//PWM
static void io_init(void)
{
//{{WIZARD_MAP(General)
//}}WIZARD_MAP(General)
//{{WIZARD_MAP(I/O Ports)
// PortB
PORTB = 0x0;
DDRB = 0x0;
// PortC
PORTC = 0x0;
DDRC = 0x0;
// PortD
PORTD = 0x0;
DDRD = 0x0;
//}}WIZARD_MAP(I/O Ports)
//{{WIZARD_MAP(Watchdog)
// Watchdog Enabled, Prescaler: OSC/16k
wdt_enable(WDTO_15MS);
//}}WIZARD_MAP(Watchdog)
//{{WIZARD_MAP(Analog Comparator)
// Analog Comparator Disabled
ACSR = 0x80;
//}}WIZARD_MAP(Analog Comparator)
}
static void reset_checking(void)
{
if (MCUCSR & BV(PORF))
{ // Power-on Reset
}
else if (MCUCSR & BV(EXTRF))
{ // External Reset
}
else if (MCUCSR & BV(WDRF))
{ // Watchdog Reset
}
MCUCSR &= 0xE0;
}
int main(void)
{
// Reset source checking
reset_checking();
//{{WIZARD_MAP(Initialization)
io_init();
adc_init();
timers_init();
//}}WIZARD_MAP(Initialization)
// TODO: Add extra initialization here
//{{WIZARD_MAP(Global interrupt)
sei();
//}}WIZARD_MAP(Global interrupt)
while(1)
{
// TODO: Add your code here
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -