Problems with instant interrupts from DT for pic18


+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2006
    Posts
    9

    Default Problems with instant interrupts from DT for pic18

    Hello,Darrel,

    I try Your example code for interrupt testing:

    ; Initialize your Hardware and LCD first
    define osc 8


    INCLUDE "DT_INTS-18.pbp" ; Base Interrupt System
    INCLUDE "ReEnterPBP-18.pbp" ; Include if using PBP interrupts
    'INCLUDE "Elapsed_INT-18.bas" ; Elapsed Timer Routines
    LED1 VAR portd.6'pin29 PORTB.1
    LED2 VAR portd.7'pin30 PORTB.2
    trisd=0
    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    ; INT_Handler INT_INT, _ToggleLED1, PBP, yes
    INT_Handler TMR0_INT, _ToggleLED2, PBP, yes
    ; INT_Handler TMR1_INT, _ClockCount, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM

    T0CON = %10010010 ; T0 = 16-bit, Prescaler 8
    '@ INT_ENABLE INT_INT ; enable external (INT) interrupts
    @ INT_ENABLE TMR0_INT ; enable Timer 0 interrupts
    '@ INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts

    'GOSUB ResetTime ; Reset Time to 0d-00:00:00.00
    'GOSUB StartTimer ; Start the Elapsed Timer

    Main:
    ' IF SecondsChanged = 1 THEN
    ' SecondsChanged = 0
    ' LCDOUT $FE,$C0, DEC Days,"d-",DEC2 Hours,":",DEC2 Minutes,":",DEC2 Seconds
    ' ENDIF
    pause 2000'2 sec
    toggle led1
    GOTO Main

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

    ;---[TMR0 - interrupt handler]-------------------------------(Blinky Light)------
    ToggleLED2:
    TOGGLE LED2
    @ INT_RETURN

    end

    1. It is Your code with small corrections
    When I used "pause 2000" and only one int (toggle led2) and try to toggle
    led1 in main program for control main loop, led2 toggled ok (0,5 sec period), but led1 not toggled.
    When I used pause 2(2 ms) result is : led1 not toggled in main loop.
    I used pic18f4580 8 mHz and microcode studio2.3.00, pbp2.46

    2.When I try to compile this code , I have error: "ReEnterPBP-18.pbp"
    "Elapsed_INT-18.bas" not found. When I change BAS to PBP it is OK.
    Why?
    Please, help.

    3.And when I disabled all interrupts and try only main loop - led1 in main loop is toggled OK!!!!
    (2 sec period)
    I think, this is the bug in soft, because pause 2000 - 2 sec pause is interrupted by
    INT_Handler TMR0_INT and main loop not worked ok (return address not ok?).


    dipdip
    Thanks
    Last edited by dip1; - 31st October 2006 at 23:08.

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

    Default

    I compiled and ran your modification on an 18F452, and everything was fine.

    Except that it was running at the wrong speed because the "osc" wasn't capitalized. changed it to...

    DEFINE OSC 8

    2.When I try to compile this code , I have error: "ReEnterPBP-18.pbp"
    "Elapsed_INT-18.bas" not found. When I change BAS to PBP it is OK.
    Why?
    Please, help.
    Browsers and webservers don't like files with a .bas extension, so on the website they are given a .txt extension to allow easy download. It's up to you to rename it to something usable such as .bas or .pbp. Then you have to use the same extention in your INCLUDE statements.
    DT

Similar Threads

  1. V 2.60 and DT Instant Interrupts?
    By jderson in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 22nd July 2009, 06:48
  2. DT Instant Interrupts
    By krohtech in forum mel PIC BASIC Pro
    Replies: 38
    Last Post: - 25th February 2009, 16:33
  3. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 21:02
  4. 12F683 and DT Instant Interrupts
    By jderson in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 22nd November 2008, 13:47
  5. 18F1220 and DT Instant Interrupts
    By jderson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th June 2008, 05:37

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