Can not change variable while using DT_INT?


Closed Thread
Results 1 to 7 of 7

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Can not change variable while using DT_INT?

    User variables are not saved and restored for the interrupts. Only PBP's SYSTEM variables are.

    But PORTB Change Interrupts (RBC_INT) only work on PORTB.4-7 on the 16F887.
    You are testing PORTC pins in the ISR.
    DT

  2. #2
    Join Date
    Mar 2013
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: Can not change variable while using DT_INT?

    Thanks Darrel. I tried this:

    asm
    INT_LIST macro
    INT_Handler RBC_INT, _Change, PBP, yes
    endm
    INT_CREATE
    endasm
    @ INT_ENABLE RBC_INT

    Oscloop:
    high portd.1
    pauseus ontime
    low portd.1
    pauseus offtime
    goto oscloop

    Change:
    portd.0=1
    if portb.4=1 and ontime<1000 then ontime=ontime+1
    if portb.5=1 and ontime>10 then ontime=ontime-1
    if portb.6=1 and offtime<10000 then offtime=offtime+10
    if portb.7=1 and offtime>1210 then offtime=offtime-10
    @ INT_RETURN


    The above works well. The thing is, with the original program, I was triggering the int with a rising edge on portb.0 then sending the necessary change bit over portc.0-3. The timing was generous, portb.0=1 for 100ms (not that this matters as it should have been a rising edge trigger anyway) then which ever ever portc was active was held high for 100ms as well. The timing was verified with a scope, as was entrance into the change routine by the ISR. Why did that not work?

    Thanks again!

Similar Threads

  1. Change a variable to the opposite?
    By Hylan in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 21st June 2012, 07:00
  2. Change variable allocation to save code space
    By aberco in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 5th September 2011, 01:28
  3. Question on DT_INT
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 26th July 2011, 15:04
  4. A little DT_INT confusion.
    By circuitpro in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 20th October 2010, 00:46
  5. Let a variable change from bin to dec.
    By Roy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 25th May 2004, 19:57

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