#include "util.h" void wait_100mues(unsigned char Multiplikator) { unsigned char a; unsigned char i; for(a=0;a 850 ){ return( KEY_9 ); } if( val > 750 ){ return( KEY_0 ); } if( val > 650 ){ return( KEY_C ); } if( val > 500 ){ return( KEY_E ); } if( val > 350 ){ return( KEY_DOWN ); } if( val > 150 ){ return( KEY_LEFT ); } if( val > 50 ){ return( KEY_UP ); } return( KEY_RIGHT ); } ADCON = 129; while( ADCON & 256 ){;} val = ADDAT & 0x03ff; if( val >= 950 ){ return( NOKEY ); } if( val > 850 ){ return( KEY_1 ); } if( val > 750 ){ return( KEY_2 ); } if( val > 650 ){ return( KEY_3 ); } if( val > 500 ){ return( KEY_4 ); } if( val > 350 ){ return( KEY_8 ); } if( val > 150 ){ return( KEY_7 ); } if( val > 50 ){ return( KEY_6 ); } return( KEY_5 ); } /* 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. */ unsigned char readkey( void ) { unsigned char val; val = testkey(); if( val == NOKEY ){ return( NOKEY ); } wait_10ms(1); if( (testkey()) != val ){ return( NOKEY ); } wait_10ms(1); if( (testkey()) != val ){ return( NOKEY ); } while(testkey() == val){;} return(val); } void setDaysOfMonth( int month, int year ) { switch( month ) { case 1: THISMDAYS = 31; break; case 2: // if switchyear = 29 if( year == 2004 ){ THISMDAYS = 29; } else { THISMDAYS = 28; } break; case 3: THISMDAYS = 31; break; case 4: THISMDAYS = 30; break; case 5: THISMDAYS = 31; break; case 6: THISMDAYS = 30; break; case 7: THISMDAYS = 31; break; case 8: THISMDAYS = 31; break; case 9: THISMDAYS = 30; break; case 10: THISMDAYS = 31; break; case 11: THISMDAYS = 30; break; case 12: THISMDAYS = 31; break; } }