Interrupt On both (Rising and Falling)


Results 1 to 10 of 10

Threaded View

  1. #5


    Did you find this post helpful? Yes | No

    Default My car has unknown problem!!

    Thanks alot dear Acetronics.
    I wrote this simple program for testing portB change interrupt.

    '************************************************* ****************
    '* LCD Deifnes *
    '************************************************* ****************

    DEFINE LCD_DREG PORTD ' I/O port where LCD is connected
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTD
    DEFINE LCD_RSBIT 2 ' Register select pin
    DEFINE LCD_EREG PORTD
    DEFINE LCD_EBIT 3 ' Enable pin
    DEFINE LCD_BITS 4 ' 4-bit data bus
    DEFINE LCD_LINES 2 ' LCD has 2 character lines

    '************************************************* ****************
    '* Interrupt Initialzing *
    '************************************************* ****************

    INTCON = %10001000 ' GIE and RBIE are set
    OPTION_REG = %10000000

    '************************************************* ****************
    '* Initialzation *
    '************************************************* ****************

    TRISB = %00010000
    PORTB = 0

    ON INTERRUPT GOTO DIRECTION

    '************************************************* ****************
    '* Main Program *
    '************************************************* ****************

    MAIN:
    lcdout $fe,1
    lcdout "Main Routine"
    pause 500
    GOTO MAIN
    END

    '************************************************* ****************
    '* Interrupt Service Routine *
    '************************************************* ****************

    DISABLE
    DIRECTION:
    lcdout $fe,1
    lcdout "Interrupt !!!"
    PAUSE 100
    INTCON.0 = 0
    RESUME
    ENABLE

    I compiled it and downloaded HEX file to PIC. I use PROTEUS 6 pro for simulating my program.(My Circuit Attached) When I pushed start debugging button on
    proteus an unusual thing happened. I think that program should work in main loop so "Main Routine" should be written on LCD! But as soon as program starts
    executing, the message "Interrupt !!!" is shown on LCD!! even if the push button isn't pressed. Why it does not work correct?!!

    You wrote for me: "... in a word, you have to READ PortB in your interrupt stubb to get it that interrupt working properly ( see examples given ...)" What do you maen? Could you tell me about given examples?
    ** Although I use PIC16F877 in this simulator, I want to use PIC16F84 in my project. **
    Attached Images Attached Images  

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