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

📄 tools.h

📁 AVR单片机,STK500下载线制作全套资料,包括程序,电路图
💻 H
字号:
/**
	Autor: Matthias Wei遝r<br>
	Copyright 2005: Matthias Wei遝r<br>
	License: QPL (see license.txt)
*/

#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
#define	LED_GN_OFF	PORTD &= ~(1 << 5)
#define	LED_GN_ON	PORTD |= (1 << 5)

#define	LED_RT_OFF	PORTD &= ~(1 << 6)
#define	LED_RT_ON	PORTD |= (1 << 6)

#define	R_RES_ON	PORTD &= ~(1 << 7)
#define	R_RES_OFF	PORTD |= (1 << 7)
//LED an PORTB 0
//#define		LED_GN_OFF	PORTB&=BIT0_NEG
//#define		LED_GN_ON	PORTB|=BIT0_POS
//#define		LED_GN_TOG	PORTB^=BIT0_POS
//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	PORTB&=BIT1_NEG
//#define		LED_RT_ON	PORTB|=BIT1_POS
//#define		LED_RT_TOG	PORTB^=BIT1_POS
//LED an PORTC 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 + -