On a keyboard,a key include 4 letters ,likes '1','A','B','C' being input in different time by a key.I use Timer0 interrupt service routine as a keyboard_scaning , which interval is 50ms and a valid char will be scaned two times.and i use Timer1 as delay_counter .for example,scaning '1' Key the first time by T0_isr,key_temp is '1',release '1' key and closed immediately ,just the same key be scaned the second time,key_temp is 'A'.when the key release ,Timer1 is enabled.the T1_isr will give a valid Key 'A' to main program after the delay_time.It is clearly a delay_time between key_releasing to Timer1 flowing to ensure the Key 'A' is valid. In the other words ,every Key must wait for delay_time when input. and now ,I want not to waiting the delay_time if the next closed Key is not the same previous Key,how can cancel delay_time between two different Keys? Can you tell me how to do ?Have any source code for example? Best regards, Nantiangumo
keyboard_scaning , which interval is 50ms I use 10 milliseconds Typically the long periods between scanning the keys is due to fully scanning them every time which eat up a lot of processing time. The "trick" is to do the timer isr this way px = all columns enabled if (.....) some column active { ... do a full scan } else { key = 0 } get out of ISR This way any significant time is only eaten when a key is actually pressed You do, of course, process the variable "key" somewhere in the main. Erik
This may be of interest: http://www.programmersheaven.com/zone5/cat27/35789.htm