ms744l3.txt ;************************************************************************************************ ; LISTING 3 - SUBROUTINE FOR PSEUDO TIMER/COUNTER DEBOUNCING CODE ; ; "Interfacing switches and relays to the real world in real time," EDN, June 7, 2001, pg 135 ; ; http://www.ednmag.com/ednmag/reg/2001/060701/13ms744.htm ;************************************************************************************************ Debouncing Time/Counter Subroutine 1 DB_Check_Port: Read Port Data 2 Store Port_Data in Port1 3 Compare Port1 with Port_P, (EX-OR Port1 with Port_P) 4 Test for Bit Changes, (No) Return from Check_Port subroutine, (Yes) continue 5 Store 50ms_Count in Counter 6 DB_TMR: Decrement Counter by 1 7 Test Counter = 0, (No) goto DB_TMR, (Yes) continue 8 Store Port_Data in Port_P 9 {do some thing with the new port data} 10 Return from Check_Port subroutine with new Port_P data for main program