DT Instant Interrupts help


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2007
    Posts
    11

    Default DT Instant Interrupts help

    Hi... trying to make a test code to see how it works.

    First Iīve made a single tachometer. Worked fine, but when tryied to port then to use interrupts (with Darrel Taylor helps) since the code will make another things in future Iīve get

    Code:
    Error c:\proga~1\pbp\pbppic14.lib 1160: [225] Undefined Symbol 'INT_ENTRY'
    Error c:\proga~1\pbp\pbppic14.lib 1162: [225] Undefined Symbol 'INT_ENTRY'
    errors when compiling

    MPASM box checked and PIC is 16F887.

    Just in case, follows the code:

    Code:
    '@ device pic16F887, HS_OSC, WDT_OFF, LVP_OFF
    include "DT_INTS-14.bas" ' Base Interrupt System
    
    ' set Crystal MHZ 
    DEFINE OSC 20
    ' Set LCD 
    DEFINE LCD_DREG	PORTB
    ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_DBIT	0
    ' Set LCD Register Select port
    DEFINE LCD_RSREG	PORTB
    ' Set LCD Register Select bit
    DEFINE LCD_RSBIT	4
    ' Set LCD Enable port
    DEFINE LCD_EREG	PORTB
    ' Set LCD Enable bit
    DEFINE LCD_EBIT	5
    ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_BITS	4
    ' Set number of lines on LCD
    DEFINE LCD_LINES	2
    ' Set command delay time in us
    DEFINE LCD_COMMANDUS	2000
    ' Set data delay time in us
    'DEFINE LCD_DATAUS	50
    
    
    symbol rpmIn = portd.0
    rpm VAR word
    
    :main
        CM1CON0 = 0 ' Comparators off 
        CM2CON0 = 0 ' Comparators off
        ANSEL = 0
        ANSELH = 0  ' Configure other AN pins as digital I/O
    
        output PORTB
        INPUT PORTD.0
    
        PORTC = 0
        TRISC = 0
        
        
        LCDOUT $FE, 1,   "    prdTURBO    "
        LCDOUT $FE, $C0, "  FUEL COMPUTER "
        pause 2000
        LCDOUT $FE, 1
        
        
        while 1=1
         COUNT rpmIn, 10, rpm 
         LCDOUT $FE,1, "PULS/S ", DEC(RPM)
         LCDOUT $FE, $C0, "RPM ", DEC(rpm)*60
        wend

    Iīm a dumb ass newbie so please donīt blame me if this is a stupid question but:
    Wath I missing to make DTīs Interrupts to compile?

    Best regards,
    Mauro

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


    Did you find this post helpful? Yes | No

    Default

    All you've done is include the file.
    You haven't defined the interrupt sources or the handlers.

    Take a look here for a basic example.

    http://www.darreltaylor.com/DT_INTS-14/hello.html
    DT

  3. #3
    Join Date
    Jul 2007
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Thanks...
    Compiled and worked (not I was expected), but thereīs my fault.

    Before interrupts, with a 25Hz signal Iīve read a 1500 rpm.
    Now, with led blinking, Iīve read is 120~180.

    The code

    Code:
    '****************************************************************
    '*  Name    : UNTITLED.BAS                                      *
    '*  Author  : Mauro Perides                                     *
    '*  Notice  : Copyright (c) 2008 Mauro Perides                  *
    '*          : All Rights Reserved                               *
    '*  Date    : 25/11/2008                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
    '@ device pic16F887, HS_OSC, WDT_OFF, LVP_OFF
    INCLUDE "DT_INTS-14.bas"     ' Base Interrupt System
    INCLUDE "ReEnterPBP.bas"     ' Include if using PBP interrupts
    
    'Define MHZ Crystal
    DEFINE OSC 20
    ' Set LCD 
    DEFINE LCD_DREG	PORTB
    ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_DBIT	0
    ' Set LCD Register Select port
    DEFINE LCD_RSREG	PORTB
    ' Set LCD Register Select bit
    DEFINE LCD_RSBIT	4
    ' Set LCD Enable port
    DEFINE LCD_EREG	PORTB
    ' Set LCD Enable bit
    DEFINE LCD_EBIT	5
    ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_BITS	4
    ' Set number of lines on LCD
    DEFINE LCD_LINES	2
    ' Set command delay time in us
    DEFINE LCD_COMMANDUS	2000
    ' Set data delay time in us
    'DEFINE LCD_DATAUS	50
    
    SYMBOL LED1 = portd.1
    symbol rpmIn = portd.0
    rpm VAR word
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   TMR1_INT,  _ToggleLED1,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    T1CON = $31                ; Prescaler = 8, TMR1ON
    @ INT_ENABLE  TMR1_INT     ; enable Timer 1 interrupts
    
    
    
    :main
        CM1CON0 = 0 ' Comparators off (Do I need these?)
        CM2CON0 = 0 ' Comparators off
        'ANSEL = 0
        ANSELH = 0  ' Configure other AN pins as digital I/O
    
        output PORTB
        INPUT PORTD.0
    
        PORTC = 0
        TRISC = 0
        
        
        LCDOUT $FE, 1,   "    prdTURBO    "
        LCDOUT $FE, $C0, "  FUEL COMPUTER "
        pause 2000
        LCDOUT $FE, 1
        
        
        while 1=1
         COUNT rpmIn, 100, rpm 
         LCDOUT $FE,1, "PULS/S ", DEC(RPM)
         LCDOUT $FE, $C0, "RPM ", DEC(rpm)*60
        wend
    
     
    '---[TMR1 - interrupt handler]--------------------------------------------------
    ToggleLED1:
         TOGGLE LED1
    @ INT_RETURN

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Talking

    Hi,

    Just disable interrupts before and re-enable them after the "COUNT" command ... but issue expected if blinking the Led @ more then 5 Hz ...

    Note you do not need interrupts to blink your Led ... COUNT in a loop gives a correct ( read convenient enough ) timebase !!!


    Alain
    Last edited by Acetronics2; - 26th November 2008 at 12:59.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,802


    Did you find this post helpful? Yes | No

    Default

    Hi. I would recommend for the sake of experimantation to increase the sampling of the count command to say 2000msec and see what happens.

    The timer1 interrupts the count every 105 msec and is obvious that there is interference since the Count also samples at 100 msec. Remember that the Interrupts are not Instant with the exact meaning. There is an overhead to save and restore the variables and program counter.

    Also at your program:

    Code:
    :main
    make it as
    Code:
    main:
    and
    Code:
        while 1=1
         COUNT rpmIn, 100, rpm 
         LCDOUT $FE,1, "PULS/S ", DEC(RPM)
         LCDOUT $FE, $C0, "RPM ", DEC(rpm)*60
        wend
    make it as:
    Code:
    rpm var word
    LCDOUT $FE,1, "PULS/S ", $FE,$C0,"RPM:"
        while 1=1
         COUNT rpmIn, 2000, rpm:rpm=rpm*60 
         LCDOUT $FE, $80,dec,"  ", rpm,$FE,$C5, DEC rpm,"   "
        wend
    this is much faster.

    Ioannis
    Last edited by Ioannis; - 26th November 2008 at 13:57.

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Wink KISS Method.

    Hi,

    W/ no interrupts using ...

    Code:
    ....
    
    
        while 1
         TOGGLE LED1
         COUNT rpmIn, 100, rpm 
         LCDOUT $FE,2, "PULS/S ", DEC(RPM ), "            "
         LCDOUT $FE, $C0, "RPM ", DEC(rpm)*60 , "                 "
        wend
    
    END
    so simple as that ... ( LCDOUT spaces avoid resetting the LCD ... which is toooooooo long ! )

    ... BTW : How many pulses per rev. ???

    Alain
    Last edited by Acetronics2; - 26th November 2008 at 14:22.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  7. #7
    Join Date
    Jul 2007
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Hi...

    Working fine now. Thanks for the directions.

    I know I donīt need interrupts to just blink a led (and donīt need for most of things). Just to see how it works.

    In future I expect this code will read some sensors (pressure, air temp, rpm and a pot), do some calculation and provide near exact extra fuel needed for an aftermarkt turbo charged engine runing at high revs. At this time I think that Iīll need interrups, since in this case, time is critical

    ... BTW : How many pulses per rev. ???
    Donīt know yet... need to check. Using 1 at this time.
    Last edited by perides; - 26th November 2008 at 14:40.

  8. #8
    Join Date
    Jul 2007
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Canīt figure by myself .
    Can someone explain me tachometer maths??
    Engine will run up to 5500 revs. 1 pulse for revolution.

Similar Threads

  1. DT Instant Interrupts
    By krohtech in forum mel PIC BASIC Pro
    Replies: 38
    Last Post: - 25th February 2009, 15:33
  2. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 20:02
  3. 12F683 and DT Instant Interrupts
    By jderson in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 22nd November 2008, 12:47
  4. 18F1220 and DT Instant Interrupts
    By jderson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th June 2008, 05:37
  5. Replies: 1
    Last Post: - 1st November 2006, 03:11

Members who have read this thread : 2

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