Solved - ELAPSED TIMER: TimerConst not defined


Results 1 to 12 of 12

Threaded View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154

    Default Solved - ELAPSED TIMER: TimerConst not defined

    SOLVED: See post #8:

    https://www.picbasic.co.uk/forum/sho...018#post156018


    Datasheet says the PIC 16F1936 has an "enhanced 16-bit TIMER1, TIMER2/4/6 are 8-bit", would that cause problems?

    I used this as reference:
    https://www.picbasic.co.uk/forum/sho...275#post130275. Hopefully I didn't miss something.

    My code:

    Code:
    @ ERRORLEVEL -301   ; turn off ADC clock ignored message
    @ ERRORLEVEL -306   ; turn off crossing page boundary message
    
    #CONFIG
     __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF 
     __CONFIG _CONFIG2, _WRT_OFF & _VCAPEN_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_LO & _LVP_OFF
    #ENDCONFIG
    
    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
    ENDASM
    
    DEFINE OSC 32
    
    SPLLEN          CON %1                  ' PLL enable
    IRCF            CON %1110               ' to enable 8 MHz
    SCS             CON %00                 ' system clock determined by FOSC
    OSCCON = (SPLLEN << 7) | (IRCF << 3) | SCS
                                            
    DEFINE  LCD_DREG      PORTB             ' Set LCD data port
    DEFINE  LCD_DBIT      0                 ' Set starting data bit
    DEFINE  LCD_RSREG     PORTC             ' Set LCD register select port
    DEFINE  LCD_RSBIT     5                 ' Set LCD register select bit
    DEFINE  LCD_EREG      PORTC             ' Set LCD enable port
    DEFINE  LCD_EBIT      4                 ' Set LCD enable bit
    DEFINE  LCD_BITS      4                 ' Set LCD bus size
    DEFINE  LCD_LINES     4                 ' Set number of lines on LCD
    DEFINE  LCD_COMMANDUS 1000              ' Set command delay time in microseconds
    DEFINE  LCD_DATAUS    50                ' Set data delay time in microseconds
    
    define  CCP4_REG     PORTC              ' PWM Pulse out to LCD contrast
    DEFINE  CCP4_BIT     1                  '   2N2907 PNP with 1K on base
    define  CCP5_REG     PORTC              ' PWM Pulse out to LCD backlight
    DEFINE  CCP5_BIT     2                  '   2N2222A NPN with 1K on base
    
    ANSELA = %00000000
    ANSELB = %00000000
    
    TRISA = %00000111
    TRISB = %00110000
    TRISC = %10000000
    TRISE = %00000000
    
        HPWM 2,100,1953
        HPWM 1,180,1953
        
    @ INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts
        Gosub ResetTime                ' Reset Time to  0d-00:00:00.00
    
        Pause 500                           ' Let PIC and LCD stabilize
    
        LCDOUT $FE, 1 : Pauseus 1
        LCDOUT $FE, $80, "ROTARY ENCODER TEST" : Pauseus 1
    
        GOSUB StartTimer          ' Start the Elapsed Timer
    
    Mainloop:
    
        IF SecondsChanged = 1 THEN  
            SecondsChanged = 0
            LCDOUT $FE,2, DEC Days,"d-",DEC2 Hours,":",DEC2 Minutes,":",DEC2 Seconds
        ENDIF
        
        goto mainloop
    end
    PBPX 3.1.6.3
    MCSP 5.0.0.5
    MPASMX assembler enabled


    EDIT: I've found this message "You'll need the ASM_INTS include from the original Elapsed Demo" here:

    https://dt.picbasic.co.uk/CODEX/ETimer

    Still looking....
    Last edited by Demon; - 22nd August 2024 at 21:40. Reason: Solved
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. Elapsed Timer findings
    By Art in forum General
    Replies: 47
    Last Post: - 23rd August 2024, 06:40
  2. PIC16F18855 and DT elapsed timer
    By nomada in forum PBP3
    Replies: 2
    Last Post: - 18th October 2018, 05:58
  3. DT Elapsed Timer
    By retepsnikrep in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th December 2017, 23:21
  4. SPWM and Elapsed Timer
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 8th May 2008, 03:16
  5. DT Elapsed Timer
    By rwskinner in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 9th March 2008, 23:17

Members who have read this thread : 6

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