DT_INTS-14 , Elasped_INT, and 16F87 code not working


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS-14 , Elasped_INT, and 16F87 code not working

    Maybe it's my eyes but I see NO "Gosub StopTimer, or any GOSUB ResetTime" routines. Also you should NOT be using GOSUB's inside an interrupt.
    Dave Purola,
    N8NTA
    EN82fn

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS-14 , Elasped_INT, and 16F87 code not working

    Try WDT_OFF WDT will reset everything if ISR takes too long, at least that's what I read once upon a time.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS-14 , Elasped_INT, and 16F87 code not working

    Hi,
    Also you should NOT be using GOSUB's inside an interrupt.
    This is one of my pet peeves.... I see it being mentioned "all the time" but never ever does anyone give an explanation to why.

    I mean, I CAN see reasons for it not being a good idea but to just generally advising against it is a bit strong IMO.

    One reason for it not being a good idea is, for example, if you're GOSUB'ing a routine (from within the ISR) that you ALSO may be GOSUB'ing from somewhere in your main program loop - if an interrupt occurs while the main program loop is within the subroutine. If that happens the "instance" of the routine that the main program is executing may be "corrupted" by the ISR executing the same piece of code.

    I'm not saying I'm correct here, what I'm asking for it to please explain WHY you should NOT do it. Doing so will help us UNDERSTAND and not just painstakingly follow an advice that we do not understand the reasoning behind.

    /Henrik.

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,643


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS-14 , Elasped_INT, and 16F87 code not working

    the problem is with the stack . core 14 devices have a 8 level hardware stack , 4 levels can be used by pbp leaving 4 for your program. an interrupt will use 1 of these , a gosub in the interrupt uses another .
    its not impossible to do but you need to be mindful of the limitations

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS-14 , Elasped_INT, and 16F87 code not working

    I seem to remember when using pic16F's and interrupt on change you had to read portb to clear a mismatch?

    Code:
    dummy = portb
    @ INT_RETURN

  6. #6
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS-14 , Elasped_INT, and 16F87 code not working

    Mark_s, You are correct, But who reads the data sheets anyways? Henrick and Richard, you are both correct, Also there are the extra cycles used up in the stack execution.
    Dave Purola,
    N8NTA
    EN82fn

Similar Threads

  1. Working code but my layman approach uses too much code space
    By Christopher4187 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 14th December 2012, 20:44
  2. Why is this code not working(pwm on a 16f628a)
    By Bigandrewgold in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 4th May 2012, 08:56
  3. My LCD code is not working...
    By kvrajasekar in forum mel PIC BASIC
    Replies: 2
    Last Post: - 7th December 2008, 05:41
  4. Bootloader for 16f87/88 that doesn't use UART
    By bcd in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 18th January 2008, 17:35
  5. 16f87 ADC compiler error
    By DhesanR in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th January 2008, 23:43

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