Instant interrupts in Basic?


Closed Thread
Results 1 to 2 of 2
  1. #1
    Bulman's Avatar
    Bulman Guest

    Default Instant interrupts in Basic?

    Hi.
    How do you write your instant interrupts? When the desired code for the interrupt is too complex to write in ASM, I've to write in Basic. But I dont like the software /pseudo/ interrupts.
    Last edited by Bulman; - 6th January 2006 at 07:50.

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


    Did you find this post helpful? Yes | No

    Default

    Bulman, First you need to locate the instant interrupt routines written by Tim Box and then place these lines before any other lines in your code:

    INCLUDE "INT_CTRL-18F.inc" ' Interrupt Control routines
    DEFINE TMR1_FREQ 100
    DEFINE TMR1_HANDLER _TIMR1

    Then before your main code segment, insert the interrupt routine's. Here is an example of a simple one using a 100 Hz. interrupt to set some pacing counters.
    '************************************************* ********************
    'INTERRUPT SERVICE ROUTINE FOR TIMER 1
    '************************************************* ********************
    TIMR1:
    LOOPCNTR = LOOPCNTR + 1 'INCREMENT LOOP COUNTER
    TIMSTAMP = TIMSTAMP + 1 'INCREMENT VARIABLE
    VOTIME = VOTIME + 1 'INCREMENT VARIABLE
    LEDTIMR = LEDTIMR + 1
    IF LEDTIMR >= 10 THEN
    TOGGLE WATCH_DOG 'KEEP WATCHDOG HAPPY
    LEDTIMR = 0
    ENDIF
    RETURN

    After the interrupt routine is complete you mearly "Return" to the program. It's that simple. All if the information is in the "Instant Interrupt Routine" documentation.
    I can't remember where I found the "Instant Interrupt Routine" include file but if you do a search of the web I'm sure you will find it. LOL

    Dave Purola,
    N8NTA

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14
  2. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 20:02
  5. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48

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