18F1220 and DT Instant Interrupts


Closed Thread
Results 1 to 4 of 4
  1. #1

    Default 18F1220 and DT Instant Interrupts

    I was successful in getting the "Hello World" program to work, but not so lucky with the "Blinky Light" program. The code below causes PORTB.4 to:

    1. Go high on power-up for approximately 1 second.
    2. Go low for a VERY short period of time.
    3. Go high and stay there.

    Observations made w/O.Scope

    TRISA = %00100000
    TRISB = %00000111
    WDTCON = 0
    ADCON0 = %00000000
    ADCON1 = %01111111
    LVDCON = %00000000
    CCP1CON = %00000000
    OSCCON = %01100010
    RCON = %10000010
    EECON1 = %00000100
    INTCON2 = %11000000
    INTCON3 = %01011011
    PIE2 = %00000000
    IPR2 = %00000000
    RCON = %10000000
    T2CON = %00000000
    T3CON = %00000000
    TXSTA = %00000000
    RCSTA = %00000000

    @ __CONFIG _CONFIG1H, _IESO_OFF_1H & _FSCM_OFF_1H & _INTIO2_OSC_1H
    @ __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _BORV_27_2L
    @ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_32K_2H
    @ __CONFIG _CONFIG3H, _MCLRE_OFF_3H
    @ __CONFIG _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _STVR_OFF_4L
    @ __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L
    @ __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
    @ __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L
    @ __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
    @ __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L
    @ __CONFIG _CONFIG7H, _EBTRB_OFF_7H

    LED1 VAR PORTB.4

    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 TMR1_INT, _ToggleLED1, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM

    T1CON = $31 ; Prescaler = 8, TMR1ON
    @ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts

    Main:
    PAUSE 1
    GOTO Main

    '---[TMR1 - interrupt handler]--------------------------------------------------
    ToggleLED1:
    TOGGLE LED1
    @ INT_RETURN

    Why doesn't it blink?

    Thank you for any help.

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


    Did you find this post helpful? Yes | No

    Default

    It could be the ...

    INTCON3 = %01011011

    Which enables both INT1 and INT2, and SET's their Interrupt flags.

    But since there aren't any handlers for those interrupts, the IF bit never gets reset, and the system locks up on Un-Handled interrupts.

    hth,

    ADDED: DT_INTS handles ALL the enable, priority and interrupt flag bits. There's no need to set them manually.
    Last edited by Darrel Taylor; - 30th June 2008 at 04:06. Reason: added:
    DT

  3. #3


    Did you find this post helpful? Yes | No

    Default

    That solved the problem! Thank you Darrell, and thank you for the use of your programs.

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


    Did you find this post helpful? Yes | No

    Thumbs up

    My Pleasure!

    Wait till you've got 6 or 7 different interrupts firing.
    You'll love it even more.
    <br>
    DT

Similar Threads

  1. 18F1220 programming problem
    By jderson in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 26th June 2008, 14:03

Members who have read this thread : 1

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