+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116

    Unhappy Cant get DTs interrupts working

    Hy guys.

    Im trying to build a little counter to count pulses of varying speed from nil to 120Hz.

    YEEES it will be a tripmaster speedo someday.

    Tried that with "count" and it works so far, but looses pulses of course and I need every, at least 99,9% of these.

    So I tried to get into DTs interrupts and Im falling on my face (hurts of course)

    because I dunno where to start. Tried "Hello World", "Blinky Light", wont do.

    So I thought its because of the missing definitions and tried some....wont do

    all I get after compiling is the error:
    ERROR: Variable wsave3 position request 416 beyond RAM_END 335.

    I got Microcode studio 3.0.0.5, picbasic pro 2.50 C

    heres my code (stolen from DT of course)
    Code:
    '****************************************************************
    '*  Name    : ElapsedtimerDT1                                   *
    '*  Author  : Darrel Taylor                                     *
    '*  Notice  : Copyright (c) 2010 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 25.04.2010                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :  16F628A, 4mhz , dont care about correct timing  *
    '*          :                                                   *
    '****************************************************************
    '*  Date    : Jan 10, 2006                                      *
    '*  Notes   : This is a simplistic demo of the Elapsed Timer    *
    '***************************************************************
    define LOADER_USED 1
    define  OSC 4
    
    ' Define LCD connections
    DEFINE  LCD_DREG        PORTA    ' LCD Data Port
    DEFINE  LCD_DBIT        0        ' Starting Data Bit
    DEFINE  LCD_RSREG       PORTA    ' Register Select Port
    DEFINE  LCD_RSBIT       4        ' Register Select Bit
    DEFINE  LCD_EREG        PORTA    ' Enable Port
    DEFINE  LCD_EBIT        5        ' Enable Bit
    DEFINE  LCD_BITS        4        ' Data Bus Size
    DEFINE  LCD_LINES        2        ' Number of Lines on LCD
    ADCON1 = 7                        ' Set portA outputs to Digital / No ADC
    'CMCON  = 7
    LCDOUT $FE,1                    ' Initialize LCD
    PAUSE  200
    
    include "DT_INTS-14.bas"
    INCLUDE "ReEnterPBP.bas"
    INCLUDE "Elapsed_INT.bas"
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   TMR1_INT,  _ClockCount,   PBP,  yes
        endm
        INT_CREATE            ; Creates the interrupt processor
    
        INT_ENABLE  TMR1_INT  ; Enable Timer 1 Interrupts  
    ENDASM
    
    Gosub ResetTime           ' Reset Time to  0d-00:00:00.00
    Gosub StartTimer          ' Start the Elapsed Timer
    
    Main:
        if SecondsChanged = 1 then  
           SecondsChanged = 0
           LCDout $FE,$C0, dec Days,"d-",dec2 Hours,":",dec2 Minutes,":",dec2 Seconds
        endif
    GOTO Main

    maybe its about compiler version or something.

    any suggestions beyond cry me a river?

    regards Mugelpower
    Last edited by ScaleRobotics; - 25th April 2010 at 14:30. Reason: code tags

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,541

    Default

    Hi, MugelPower

    ERROR: Variable wsave3 position request 416 beyond RAM_END 335.
    the truth is here :

    Code:
    '***************************************************************************
    '*  Name    : DT_INTS-14.bas                                               *
    '*  Author  : Darrel Taylor                                                *
    '*  Version : 1.00 BETA                                                    *
    '*  Date    : OCT 13, 2009                                                 *
    '***************************************************************************
    '* REV 1.00  Completely re-written, with optimization and F1 chips in mind *
    '* REV 0.93  Fixed CMIF and EEIF problem with older PIC's                  *
    '*           that have the Flags in PIR1 instead of PIR2                   *
    '* Rev 0.92  solves a "Missed Interrupt" and                               *
    '*           banking switching problem                                     *
    '***************************************************************************
    DEFINE  DT_INTS_VERSION  100
    DEFINE  INTHAND  INT_ENTRY
    
    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
    so, just comment this line out in your DT_ints.bas file ...

    Code:
    wsave3  VAR BYTE    $1A0    SYSTEM      ' location for W if in bank3
    End of trouble ...

    Alain
    ************************************************** ***********************
    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 " !!!
    *****************************************

  3. #3
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116

    Unhappy now the errors changed

    I changed to 16F88 because of the 16bit timer i need later (or now)


    now I get those errors:
    Error C: \pbp\pbppic14.lib 1160 : [225]undefined symbol 'INT_ENTRY'
    Error C: \pbp\pbppic14.lib 1162 : [225]undefined symbol 'INT_ENTRY'
    Error : [212] extra tokens on end of line

  4. #4
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116

    Unhappy DT_INTS-14.bas version 1.0

    Man where do I get the newest version:

    DT_INTS-14.bas version 1.0

    ????

    regards

    Mugelpower

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

    Default

    Quote Originally Posted by Mugelpower View Post
    Man where do I get the newest version: DT_INTS-14.bas version 1.0
    Here at bottom of page: http://darreltaylor.com/DT_INTS-14/intro2.html

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

    Default

    Quote Originally Posted by Mugelpower View Post
    now I get those errors:
    Error C: \pbp\pbppic14.lib 1160 : [225]undefined symbol 'INT_ENTRY'
    Error C: \pbp\pbppic14.lib 1162 : [225]undefined symbol 'INT_ENTRY'
    Error : [212] extra tokens on end of line
    I get your errors if I do this:
    Code:
    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
        INT_Handler TMR1_INT, _ClockCount, PBP, yes
        endm
        ;INT_CREATE ; Creates the interrupt processor
    
        INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts
    ENDASM

  7. #7
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116

    Red face got a supersimple DT Timer working

    Hi Guys & Dolls,

    got the DT program running but needed to implement a stupid LCD comment first!

    otherwise the lcd shows only rubbish
    Code:
    '****************************************************************                                            *
    '*  Notes   : To use this example with MicroCode Studio, you    *
    '*          : should:                                           *
    '*          : PIC 16F88 4 MHZ crystal                           *
    '*                   WORKS!                                    *
    '****************************************************************
    
    
    
    
    
        CMCON = 7         ' Disable analog comparator
        ANSEL = %00000000     ' set all to digital
              
    Include "modedefs.bas"
    
    
    define OSC 4            ' this example uses a 4MHz clock
    
            CMCON = 7                ' RA0-RA3 are digital I/O
            TRISA = 0                ' PORT A is output
             TRISB = 3       ' RB0 is Input count RB1 Input reset others output
          
    
    Minute   var     byte    ' Define minute variable
    Second   var     byte    ' Define second variable
    Ticks    var     byte    ' Define pieces of seconds variable
    DoUpdate var     byte    ' Define variable to indicate update 
    
    clear             ' clear all RAM (sets all VAR declarations to zero)
    DoUpdate = 1      ' Force first display
    
    OPTION_REG = %00000101            ' Set TMR0 configuration 
    INTCON = $A0                ' Enable TMR0 interrupts
    On Interrupt Goto TickInterrupt
       
             PAUSE 100
            LCDOUT $FE,1,"Guten" 
            pause 2000
             LCDOUT $FE,1,"Tag" 
            pause 2000
            
    ' Main program loop 
    MainLoop:
       if DoUpdate then
          LCDOUT $FE,1
           LCDOUT $FE,1,DEC2 Minute, ":",DEC2 Second  
           DoUpdate = 0
       endif
       Goto MainLoop  
    
    ' Interrupt routine to handle each timer tick
    ' Disable interrupts during interrupt handler
    disable 
    TickInterrupt:
       Ticks = Ticks + 1                 ' Count pieces of seconds
       If Ticks < 61 Then ExitInterrupt  ' 61 ticks per second 
    
      ' One second elasped - update time
       Ticks = 0
       Second = Second + 1
       If Second >= 60 Then
          Second = 0
          Minute = Minute + 1
          If Minute >= 60 Then
             Minute = 0
          endif
       Endif
       DoUpdate = 1      ' Set update
    
    ExitInterrupt: 
        INTCON.2 = 0    ' Reset timer interrupt flag
        Resume
        end
    this is a far cry from my goal but at least a big jump for me, an unbelievable small step for mankind, maybe a step back.....
    Last edited by ScaleRobotics; - 25th April 2010 at 14:32. Reason: code tags

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

    Default

    Hey Mulgepower, glad to hear it.

    Remember to put your code in brackets like this but without the extra spaces...

    [ code]
    code goes here
    [ /code]

    so it is easier to read?

    Thanks,

    Walter

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