Interrupt On both (Rising and Falling)


Results 1 to 10 of 10

Threaded View

  1. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Thumbs down

    Yasser,

    You're a bad student !!!

    What did I tell you about " mismatch condition " ???

    Code:
    	STATE 	var Byte
    	I 		var Byte
    	 	 
    	PORTA = 0
    	PORTB = 0
    '************************************************* ****************
    '* Interrupt Initialzing *
    '************************************************* **************** 
    
    INTCON     = %10001000 ' GIE and RBIE are set
    OPTION_REG = %10000000
    
    '************************************************* ****************
    '* Initialzation *
    '************************************************* ****************
    
    PORTB = 0
    TRISB = %00010000
    
    ON INTERRUPT GOTO DIRECTION
    
    '************************************************* ****************
    '* Main Program *
    '************************************************* ****************
    
    MAIN:
    
    lcdout $fe,1,"Main Routine"
    
    FOR I = 1 to 50 : PAUSE 10 : NEXT I ' For quick response
    
    GOTO MAIN
    END
    
    '************************************************* ****************
    '* Interrupt Service Routine *
    '************************************************* ****************
    
    DISABLE
    
    DIRECTION:
    
    STATE = PORTB	' End of Mismatch Condition
    
    lcdout $fe,1
    lcdout "Interrupt !!!"
    
    IF State.4 THEN
    
    	LCDOUT $FE,$C0," LOW to HIGH "
    	
    ELSE
    
    	LCDOUT $FE,$C0, " HIGH to LOW "
    	
    ENDIF
    	
    PAUSE 1000
    
    INTCON.0 = 0
    
    RESUME
    
    ENABLE
    
    END
    That works fine ... for a 16F84 !

    Alain
    Last edited by Acetronics2; - 12th March 2008 at 14:16.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. mS Timer
    By whmeade10 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th September 2020, 12:12
  2. How to set TMRO & TMR3 as Counter?.
    By NatureTech in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 18th May 2007, 08:52
  3. 16F88 Interrupt
    By sskeet in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th January 2006, 15:51
  4. 2 interupts - portb.0 rising and falling edges
    By EDWARD in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th July 2005, 01:10
  5. Interrupts and Disable 16f877
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th April 2005, 21:08

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts