Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default

    I set INTCON bit but not working on falling edge.

    Code:
    ' chip PIC18F4550
    DEFINE OSC 48
    INCLUDE "MODEDEFS.BAS"
    include "MYLCD.BAS"
    CMCON = 7
    ADCON1 = 15
    CVRCON = %00000000 'CVref turned off
    
    TRISB = %11111111
    w0 var word
    pause 500
    
    '-------------------------[ INT0 Interrpt setting ] -----------------------------
    INCLUDE "DT_INTS-18.bas"     ; Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas"     ; Include if using PBP interrupts
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    INT0_INT,  _ToggleLED1,   PBP,  yes
            INT_Handler    INT1_INT,  _ToggleLED2,   PBP,  yes                
        endm
        INT_CREATE               ; Creates the interrupt processor
    INCON2.5 = 0  ; External INT1 on Falling edge
    ENDASM
    
    @   INT_ENABLE   INT0_INT     
    @   INT_ENABLE   INT1_INT
    '__________________________________________________________________________________
    
    
    start:  lcdout $fe,1
            lcdout "count = ",dec5 w0
            pause 200
            goto start
    
    
    
    ToggleLED1:
                w0 = w0+1
                @ INT_RETURN
                
    ToggleLED2:            
                 w0 = w0+1
                @ INT_RETURN

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    It's a regular PBP statement, but it's in an ASM block.

    Move it outside the block and it should work better.
    <br>
    DT

  3. #3
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default

    Syntex error

    Ohh. Sory sir, I cut yout code and paste, I don't see there are INCON

    Thanks sir, It's Working
    Last edited by precision; - 25th July 2007 at 12:22.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Oops!
    <br>
    DT

  5. #5
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92


    Did you find this post helpful? Yes | No

    Smile Multiple measurements with Instant Interrupts.

    Hi Darrel,

    some days ago, I was trying to measure the "ON time" of my car´s gasoline injectors (one of the 4)

    I´m using a 16F877 @ 10 Mhz, and I´m using the Timer0 as a 250 ms counter and Timer1 as a pulse counter, I ran out of possibilities of new measurements.

    Bruce told me that I should use a new device with more timers available, like the 18F4431 (or similar).
    The problem is : This device (or similar) is not available here in Brazil, and Microchip do not send samples to Brazil.

    I was reading this post about the interrupts and decided to ask :

    Is that possible to read the pulses on Timer1 on a fixed time interval (so, I would have the car´s speed and the mileage) and measure the injector on-time (so I would have the consumption) with the instat interrupts running on a 16f877 ?

    Thanks !

    Sergio

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Sure you can.

    I'd use the Capture mode of the CCP modules using Timer1, for the ON time.

    Timer 2 can be the timebase used to count the speedometer pulses on the INT (external interrupt) pin.

    And the same signal from the Injector can be fed to T0CKI, so Timer 0 can count the RPM's too.

    Speed, Distance, Consumption and Tachometer.
    <br>
    DT

  7. #7
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    Wow !

    thank you !

    I´ll try it this weekend and post the results here !

    Bye !

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  2. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 20:02
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  4. Keypad and DT's Instant Interrupts
    By Homerclese in forum General
    Replies: 11
    Last Post: - 27th April 2007, 06:32
  5. Replies: 1
    Last Post: - 1st November 2006, 03:11

Members who have read this thread : 6

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

Tags for this Thread

Posting Permissions

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