DT Interrupt and Elapsed Time Running Slow


Results 1 to 10 of 10

Threaded View

  1. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Using the internal OSC sure leads to problems one day or another, even with newer OSC accuracy.

    @8MHz and 9600 baud, it shouldn't matter if you use 24, or 20 for TXSTA as both will return the same error %... BUT assuming some ASM limitations, asking PBP macro to calculate the SPBRG value for you, could give some difference at this point.

    See what a single digit of difference can do

    @8MHz and TXSTA=20,
    if SPBRG=11, err% =8.507%
    if SPBRG=12, err% =0.16
    if SPBRG=13, err% = -6.994%

    When TXSTA=24
    if SPBRG=50, err% =2.124%
    if SPBRG=51, err% =0.16
    if SPBRG=52, err% =-1.73%

    Play safe and set SPBRG yourself.
    Code:
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
    DEFINE HSER_SPBRG 12  ' 9600 Baud @ 8MHz, 0.16%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    This is where I begun to think about some Standalone Calc software. First was E-Z SPBRG Calculator, then it grows and became PicMultiCalc.

    Download it
    http://www.picbasic.co.uk/forum/atta...7&d=1225550328
    Last edited by mister_e; - 11th May 2009 at 18:08.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. Interrupt RPM and Taylors Elapsed time on 18F4620
    By Tobias in forum mel PIC BASIC Pro
    Replies: 70
    Last Post: - 3rd February 2010, 16:12
  3. Get elapsed time while TIMER samples pulses
    By RodSTAR in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th March 2009, 16:27
  4. Interrupt problem.
    By muddy0409 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th August 2005, 06:40
  5. My Code get crazy after i add interrupt
    By jetpr in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th May 2005, 04:43

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