12F683 and DT Instant Interrupts


Closed Thread
Results 1 to 27 of 27

Hybrid View

  1. #1

    Default 12F683 and DT Instant Interrupts

    I am trying to use Darrel Taylor's great Instant Interrupts (thank you!) on a 12F part. Originally, I was using a 12F635. I changed to a 12F683 after reading posts about doing this, because I was under the impression it would work O.K. However, I still get the following message when compiling:

    ERROR:Variable wsave2 position request 288 beyond RAM_END 191.

    Do I still need to comment out some lines?

    @ device pic12f683, INTRC_OSC_NOCLKOUT, WDT_OFF, MCLR_OFF, PROTECT_OFF

    OPTION_REG = %11000000
    OSCCON = %01100001
    TRISIO = %001100
    CMCON0 = %00000111
    ANSEL = 0
    CCP1CON = 0


    RATESW VAR BYTE

    HIGH GPIO.0
    HIGH GPIO.1
    HIGH GPIO.4
    HIGH GPIO.5
    pause 100

    RATESW = 0

    INCLUDE "DT_INTS-14.bas" ' Base Interrupt System

    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler INT_INT, _SWINT, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor

    INT_ENABLE INT_INT ; enable external (INT) interrupts
    ENDASM

    Main:

    if ratesw = 1 then Rate1
    if ratesw = 2 then rate2
    if ratesw = 3 then rate3
    if RATESW > 3 then RESET
    GOTO Main

    Rate1:

    while ratesw = 1
    LOW GPIO.0
    low GPIO.1
    pause 150
    high GPIO.0
    high GPIO.1
    low GPIO.4
    low GPIO.5
    PAUSE 150
    high GPIO.4
    high GPIO.5
    wend

    Rate2:

    while ratesw = 2
    LOW GPIO.0
    low GPIO.1
    pause 100
    high GPIO.0
    high GPIO.1
    low GPIO.4
    low GPIO.5
    PAUSE 100
    high GPIO.4
    high GPIO.5
    wend

    Rate3:

    while ratesw = 3
    LOW GPIO.0
    low GPIO.1
    pause 50
    high GPIO.0
    high GPIO.1
    low GPIO.4
    low GPIO.5
    PAUSE 50
    high GPIO.4
    high GPIO.5
    wend



    RESET:

    RATESW = 0
    GOTO Main

    GOTO Main

    '---[INT - interrupt handler]---------------------------------------------------
    SWINT:

    while GPIO.2 = 0:wend
    pause 100
    if GPIO.2 = 1 then
    RATESW = RATESW + 1
    endif

    @ INT_RETURN


    Thank you

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yes, open DT_INTS-14.bas file.. and at the top, you'll discover...
    Code:
    ' --- 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
    ' ------------------------------------------------------------------------------
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Thank you for the reply. Unfortunately, I have all three lines commented out and now I get "Unable to fit wsave" .

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


    Did you find this post helpful? Yes | No

    Default

    From that error, it looks like you're still compiling for the 12F635.

    If using MicroCode Studio, make sure the device dropdown box says 12F683.

    For the 683, you'll need both wsave and wsave1.

    Or you can use the alternate wsave location $70, and comment the other 3.
    <br>
    DT

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Thank you Darrel. Yes , the drop-down was incorrect. The program doesn't work, but that's because it's still Halloween!

  6. #6
    Join Date
    Nov 2008
    Posts
    96


    Did you find this post helpful? Yes | No

    Default 12f683 messages too...

    I'm trying to get my head across the DT Interrupt code for a small new RC modeling project and I'm trying a test example first (the blinky LED) , compiling with MCS. I have 12f683 selected in MCS and MPASM being used.

    but I get an odd warning message from MCS thus :
    Warning[219] d:\pbp code\pbp\pbppic14.lib 336 : Invalid RAM location specified
    Warning[219] d:\pbp code\pbp\pbppic14.lib 892 : Invalid RAM location specified

    Anybody know why and if I should just disregard it ?

    I commented out the wsave lines as required (which led me here BTW)

    My code

    Code:
    LED1   VAR  PORTB.1
    
    INCLUDE "DT_INTS-14.bas"     ' Base Interrupt System
    INCLUDE "ReEnterPBP.bas"     ' Include if using PBP interrupts
    
    ASM
    RBIF = GPIF
    RBIE = GPIE
    
    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:
      PAUSE 1
    GOTO Main
    
    '---[TMR1 - interrupt handler]--------------------------------------------------
    ToggleLED1:
         TOGGLE LED1
    @ INT_RETURN
    My project is quite simple. A 22.5mS interrupt timer (TMR1 I guess) and toggle a few pins then wait for the next interrupt.
    Martin

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14

Members who have read this thread : 3

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