clock.h
来自「使用ATTiny26的USBasp,简单AVR编程软件」· C头文件 代码 · 共 46 行
H
46 行
/*
clock.h - part of USBasp
Autor..........: Thomas Fischl <tfischl@gmx.de>
Description....: Provides functions for timing/waiting
Licence........: GNU GPL v2 (see Readme.txt)
Creation Date..: 2005-02-23
Last change....: 2006-11-16
*/
#ifndef __clock_h_included__
#define __clock_h_included__
#define TIMERVALUE TCNT0
//CLOCK_T_320us = 320 *(F_CPU/1000000)/64 = 5*(F_CPU/1000000)
#if F_CPU == 16000000L
# define CLOCK_T_320us 5
# define CLOCK_T_64us 1
# define CLOCK_T_9600us 150
# define CLOCK_T_4800us 75
#else
# error "F_CPU != 16MHz"
#endif
#ifdef __AVR_ATmega8__
#define TCCR0B TCCR0
#endif
#ifdef __AVR_ATtiny26__
#define TCCR0B TCCR0
#endif
#ifndef __ASSEMBLER__
#if F_CPU == 16000000L
/* set prescaler to 1024 */
#define clockInit() TCCR0B = (1 << CS02) | (1 << CS00);
#endif
/* wait time * 64 us */
void clockWait(uint8_t time);
#endif /*__ASSEMBLER__*/
#endif /* __clock_h_included__ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?