+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004
    Location
    Porto - Portugal
    Posts
    29

    Default PIC16F18855 and DT elapsed timer

    Hello to you all,

    As PIC16F876A become obsolete I decided to use PIC16F18855 to replace it, it is much cheaper than the old PIC16F876A and has more features.

    I implemented the code below (using PBP3) to get sure that the faithfull ELAPSED TIMER from Darrol's would still work with the new PIC

    ''* Name : test_pic16f18885.PBP *
    '* Date : 17-10-2018 *
    '* Version : 1.0 *
    '* Notes : *
    '************************************************* ***************
    #CONFIG
    __config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT32 & _CLKOUTEN_OFF & _CSWEN_ON & _FCMEN_ON ; pag 92
    __config _CONFIG2, _MCLRE_ON & _PWRTE_ON & _LPBOREN_OFF & _BOREN_ON & _BORV_LO & _ZCD_OFF & _PPS1WAY_OFF & _STVREN_ON & _DEBUG_OFF ;pag 93
    __config _CONFIG3, _WDTCPS_WDTCPS_11 & _WDTE_ON & _WDTCWS_WDTCWS_7 & _WDTCCS_LFINTOSC
    __config _CONFIG4, _WRT_ON & _SCANE_available & _LVP_ON
    __config _CONFIG5, _CP_ON & _CPD_OFF
    #ENDCONFIG


    DEFINE OSC 08

    OSCFRQ = %11

    include "DT_INTS-14.bas"
    include "Elapsed_INT.bas"

    Clear

    ANSELA = 0
    ANSELB = 0
    ANSELC = 0

    TRISA=%11111100
    TRISB=%11111111
    TRISC=%11111111

    StatLED VAR PORTA.0
    LED var PORTA.1

    led =0

    main:
    led=1 ' to make sure PIC is running

    pause 100
    if SecondsChanged = 1 then
    SecondsChanged = 0
    Toggle StatLED ' counting seconds is "alive"
    endif

    led=1
    pause 100

    goto main


    However the compilation always return:

    [ASM ERROR] Symbol not previously defined (INT_ENTRY) (0) : ERROR[113)
    [ASM ERROR] Symbol not previously defined (INT_ENTRY) (0) : ERROR[113)
    [MESSAGE] pic16lf18855.pbpinc(603): HPWM command only supports CCP channels (not PWM channels).

    Can any of you tell me how to solve this?

    Thank's in advance

    Vicente
    nomada

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,200

    Default Re: PIC16F18855 and DT elapsed timer

    Several versions of ELAPSED_INT seems to exist. One that predates the existance of DT-Ints and one which is supposed to work WITH DT-Ints. For the one that's using DT-Ints it looks like you also need to include ReEnterPBP.bas file. Here's an example by Darrel himself, from this thread:
    Code:
    INCLUDE "DT_INTS-14.bas"
    INCLUDE "ReEnterPBP.bas"
    INCLUDE "Elapsed_INT.bas"  ; Elapsed Timer Routines
    
    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,2, DEC Days,"d-",DEC2 Hours,":",DEC2 Minutes,":",DEC2 Seconds
      ENDIF
    GOTO Main
    Also, OSCFRQ = %11 can't be right but I suspect that it's the forum messing with the text.

    When posting code, please use the proper code tags.

    /Henrik.

  3. #3
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,157

    Default Re: PIC16F18855 and DT elapsed timer

    Henrik posted the same code 1 second before me. So I deleted mine.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  4. #4
    Join Date
    Oct 2004
    Location
    Porto - Portugal
    Posts
    29

    Default Re: PIC16F18855 and DT elapsed timer

    Hi Henrik and Sayzer

    Thank you for your repply, I apologize for all this time without a feedback for both of you but sometimes my work makes me travel for a week or so and...

    Well, I tried the code posted by Henrik and downloaded the files of DT from the thread that Henrik kindly pointed

    The results were a little bit diferent, the compilations errors now reports to include file REnterPBP.bas and are:

    [ERROR] reenterpbp.bas (96) : Syntax error
    [ERROR] reenterpbp.bas (129) : Syntax error
    [ERROR] reenterpbp.bas (129) : Redefinition of LABEL Vars_Saved

    I've downloaded the files more than once to get sure that they were ok

    I've tried the same code on PIC16F876Aand the errors are the same

    Once again thank you for your time and patience with my ignorance on this

    Vicente
    Last edited by nomada; - 5th November 2018 at 13:16.
    nomada

Similar Threads

  1. DT Elapsed Timer Question
    By rocket_troy in forum PBP3
    Replies: 11
    Last Post: - 10th August 2018, 06:34
  2. DT Elapsed Timer
    By retepsnikrep in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th December 2017, 00:21
  3. Elapsed Timer findings
    By Art in forum General
    Replies: 40
    Last Post: - 18th June 2015, 19:14
  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: - 10th March 2008, 00:17

Members who have read this thread : 24

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