#ifndef _util_h_ #define _util_h_ #include #include #include #include /*SERIAL - INITS*/ #define Baud9600 0x40 #define Baud19k2 0x20 #define Baud38k4 0x10 #define Baud57k6 0x0A sbit TxD = P3^10; sbit DTxD = DP3^10; sbit DRxD = DP3^11; extern void init_serial( unsigned int baud ); /* MISC */ extern void wait_100mues(unsigned char Multiplikator); extern void wait_10ms(unsigned char Multiplikator); /*LCD - FUNCS*/ #define CS_LCD 0x080000 #define DIS_IR_W MVAR(unsigned char,CS_LCD + 0x0) #define DIS_DR_W MVAR(unsigned char,CS_LCD + 0x1) #define DIS_IR_R MVAR(unsigned char,CS_LCD + 0x2) #define DIS_DR_R MVAR(unsigned char,CS_LCD + 0x3) #define lcd_ready while((DIS_IR_R & 0x80)!=0) extern void init_lcd(void); extern void lcd_off(void); /* n = 0 no cursor n = 1 with cursor n = 2 with blinking cursor */ extern void lcd_on(unsigned char n); extern void lcd_clear(void); /* sets cursor to position z = 0 .. 3 ( row 1 - 4 ) s = 0 .. 15 ( pos 1 - 16 ) */ extern void lcd_setcursor(unsigned char z, unsigned char s); extern void lcd_putchar(unsigned char zeichen); /* sets cursor to position z = 0 .. 3 ( row 1 - 4 ) s = 0 .. 15 ( pos 1 - 16 ) and then sets text a */ extern void lcd_puts(unsigned char z, unsigned char s, char *a); /* key-input */ extern unsigned char testkey( void ); /* reads keyinput. if a key is pressed, tests ist for three times, with a difference of 10 ms between every test. If same key pressed after this tests, function waits till key is released, then it returns the key. Otherwise 0 is returned. */ extern unsigned char readkey( void ); extern void setDaysOfMonth( int month, int year ); #define NOKEY 0 #define KEY_UP 'U' #define KEY_DOWN 'D' #define KEY_LEFT 'L' #define KEY_RIGHT 'R' #define KEY_0 '0' #define KEY_1 '1' #define KEY_2 '2' #define KEY_3 '3' #define KEY_4 '4' #define KEY_5 '5' #define KEY_6 '6' #define KEY_7 '7' #define KEY_8 '8' #define KEY_9 '9' #define KEY_E 'E' #define KEY_C 'C' #endif