| Electronic Components Datasheet Search |
|
MCP402XEV Datasheet(PDF) 36 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
MCP402XEV Datasheet(HTML) 36 Page - Microchip Technology |
|
36 / 46 page ![]() 00066_MCP402XEV.ASM Source Code © 2005 Microchip Technology Inc. DS51546B-page 32 ButtonCheck ; Debounce Buttons btfss PowerDown ; If pulled low, put uC to SLEEP goto LowPowerMode bsf UP_State bsf DOWN_State ; initialize Button_State to indicate no button pressed movlw .50 ; debounce the buttosns for 50mS to see if pressed movwf Exit movlw .40 ; if pushed for 40 of 50 tests, then valid UP movwf DebounceUP movwf DebounceDOWN DebounceLoop call GPIO_TestUP ; make GP1/INCR/UD an input (w/pu enabled) movlw .99 call VAR5TcyDELAY ; 5 + (99*5) = 500us btfss UP decfsz DebounceUP,f goto CheckDOWN bcf UP_State ; UP Button Pressed CheckDOWN call GPIO_TestDOWN ; make GP0/DECR/CS an input (w/pu enabled) movlw .99 call VAR5TcyDELAY ; 5 + (99*5) = 500us btfss DOWN decfsz DebounceDOWN,f goto DebounceLoopTest bcf DOWN_State ; DOWN Button Pressed DebounceLoopTest decfsz Exit,f goto DebounceLoop call InitGPIO ; make GP0/DECR/CS & GP1/INCR/UD outputs, block undesired U/D commands movf State,w call DetermineState ; subroutine to determine the next state movwf State xorwf OldState,w btfss STATUS,Z call PerformState ;State changed, now do something movlw .5 call VAR1000TcyDELAY ; Make sure EE Write Cycle has finished movf State,w movwf OldState goto ButtonCheck ; Loop for button presses ;*********************************************************************************************** ; State Machine Code ;*********************************************************************************************** State0 goto StateMachineReset ; State 0, no action, shouldn’t get here State1 ; UP button pressed movlw .200 ; 200x10mS = 2s movwf Exit TABLE E-1: 00066_MCP402XEV.ASM SOURCE CODE (CONTINUED) |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |