18F2420, instant interrupts, and TMR0


Results 1 to 8 of 8

Threaded View

  1. #1
    Join Date
    Feb 2008
    Posts
    8

    Unhappy 18F2420, instant interrupts, and TMR0

    i've been working with Darryl's instant interrupts for PWM LED's and they work great! now i'm moving over to work directly with timers with a new-to-me PIC and have hit a wall.

    i've reduced my code down to what i think are the bare essentials and i still don't have blinky. here's the code that compiles:

    @ __CONFIG _CONFIG1H, _OSC_INTIO67_1H
    @ __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOREN_OFF_2L
    @ __CONFIG _CONFIG2H, _WDT_OFF_2H
    @ __CONFIG _CONFIG3H, _MCLRE_ON_3H
    @ __CONFIG _CONFIG4L, _LVP_OFF_4L & _DEBUG_OFF_4L

    define OSC 8
    clear

    CCP1CON=0 'turn off capture and compare module 1
    CCP2CON=0 'turn off capture and compare module 2
    SSPCON1.5=0 'disables SPI and I2C modules on portC
    ADCON1=%00001111 'turns all AD pins to digital and tells module to use Vdd and Vss
    ADCON0.0=0 'disables AD module
    CMCON.0=0 'disables comparator module for portA
    CMCON.1=0 '(ditto)
    CMCON.2=0 '(ditto)
    CVRCON.7=0 'disables comparator voltage reference module for portA

    TRISB=%11101111 'PortB.4 => HB LED pin set to output

    LED1 VAR PORTB.4
    loop var byte

    INCLUDE "DT_INTS-18.bas" ' Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP interrupts

    'lets me know the PIC is doing something after programming
    for loop=1 to 4
    toggle led1
    pause 50
    next loop

    ;-----------------------------------------------------------------------------
    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler TMR0_INT, _ToggleLED1, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM
    ;-----------------------------------------------------------------------------
    T0CON=%10011000 ; TMR0ON, 16-bit, internal clock, high>low, no prescaler
    @ INT_ENABLE TMR0_INT ; enable Timer 0 interrupts
    ;-----------------------------------------------------------------------------
    Main:
    PAUSE 1
    GOTO Main
    '---[TMR1 - interrupt handler]--------------------------------------------------
    ToggleLED1:
    TOGGLE LED1
    @ INT_RETURN


    i've read read read the datasheet and have done many, many searches on this forum to try and find the small thing i'm missing. this is why i'm finally posting here for assistance.
    Last edited by dhickman; - 11th February 2009 at 22:54.

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14
  2. Timer0 Instant Interrupts Question
    By wmarchewka in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th December 2009, 05:29
  3. COUNT is not counting again
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 19th June 2009, 04:52
  4. 16F946 Instant Interrupts problem
    By jderson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th April 2009, 22:20
  5. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 15:10

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