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

📄 tools.h

📁 基于MEGA8单片机的AVR单片机STK500编程器源代码(GCC编译器),改软件完全实现ATMEL STK500协议
💻 H
字号:


#ifndef TOOLS_H_INCLUDED
#define TOOLS_H_INCLUDED

#define		TRUE		1
#define		FALSE		0

//F黵s Bit setzen und l鰏chen
#define		BIT0_POS	(1<<0)
#define		BIT1_POS	(1<<1)
#define		BIT2_POS	(1<<2)
#define		BIT3_POS	(1<<3)
#define		BIT4_POS	(1<<4)
#define		BIT5_POS	(1<<5)
#define		BIT6_POS	(1<<6)
#define		BIT7_POS	(1<<7)

#define		BIT0_NEG	((unsigned char)(~(1<<0)))
#define		BIT1_NEG	((unsigned char)(~(1<<1)))
#define		BIT2_NEG	((unsigned char)(~(1<<2)))
#define		BIT3_NEG	((unsigned char)(~(1<<3)))
#define		BIT4_NEG	((unsigned char)(~(1<<4)))
#define		BIT5_NEG	((unsigned char)(~(1<<5)))
#define		BIT6_NEG	((unsigned char)(~(1<<6)))
#define		BIT7_NEG	((unsigned char)(~(1<<7)))
/*
//Hardware-Interface
//LED an PORTB 0
#define		LED_GN_OFF	PORTB&=BIT2_NEG
#define		LED_GN_ON	PORTB|=BIT2_POS
#define		LED_GN_TOG	PORTB^=BIT2_POS
//LED an PORTB 1
#define		LED_RT_OFF	PORTB&=BIT1_NEG
#define		LED_RT_ON	PORTB|=BIT1_POS
#define		LED_RT_TOG	PORTB^=BIT1_POS
//Reset f黵 Remote-AVR
//#define		R_RES_ON	{PORTB&=BIT2_NEG;DDRB|=BIT2_POS;}
//#define		R_RES_OFF	{DDRB&=BIT2_NEG;PORTB|=BIT2_POS;}
#define		R_RES_ON	PORTB&=BIT0_NEG
#define		R_RES_OFF	PORTB|=BIT0_POS
*/

//Hardware-Interface
//LED an PORTC 0
#define		LED_GN_OFF	PORTC&=BIT0_NEG
#define		LED_GN_ON	PORTC|=BIT0_POS
#define		LED_GN_TOG	PORTC^=BIT0_POS
//LED an PORTB 1
#define		LED_RT_OFF	PORTC&=BIT1_NEG
#define		LED_RT_ON	PORTC|=BIT1_POS
#define		LED_RT_TOG	PORTC^=BIT1_POS
//Reset f黵 Remote-AVR
//#define		R_RES_ON	{PORTB&=BIT2_NEG;DDRB|=BIT2_POS;}
//#define		R_RES_OFF	{DDRB&=BIT2_NEG;PORTB|=BIT2_POS;}
#define		R_RES_ON	PORTB&=BIT2_NEG
#define		R_RES_OFF	PORTB|=BIT2_POS

//Set Device Daten
typedef struct
  {
    unsigned char devicecode;
    unsigned char revision;
    unsigned char progtype;
    unsigned char parmode;
    unsigned char polling;
    unsigned char selftimed;
    unsigned char lockbytes;
    unsigned char fusebytes;
    unsigned char flashpollval1;
    unsigned char flashpollval2;
    unsigned char eeprompollval1;
    unsigned char eeprompollval2;
    unsigned int  pagesize;
    unsigned int  eepromsize;
    unsigned long flashsize;
    unsigned char commandsize;
    unsigned char eeprompagesize;
    unsigned char signalpagel;
    unsigned char signalbs2;
    unsigned char resetdisable;
  }
avr_device;

//Prototypen aus tools.c
unsigned char get_t1_tick(void);
void wait_ms(unsigned int n);

#endif

⌨️ 快捷键说明

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