Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Your code compiles here without errors. PBP 2.60A
    http://www.scalerobotics.com

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default

    DT-INTS version 1.00 or 1.10?

    Ioannis

  3. #3
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by scalerobotics View Post
    Your code compiles here without errors. PBP 2.60A
    To be clearer, your code in post 609 compiles using the code shown. I had not tried it with the IOC_INT, only with the code listed in post 609. I guess you meant that when you changed it to IOC, you got the errors.....

    Sorry

    Walter
    http://www.scalerobotics.com

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default

    Thanks all for the support.

    Al.: We are testing the new DT-INTs version 1.10. Here as Darrel pointed out the wsave are set in the main program.

    Darrel: You are correct in the Port change Interrupts. Ok, I have them corrected and the two errors went away. But no joy on Interrupts. It seems that they are never triggered.

    The latest test code is this:

    Code:
    DEFINE OSC 4
    
    @Line1 = _DEBUG_OFF & _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_OFF
    @Line2 = _CP_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_ON & _XT_OSC
    
    @ __CONFIG _CONFIG1, Line1 & Line2
    
    @ __CONFIG _CONFIG2, _WRT_HALF & _BOR40V
    
    OPTION_REG.0=1		'PSA0 PRESCALER SELECT 1:1 TO 1:256
    OPTION_REG.1=1		'PSA1
    OPTION_REG.2=1		'PSA2
    OPTION_REG.3=1		'PRESCALER TO: 1->WDT, 0->TMR0
    OPTION_REG.4=0		'T0SE SOURCE EDGE 1->H TO L, 0->L TO H
    OPTION_REG.5=0		'T0CS 1->FROM RA4, 0->FROM INT. CLOCK
    OPTION_REG.6=0		'INT EDGE SELECT 0->H TO L, 1->L TO H
    OPTION_REG.7=0		'PULL UP 1->DISABLE, 0->ENABLE
    
    adcon0=%01000000    '0 off
    adcon1=$80'6 off (all digitals)
    ansel=$01
    anselh=$00
    
    PORTA=%00000001:PORTB=%00010000:PORTC=%10000001:PORTD=0:PORTE=0
    
    TRISC=$80:TRISD=0:TRISE=0
    
    TRISA = %00000001
    
    TRISB = %00010000
    
    wsave   VAR BYTE    $20     SYSTEM      ' location for W if in bank0
    ;wsave   VAR BYTE    $70     SYSTEM      ' alternate save location for W 
                                             ' if using $70, comment wsave1-3
    clear
    INCLUDE "c:\projects\picdem2\DT_INTS-14.bas"
    INCLUDE "c:\projects\picdem2\ReEnterPBP.bas"
    
    '-------------   VARIABLES   ---------------------
    
    code_in             var portb.4
    
    '-------------   VARIABLES   ----------------------
    
    t1con=%00000000         '65,535ms interrupt time base
    
    clear
    goto main
    
    '-------------   INTERRUPTS SETUP   ---------------------
    
    IOCB=%00010000          'Enable IOC on PortB.4
    WPUB=%00010000          'Enable weak pull up on PortB.4
    
    ASM
    INT_LIST  macro;    IntSource,  Label,      Type,  ResetFlag?
        INT_Handler     RBC_INT,    _IOC2,      PBP,    yes
        endm
        INT_CREATE            ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE  RBC_INT      ; Enable Port B on change
    
    '-------------   INTERRUPTS SETUP   ---------------------
    
    IOC2:
        if code_in then
            high portb.0
        else
            low portb.0
        endif
    @ INT_RETURN
    
    
    main:
    while 1
    toggle portb.2
    pause 100
    wend
    
    End
    Ioannis

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


    Did you find this post helpful? Yes | No

    Default

    Ioannis,

    Remove the second CLEAR statement, and move the GOTO Main after the interrupt declaration, just before the IOC2: handler.

    The interrupt declaration and the IOCB/WPUB must be allowed to execute.
    DT

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel.

    Well, with 3 toddlers running around till 10.30 pm sure I will have double CLEAR commands to clear my mind!

    OK I moved the IOCB/WPUB before GOTO main but still no Interrupts occur.

    In fact is second or third try with different controller that I cannot make an interrupt on change to work... Not lucky I guess.

    The latest test code is this:

    Code:
    t1con=%00000000         '65,535ms interrupt time base
    IOCB=%00010000          'Enable IOC on PortB.4
    WPUB=%00010000          'Enable weak pull up on PortB.4
    
    goto main
    
    '-------------   INTERRUPTS SETUP   ---------------------
    ASM
    INT_LIST  macro;    IntSource,  Label,      Type,  ResetFlag?
        INT_Handler     RBC_INT,    _IOC2,      PBP,    yes
        endm
        INT_CREATE            ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE  RBC_INT      ; Enable Port B on change
    '-------------   INTERRUPTS SETUP   ---------------------
    
    IOC2:
        high portb.1
        if portb.4 then
            high portb.0
        else
            low portb.0
        endif
    @ INT_RETURN
    
    
    main:
    while 1
        toggle portb.2
        pause 1000
    wend
    Thanks for the efforts.

    Ioannis

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default

    OK. I got it. Was the goto main before Interrupt setup.

    Sorry for my careless... A cupof coffee did the job!

    Ioannis

  8. #8
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    I'm needing to use DIV32 in my program, this from the compiler manual...

    "...blah, blah, blah...........ON INTERRUPT must be
    DISABLEd from before the multiply until after the DIV32. If ON
    INTERRUPT is not used, there is no need to add DISABLE to the
    program. Interrupts in assembler should have no effect on the internal
    variables so they may be used without regard to DIV32."


    Now I'm blissfully unaware how DT's interrupts work 'under the hood' ...so could someone put a layman's spin on whether DT's interrupts are "interrupts in Assembler" (& therefore whether I'm free to use DIV32or not?)

    Thanks.

Similar Threads

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

Members who have read this thread : 4

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