Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Well, without the code, we're reduced to playing 20 questions.

    Please post at least the Interrupt Definitions, handlers (other than Elapsed), and ANY and ALL lines that modify the following registers.

    T1CON
    INTCON
    INTCON2
    INTCON3

    PIE1
    PIE2
    IPR1
    IPR2

    <br>
    DT

  2. #2
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default T1CON wrong settings

    Hi,

    DT's Elapsed Timer takes care of setting T1CON right in the "StartTimer" . If by any means T1CON oscillator is turned on then PORTC.1 becomes an input regardless of the TRIS settings. Still it does not explain why and how the PWM starts when Timer1 is started.

    What happens when your PWM stops the pin in set low/high ?
    I hope you are quite aware that if duty cycle is higher than period then the pin never gets cleared.

    Mr.E where is your crystal ball ??!!??
    Regards

    Sougata

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sougata View Post
    If by any means T1CON oscillator is turned on then PORTC.1 becomes an input regardless of the TRIS settings.
    That's a good possibility.

    Still it does not explain why and how the PWM starts when Timer1 is started.
    So True!

    > Mr.E where is your crystal ball ??!!??
    Ummm, being that he hasn't logged in since 15th June 2008
    I'd say he's in Jail.

    Can't imagine mister-e not checking in, if he could.
    <br>
    Last edited by Darrel Taylor; - 26th July 2008 at 08:01. Reason: Mr-E
    DT

  4. #4
    Join Date
    Jun 2005
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Hmmm... Sougata's point about starting timer1 sounds like it might be the culprit, at least as far as RC1 going to input. PWM2 drives a fan via a MOSFET, so if RC1 goes to input, the pullup I have on the MOSFET would drive the fan to full speed, which is exactly what's happening. I haven't yet found in the data sheet why turning timer1 on does that to RC1.

    I have attached the code relevant to Darrel's question. The INCLUDE files that aren't attached don't modify the registers Darrel was talking about. I have very little experience with using the timers or using interrupts-- is it possible to just modify the Elapsed Timer routine to use timer 0 or timer3?

    Thanks--

    --Alan
    Attached Files Attached Files
    Last edited by alanmcf; - 28th July 2008 at 23:56.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by alanmcf View Post
    Hmmm... Sougata's point about starting timer1 sounds like it might be the culprit,
    It is!

    The line T1CON = %00001101 '<-- settings for 16 MHz turns on the Timer1 Oscillator, which disables RC1's digital I/O functions.

    Since you are using the Elapsed Timer, there's no need to set T1CON. The Include file does that for you.
    <br>
    DT

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,116


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Can't imagine mister-e not checking in, if he could.
    <br>
    In fact, I had some tel. discussion 1 and 1/2 month ago with Steve, but when I tried to find him again, he disappeared. No telephones (only tel. answering machine) no e-mails. If anyone knows about Steve please inform. He had some misfortunes in the past as we can recall, just hope all is OK now, lying in some beach.

    Ioannis

  7. #7
    Join Date
    Jun 2005
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel--

    Are you saying that your elapsed timer routine uses Timer1 without actually turning it on, thereby avoiding the portc.1 problem? I will try this immediately!

    Thanks--

    --Alan

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


    Did you find this post helpful? Yes | No

    Default

    Yes, It uses Timer1. But it doesn't turn on the External Oscillator.

    Timer1 has a feature that lets you hook up a 32768hz crystal on the T1OSO(RC0) and T1OSI(RC1) pins. This oscillator will continue running in sleep mode, so it can be used to keep time like a clock.

    But the way you are using the Timer, it's using the signal from the main System Oscillator, so there's no need to turn the ext. osc on.

    For the Elapsed timer, you can use the StartTimer and StopTimer subroutines.

    hth,
    DT

  9. #9
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default About Steve

    Skimask pointed this out

    http://www.picbasic.co.uk/forum/show...0058#post60058


    BTW I would encourage everybody to have a look at DT's codes and try to figure out the amount of hard work and pure AI (I beleive he is an android built by microchip using surplus production ) he has put in.

    Meant to make our life easy and enlighten us, the mere mortals on PIC and PBP.
    Last edited by sougata; - 29th July 2008 at 19:28. Reason: Forgot to thank DT once again for his great contribution
    Regards

    Sougata

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  2. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 20:02
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  4. Keypad and DT's Instant Interrupts
    By Homerclese in forum General
    Replies: 11
    Last Post: - 27th April 2007, 06:32
  5. Replies: 1
    Last Post: - 1st November 2006, 03:11

Members who have read this thread : 10

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts