Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Thanks for the help Darrel.

    I will look into it further. I had initialized stepcount to 32, then later to 8. Seems to get stuck after about two flashes of the led's.

    Walter

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


    Did you find this post helpful? Yes | No

    Default

    Maybe you need to set PCLATH before changing PCL?
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Walter,

    Try this. It gives you a lot smaller table by packing two bytes into each word space. If you stick with the RETLW approach just uncomment the addwf WREG.

    Code:
    ASM
    SineTable   
      movlw UPPER Table1
      movwf TBLPTRU
      movlw HIGH Table1
      movwf TBLPTRH
      movlw LOW Table1
      movwf TBLPTRL
      movf _STEPCOUNT,W
      ;addwf WREG     ; uncomment only if using RETLW tables VS db
      addwf TBLPTRL
      TBLRD*
      movf  TABLAT, W
      return
     
    Table1
      db 0,128,148,167,185,200,213,222,228,230,228,222,213,200,185,167
      db 148,128,180,108,89,71,56,43,34,28,26,28,34,43,56,71,89,108
    ENDASM
    Regards,

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

  4. #4
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    I've been trying to use DT_INTS-14 with a 16F877A. I'm getting errors when trying to compile. Code is as follows:
    Code:
    DEFINE    OSC 4
    
    'Define LCD registers and bits
    Define  LCD_DREG        PORTD
    Define  LCD_DBIT        4
    Define  LCD_RSREG       PORTE
    Define  LCD_RSBIT       0
    Define  LCD_EREG        PORTE
    Define  LCD_EBIT        1
    
    'OPTION_REG.6 = 0 
    OPTION_REG.7=0                               'ENABLE PORTB PULLUPS
    ADCON1 = 7                                   
    Low PORTE.2                                  
    Pause 100                                    
    
    'INCLUDE FILES FOR DT INTERRUPTS  
    INCLUDE "DT_INTS-14.bas"
    INCLUDE "ReEnterPBP.bas"
    
    X         VAR  BYTE
    Y         VAR  BYTE
    Z         VAR  BYTE
    COUNTER   VAR  BYTE
    TAG       VAR  BYTE[26]
    
    INIT:
    'INITIALIZE INTERRUPTS
    ASM
    INT_LIST  macro   ;IntSource,Label,Type,ResetFlag?
            INT_Handler  RBC_INT,  _BChange, PBP, yes                  
        endm
        INT_CREATE
    ENDASM
    
    @ INT_ENABLE RBC_INT
    
    START:
    COUNTER=0
    
    MAIN:
    IF COUNTER=>26 THEN
         LCDOUT $FE,1,"COUNTER: ",DEC COUNTER
         LCDOUT $FE,$C0,STR TAG\15
         COUNTER=0
    ENDIF
    GOTO MAIN
    
    BChange:
    COUNTER=COUNTER+1
    IF PORTB.0=0 THEN
         TAG[COUNTER]=0
    ENDIF
    IF PORTB.1=0 THEN
         TAG[COUNTER]=1
    ENDIF
    @ INT_RETURN
    The errors I'm getting are:
    Error [113] c:(path)pbppic14.lib 1181: Symbol not previously defined (wsave)
    Error [101] c:(path)code\lab-x1.asm 194: Error: (wsave variable not found,)
    Error [101] c:(path)code\lab-x1.asm 258: Error: (" Add:" wsave VAR BYTE $70 SYSTEM)
    Error [101] c:(path)code\lab-x1.asm 315: Error: (Chip has RAM in BANK1, but wsave1 was not found.)
    etc
    etc

    Can somebody tell me what's wrong?

    Thanks

  5. #5
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Yes, it is asking you to change the include file here:

    Code:
    wsave   VAR BYTE    $20     SYSTEM      ' location for W if in bank0
    ;wsave   VAR BYTE    $70     SYSTEM      ' alternate save location for W 
                                             ' if using $70, comment out wsave1-3
    
    ' --- IF any of these three lines cause an error ?? ---------------------------- 
    '       Comment them out to fix the problem ----
    ' -- It depends on which Chip you are using, as to which variables are needed --
    wsave1  VAR BYTE    $A0     SYSTEM      ' location for W if in bank1
    wsave2  VAR BYTE    $120    SYSTEM      ' location for W if in bank2
    wsave3  VAR BYTE    $1A0    SYSTEM      ' location for W if in bank3
    It needs to be adjusted for a few different chips. Comment out the wsave at $20, and uncomment the wsave at $70, and try commenting out the wsave1-3.
    Last edited by ScaleRobotics; - 3rd September 2010 at 06:11.
    http://www.scalerobotics.com

  6. #6
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    scalerobotics - Thanks very much.
    Last edited by circuitpro; - 3rd September 2010 at 20:28.

  7. #7
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Just wondering if doing something like this is a 'no no' wrt to the interrupt handlers...

    Code:
    CPM1_Interrupt_Handler:
    
    @ INT_DISABLE  CMP1_INT
    [do some stuff here]
    @ INT_ENABLE  CMP2_INT
    
    @ INT_RETURN
    
    
    CPM2_Interrupt_Handler:
    
    @ INT_DISABLE  CMP2_INT
    [do some stuff here]
    @ INT_ENABLE  CMP1_INT
    
    @ INT_RETURN
    ....essentially 'toggling' between each comparator being 'interrupt' enabled (& where the other comparator enables/disables itself & its partner). I'm getting weird results, but that's probably cos the rest of my code isn't robust - but just wanted to establish if it's ok to do this (especially if the comparators are interrupting rapidly due to them both rx'ing a rapidly changing input - and also each comparator potentially interrupting very closely in time)

    Also, not having a clue about this kinda stuff, just wondering what's going on 'under the hood' so to speak....ie when an interrupt enable &/or disable is actioned as per the above? (does enabling/disabling in such a manner use a lot of processor clock cycles? Or is it pretty swift?)

    Thanks.
    Last edited by HankMcSpank; - 12th September 2010 at 17:24.

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  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. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  4. Keypad and DT's Instant Interrupts
    By Homerclese in forum General
    Replies: 11
    Last Post: - 27th April 2007, 06:32
  5. Replies: 1
    Last Post: - 1st November 2006, 03:11

Members who have read this thread : 8

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