#include #include #include #include #include #include #include #include #include /*für exit*/ #include #include #ifndef ___GLOBAL_H #define ___GLOBAL_H //Attention: //Some of these definitions are only for //used board with a freq. of 16, 14,7456, 11,0592 Mhz external, //or 1, 2, 4, or 8 Mhz internal clock. // 16 Mhz ext. Tact // 1 CPU Clock = 0,0000000625 Sec. // 1 Microsec = 16 clocks // 100 Microsecs = 1.600 clocks // 1 Millisec = 16.000 clocks // 14,745600 Mhz ext. Tact // 1 CPU Clock = 0,00000006781684 Sec. // 1 Microsec = 14,7456 clocks // 100 Microsecs = 1.474,56 clocks // 1 Millisec = 14.745,6 clocks // 11,0592 Mhz ext. Tact // 1 CPU Clock = 0,000000090422453703704 Sec. // 1 Microsec = 11,0592 clocks // 100 Microsecs = 1.105,92 clocks // 1 Millisec = 11.0592,2 clocks // 8 Mhz int./ext. Tact // 1 CPU Clock = 0,000000125 Sec. // 1 Microsec = 8 clocks // 100 Microsecs = 800 clocks // 1 Millisec = 8000 clocks // 4 Mhz int./ext. Tact // 1 CPU Clock = 0,00000025 Sec. // 1 Microsec = 4 clocks // 100 Microsecs = 400 clocks // 1 Millisec = 4000 clocks // 2 Mhz int./ext. Tact // 1 CPU Clock = 0,0000005 Sec. // 1 Microsec = 2 clocks // 100 Microsecs = 200 clocks // 1 Millisec = 2000 clocks // 1 Mhz int./ext. Tact // 1 CPU Clock = 0,000001 Sec. // 1 Microsec = 1 clocks // 100 Microsecs = 100 clocks // 1 Millisec = 1000 clocks #ifdef FCPU1 #define F_CPU 1000000UL /* 1,0 Mhz norm. internal*/ #endif #ifdef FCPU2 #define F_CPU 2000000UL /* 2,0 Mhz norm. internal*/ #endif #ifdef FCPU4 #define F_CPU 4000000UL /* 4,0 Mhz norm. internal*/ #endif #ifdef FCPU8 #define F_CPU 8000000UL /* 8,0 Mhz norm. internal*/ #endif #ifdef FCPU11 #define F_CPU 11059200L /* 11,0592 Mhz external quarz*/ #endif #ifdef FCPU14 #define F_CPU 14745600UL /* 14,7456Mhz external quarz*/ #endif #ifdef FCPU16 #define F_CPU 16000000UL /* 16,0 Mhz external quazr*/ #endif #ifndef F_CPU #define F_CPU 1000000UL #define FCPU1 #endif #define EEPROM_SIZE (E2END+1) //this uses one CPU Clock #define NOP asm volatile ("nop" ::) //usefull delays for io-operations //( black/green lcd with KS0070B controller //(HD44780 compatible) //avoids a minimum enable pulse width of 220 ns ) //is this does not func, use a value near 300ns instead. #ifdef FCPU1 //exactly 1000 ns #define DELAY1us { NOP;} #endif #ifdef FCPU2 //exactly 500 ns #define DELAY500ns { NOP;} //exactly 1000 ns #define DELAY1us { NOP;NOP;} #endif #ifdef FCPU4 //exactly 250 ns #define DELAY250ns { NOP;} //exactly 500 ns #define DELAY500ns { NOP;NOP;} //exactly 1000 ns #define DELAY1us { NOP;NOP;NOP;NOP;} #endif #ifdef FCPU8 //exactly 250 ns #define DELAY250ns { NOP;NOP;} //exactly 375 ns #define DELAY375ns { NOP;NOP;NOP;} //exactly 500 ns #define DELAY500ns { NOP;NOP;NOP;NOP;} //exactly 875 ns #define DELAY875ns { NOP;NOP;NOP;NOP;NOP;NOP;NOP;} //exactly 1000 ns #define DELAY1us { NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;} #endif #ifdef FCPU11 //exactly 271,267361111.... ns #define DELAY271ns { NOP;NOP;NOP;} //exactly 361,6898148148... ns #define DELAY361ns { NOP;NOP;NOP;NOP;} //exactly 542,53472222222.. ns #define DELAY542ns { NOP;NOP;NOP;NOP;NOP;NOP;} //exactly 994,64699074074.. ns #define DELAY994ns { NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;} //exactly 1085,0694444444.. ns #define DELAY1us { NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;} #endif #ifdef FCPU14 //exactly 271,26736 ns #define DELAY271ns { NOP;NOP;NOP;NOP;} //exactly 339,0842 ns #define DELAY339ns { NOP;NOP;NOP;NOP;NOP;} //exactly 542,53472 ns #define DELAY542ns { NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;} //exactly 949,43576 ns #define DELAY949ns { NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;} //exactly 1017,2526 ns #define DELAY1us { NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;} #endif #ifdef FCPU16 //exactly 250 ns #define DELAY250ns { NOP;NOP;NOP;NOP;} //exactly 375 ns #define DELAY375ns { NOP;NOP;NOP;NOP;NOP;NOP;} //exactly 875 ns #define DELAY500ns { NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;} //exactly 937,5 ns #define DELAY937ns { NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;} //exactly 1000 ns #define DELAY1us { NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;} #define LCD #endif typedef unsigned char BYTE; typedef unsigned short WORD; typedef unsigned long DWORD; typedef unsigned short USHORT; typedef unsigned char BOOL; typedef unsigned char UCHAR; typedef unsigned int UINT; typedef unsigned long ULONG; typedef char CHAR; typedef int INT; typedef long LONG; #define BCD8 unsigned char #define BCD16 unsigned int #ifndef NULL #define NULL 0 #endif #endif