timer and serial interrupt


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    yourmomOS's Avatar
    yourmomOS Guest

    Question timer and serial interrupt

    Hi all, I have a working program that uses serial interrupts for communications. I need to add a timer that will count to say...30 seconds. I can check for it in my main loop and do something when it reaches 30. Or maybe use the timer interrupt. The only problem is I dont want to jump to my serial code for the timer interrupt. Any ideas?

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


    Did you find this post helpful? Yes | No

    Default

    you can still read the TIMER register and react... but a timer interrupt is really good so i don't know why you don't want to use it.

    Test drive the Darrel Taylor instant interrupts...
    Steve

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

  3. #3
    yourmomOS's Avatar
    yourmomOS Guest


    Did you find this post helpful? Yes | No

    Default nothing delaying the serial

    I dont want anything to get in the way of receiving the serail data. If I interrupt to a timer, I may miss a character comming into the serial buffer. I have determined the serial data is more important then the data that will be recorded when the 30 second interval(or whenever) happens.
    Also, I dont know assembly.

    If I were to enable the timer1 and set it up to overflow every 30 seconds, (if possible), In order for it to not jump to the interrupt, I would set the PIE bit to 0 but check for the PIR bit to be 1? correct?

  4. #4
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by yourmomOS
    ...I can check for it in my main loop and do something when it reaches 30. ... Any ideas?
    Although Interrupts sound like the ideal way ... another approach:

    I posted some short code examples in the code examples section that might be used for your 30 second timer. They are based on polling TMRO overflows and not interrupts. Have a look at the second program and see if it might work for you.

    http://www.picbasic.co.uk/forum/showthread.php?t=2129

    Good Luck,
    Paul Borgmeier
    Salt Lake City, Utah
    USA

Similar Threads

  1. Using Sleep
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th August 2008, 04:05
  2. Serial randomness!
    By london alex in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th January 2008, 20:53
  3. Better processing of a serial bitstream
    By breesy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th June 2007, 00:13
  4. Interrupt Menu System Example and Help Needed
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 1st April 2005, 17:05
  5. LCDout Command causes Interrupt!!??
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 31st March 2005, 04:18

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