Problem with timer with pic16f628

Discussion in 'The Projects Forum' started by ramparts, Feb 1, 2014.

  1. ramparts

    Thread Starter New Member

    Jan 24, 2014
    Hi to all.
    I am an electronicist but i am newbye on programing ,and i am having issues on this project:

    the author gives source and hex bu neither hex work on project ,neither mikropic c compiles without errors ,also matlab ide with c compiler gets an #device error :/
    Neither author gives fuses config for Pic Burning

    i know it´s a xt config but other configs like lvp ,boden and so on to exception on code protect are an enigma to me.:confused:

    So maybe some one can help here..

    Thanks in advance
  2. Dodgydave

    Distinguished Member

    Jun 22, 2012
    If you write this code (its in MPASM not C) at the beginning under the header,

    include <P16F628A.INC>
    __config _LVP_OFF & _BOREN_OFF & _PWRTE_ON and _WDT_OFF & _XT_OSC

    more info here
  3. JohnInTX


    Jun 26, 2012
    It builds with no errors on MikroC for a 18F4620.
    The code was written for a PIC18F4620 but you indicate you are using a PIC16F628.

    The biggest problem is the hardware differences between the chips that cause unresolved references:
    There is no PORTD on a '628. The source refers to a bit on PORTD
    Timer 0 is 8 bits on a '628 so the reference TMR0H/L is not valid on a 628.

    You'll have to rewrite the code for the 628 hardware or use the 18F4620.

    EDIT: I see that the original version was for a '628..
    '628 Source builds when the compiler is set for 16F628
    '4620 Source builds when set for 18F4620
    Both build in FREE and PRO modes.
    Are you using the correct file and have the compiler set for the correct chip?

    CONFIG bits in MikroC are set in the Project -> Edit Project window; they are then added to the .HEX file. The author of the code should have put all of the settings in the source, at least in the comments. (That's one advantage of having to specify CONFIG settings with a directive in the source..)

    Unfortunately, you'll have to read the datasheet for the part you are using to see what options are present and what applies to your hardware implementation.

    If you are still having problems, post your actual source and the errors reported. Sorry for the earlier confusion.

    Good luck!
    Last edited: Feb 1, 2014