void main (void) { .......... ........ Hier wird ein tastenbedienfeld aus einer bmp - hex geladen. ........ Und wenn ich über mein touch - panel eine taste betätige ........ soll diese für die Zeit wo gedrückt wird invertiert werden. .......... set_addr_ptr(0x0000); LCD_CMD = 0b10110001; //Set DATA Auto Read lcd_send_cmd(); read_data = lcd_get_data_auto(); lcd_status_read_loop(0x03); //check STA0 + 1 LCD_CMD = 0b10110010; //Reset Auto mode lcd_send_cmd(); lcd_status_read_loop(0x03); //check STA0 + 1 ........... ........ später wird der Inhalt von read_data an Addr. 0x0000 ausgegeben. ........ Es wird aber immer der wert 0x00 angezeigt ........... } // ##################################################################################### // # # // # get 1byte in automode # // # it's necassary to use the statusmask 0x04 - it's the only difference to the // # "unsigned char lcd_get_data(void)" function, tested 23.12.2006 // # # // ##################################################################################### unsigned char lcd_get_data_auto(void) { lcd_status_read_loop(0x04); //Check for automode data read capability unsigned char temp_var = 0x00; DATA_DIR_IN(); //DATA_PORT is input LCD_DATA = 0x00; //guaranty that the pull-ups are turned off LCD_WR_H(); //guaranty that ~WR is high LCD_CD_L(); //set C~D low (data enable) LCD_RD_L(); //set ~RD low LCD_CE_L(); //set ~CS low asm volatile ("nop"::); //timingstuff temp_var = LCD_READ; //data from dataport to temp_var LCD_CE_H(); //set ~CS to high LCD_RD_H(); //set ~WR to high asm volatile ("nop"::); //timingstuff LCD_CD_H(); //set C~D high return temp_var; } // ##################################################################################### // # # // # status read, rotate if the status doesn't compare to the mask, tested 23.12.2006 // # # // ##################################################################################### void lcd_status_read_loop(unsigned char status_mask) { unsigned char temp_var = 0x00; //latch for statusword LCD_WRITE = 0x00; //guaranty that pullups are low DATA_DIR_IN(); //portb is input - it looks for status word from display LCD_CTRL |= ( (1 << LCD_CD) | (1 << LCD_WR) ); //guaranty that C~D and ~WR are high asm volatile ("nop"::); //not necassary do //one run is minimum { LCD_CTRL &= ~(1 << LCD_RD); //read enable LCD_CTRL &= ~(1 << LCD_CE); //trigger status output asm volatile ("nop"::); //timingstuff temp_var = LCD_READ; //statusword to the 'latch' asm volatile ("nop"::); //timingstuff LCD_CTRL |= (1 << LCD_CE); //set ~CS high LCD_CTRL |= (1 << LCD_RD); //disable ~RD }while((temp_var & status_mask) != status_mask); DATA_DIR_OUT(); //dataport is output }