pic18f887 event timer


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Can someone show me some examples of how to do the math to get the event to fire off properly with the two oscillator speeds?
    Charlie, play with the attached little tool to find out.

    How to use it: click on the box enter the new value and press enter.

    Cheers

    Al.
    Attached Files Attached Files
    Last edited by aratti; - 26th October 2010 at 09:54.
    All progress began with an idea

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Timer 1 is 16 bit.
    At 8 Mhz with a prescale of 1 and a peload of 21537 will give 22.0 mSec
    At 20 Mhz with a prescale of 2 and a peload of 10536 will give 22.0 mSec

    http://www.picbasic.co.uk/forum/cont....-PICMultiCalc
    http://www.picbasic.co.uk/forum/show...3259#post23259
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53


    Did you find this post helpful? Yes | No

    Default compile errors

    I am not sure if I shoudl reply to this thread or the main interupt thread.

    Anyways, I am getting errors when compiling. It looks like its all with the includes files.

    I have attached a screenshot showing the errors and my code

    Can anyone let me know what I am doing wrong?

    Thanks,
    Charlie
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default

    The answers are in the errors. They tell you what you need to do.
    DT

  5. #5
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53


    Did you find this post helpful? Yes | No

    Default

    ...perhaps the errors mean something to those who know, but I am not smart enough to know (hence the reason I am for asking for help). A little more guidance would be appreciated. am I suposed to edit pbppic14.lib, if so how and where, its a huge file. Or am I suposed to change the includes file for the PIC16F887?

    Thanks,
    Charlie

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


    Did you find this post helpful? Yes | No

    Default

    Add ...

    wsave VAR BYTE $70 SYSTEM

    to your program.
    DT

  7. #7
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53


    Did you find this post helpful? Yes | No

    Default

    OK. Thanks, Compiles now and have a blinking LED. Back to the timing... Sorry I am so dense with this.

    How do I go about setting the timer for prescale of 1 and a peload of 21537

    I have been looking at previous posts and the datasheet for the 16f887, but not really sure what I need to do.

    I assume I have to set T1CON and perhaps OPTION_REG

    Also would I be better off using Timer2 since its 8bit (would it be less resources, etc?). As the timer is tripping along, there is no issue with timing of other things like serial commands, I2C timing, etc?

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