DT Interrupt and Elapsed Time Running Slow


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Location
    Boise, Id
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    OK, HSEROUT is working, and so is the timer interupt. After almost 30 minutes, it was slow about 20 seconds. I'm guessing that could be drift in the internal OSC? It's all I'll need for the current project.

    I used the HSEROUT settings from the PBP manual, I compaired them to the data sheet for the 18F2550, I didn't see anything that I felt like I should change. Learned my lesson with the T1CON settings.

    Thanks for the help.

    For those reading this that are worried about changing from Debug to HSEROUT, it wasn't bad, I used the following Defines:
    Code:
         DEFINE HSER_RCSTA  90h
         DEFINE HSER_TXSTA  20h
         DEFINE HSER_BAUD   9600 
         DEFINE HSER_CLROERR    1
    The HSEROUT looks like this:

    Code:
    Hserout [10," M: ",dec Minutes," S: ",dec Seconds," T: ",dec Ticks,10]
    I'm using the "Serial Communicator" in MicroCode Studio (F4 key)

    The pic is connected to a MAX232, I think this is needed for HSEROUT? Someone correct me if I'm wrong.

    Also I'm using a DYNEX RS232 to USB adapter:

    Model: DX-UBDB9 from BestBuy

    I'm Using Windows VISTA, so I downloaded the latest drivers from their website, and only had moderate issues with VISTA ( mostly operator error )

    Hope this helps out anyone else that has questions about a setup.


    Shane

  2. #2
    Join Date
    Jan 2009
    Posts
    78


    Did you find this post helpful? Yes | No

    Default 20h or 24h ?

    The HSER_TXSTA should be 20h or 24h ?

  3. #3
    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