Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    YES!

    It's a little tight for RAM and program space. But it should work.

    DT
    DT

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    One note of interest, I kept hanging at the end of one of the interrupt modules, like it lost an address on the stack or something. I ran ICD and I saw the execution just hang on the ENDIF at the very bottom.

    I have an RX interrupt that would write out to an I2C device 2 bytes received via USART. I removed the I2C command from within the interrupt and instead set a flag. Then I checked the flag from within the main logic and issued the I2C write and everything worked perfectly.

    Darrel, here are some screenshots in case you see something obvious. Sorry, I didn't keep a copy of the code.

    Robert
    Attached Images Attached Images  
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    2nd pic:

    The program USB 18F2550 is for the master processor, that is not the one I am debugging. I am running the next program, MCP23016 16F628A.

    Robert
    Attached Images Attached Images  
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

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


    Did you find this post helpful? Yes | No

    Default

    Interrupts and the MCSP debugger, don't get along together very well.

    You should use DISABLE DEBUG before any interrupt routines, Including the Handlers.

    Then ENABLE DEBUG after them.

    It is possible to save the debugger variables in the same way as ReEnterPBP, but it's a waste of space when not debugging, so I didn't include them

    HTH,
      DT

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    The weird part is that the interrupts and the debugger worked nicely as long as the I2C command was outside the interrupt routine.

    I suppose there are probably exceptions, but disabling/enabling debug in and out of interrupts isn't the end of the world. It's not like we need to debug your work.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

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


    Did you find this post helpful? Yes | No

    Default

    It's kind of like standing on the white line in the middle of a highway.

    Everythings fine for a while, with cars wizzing past at 90mph.

    But take one step to the left or right and, <img src=http://www.darreltaylor.com/files/splash.jpg height=70 width=70 align=top></img>
    DT

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Go like splat ehh...;o}
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  8. #8
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor
    Can DT_INTS-14.bas be used with 12Fxxx PICs?
    YES!

    It's a little tight for RAM and program space. But it should work.
    With a 12F629 my app gets lots of "beyond ram_end" messages; with a 12F683, only two, so I might be able to pare it down to fit.

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


    Did you find this post helpful? Yes | No

    Default

    If you don't have any complex math formula's in the program, you can reduce the number of T?_Save variables.

    From ReEnterPBP.bas...
    T1_Save VAR WORD
    T2_Save VAR WORD
    T3_Save VAR WORD
    T4_Save VAR WORD


    Start with T4. Comment it out and recompile. If no error, try T3, etc.

    Then try ...
    RS1_Save VAR BYTE
    RS2_Save VAR BYTE


    Might save a few bytes of RAM.

    Just remember to un-comment them if you write a program for another chip.

    DT

  10. #10
    Join Date
    May 2006
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    I am trying to use the instant interrupts to add the funnctionality of interrupts to my programs but I am having problems with the example that found on Darryl's site. I was trying to do the example with turning a LED on and off with an external interrupt but I am having some problems. I have downloaded the latest files form Darryl's site and have saved them to same folder. I have copied the code from hiw webpage also.
    I am using PICBASIC Pro vers.2.46
    I am using the PIC16F687.

    I am getting the following errors
    Error TOGGLE~1.ASM 490 : [224] local directive only for use in macros
    Error TOGGLE~1.ASM 490 : [225] undefined symbol 'iflagreg'
    Error TOGGLE~1.ASM 490 : [226] numeric constant or symbol name expected
    Error TOGGLE~1.ASM 490 : [201] ')' expected
    Error TOGGLE~1.ASM 490 : [300] too many errors

    I commented out the Wsave's that were not needed. I have some experiece with writing programs in assembly and working with interrupts. I have looked through the include files to see if I could make sense of what is going on but I am having problems figuring it out.
    Can you direct to anywhere that will give me more information about macros? Any suggestions? Thanks for your time and help.

    Josh

    EDIT
    Looking at the datasheet for the 16F687 there IS an External interrupt on RA2 instead of RB0. There is a Port change interupt on both Port A and B. Do I have to modify the file to include the interrupt on PortA? I would want to place any available interrupt pin that I can.
    Last edited by jblackann; - 31st July 2006 at 17:31.

  11. #11
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Use the MPASM assembler.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  12. #12
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor
    If you don't have any complex math formula's in the program, you can reduce the number of T?_Save variables.
    There's no math but it didn't help. I think I'll have to try to learn enough ASM for this application. I just need TMR0 to toggle a pin every 8-10mS and TMR1 to give me a 500µS or 1000µS interval after each TMR0 rollover.

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


    Did you find this post helpful? Yes | No

    Default

    Hi Josh,

    The INT_INT should work ok, even with it on PORTA.

    For the Interrupt on change with PORTA and PORTB, just add these two lines in the ASM section right before the INT_LIST

    RBIF = RABIF
    RBIE = RABIE
    (no space at the beginning of the line)

    Then use RBC_INT. I'll add RABC_INT, C1_INT and C2_INT names in DT_INTS-14 later, but that should get you going for now.

    HTH,
    &nbsp; Darrel

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


    Did you find this post helpful? Yes | No

    Default

    dhouston,

    For the 12F683...
    Did you comment out the wsave2 and wsave3 variables in DT_INTS-14?

    DT

  15. #15
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor
    For the 12F683...
    Did you comment out the wsave2 and wsave3 variables in DT_INTS-14?
    Not until seeing your question. That seems to do it. It compiles and only uses 593 words so I think it will be OK, now.

    Will the pin change functions work with the 12F683?
    Last edited by dhouston; - 1st August 2006 at 17:16.

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