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

📄 clock.h

📁 使用ATTiny26的USBasp,简单AVR编程软件
💻 H
字号:
/*
  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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -