⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 init.c

📁 一个AVR单片机at17c85的系统程序
💻 C
字号:
// init.c

#include "at17c.h"
 
void Init(void) {

    // P0 = SDA - bidirectional
    // P1 = SCL - output
    // P2 = SER_EN - output
 
    // P7, P6, P5, P4, P3, P2, P1, P0
    //  O   O   O   O   O   O   O   O
    //  1   1   1   1   1   1   1   1
    DDRB = 0xfc;
    PORTB = 0xfc; // outputs to a 1, inputs have no pull-ups
 
    // port c used to light leds on prototype board
    DDRC = 0xff;
    PORTC = 0x00; // 0 turns leds off ... really should be the other way around
    
    // use pushbutton switches on atstk200 kit to start events
    DDRD = 0x00;
    PORTD |= 0xff;
                                         
    TCCR1A = 0x00; // timer/counter 1 PWM disable
    TCCR1B = 0x00; // timer/counter 1 clock disable
    TCNT1H = 0x00;
    TCNT1L = 0x00; // clear counter

    TCNT0 = 0x00;
    TCCR0 = 0x00; // stop the clock
    TIMSK |= 0x82; // enable timer counter 0 & 1 interrupt on overflow
    

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -