The Edge Select bits are located in the INTCON2 register of the 4550.
They are Rising edge by default, so for INT1 Falling edge...<br>Code:INCON2.5 = 0 ; External INT1 on Falling edge
The Edge Select bits are located in the INTCON2 register of the 4550.
They are Rising edge by default, so for INT1 Falling edge...<br>Code:INCON2.5 = 0 ; External INT1 on Falling edge
DT
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
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
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.
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
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
Bookmarks