Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Can we have the code please

    Hi,

    It is very unlikely that DT's int handler mess with your CCP2CON register. Do you have a LCD / Serial / Debug out then try dumping the CCP2COn values periodically to know whats going on.

    A look at the code may be helpful. I have 18F4520 ready with me and would like to duplicate the problem for my own interest.
    Regards

    Sougata

  2. #2
    Join Date
    Jun 2005
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Hi sougata--

    The code is massive, with a dozen include files... it would be a real mess to upload it. PWM on channel 1 always works. I have discovered since I posted that message that if I start Timer1 (T1CON.0 = 1, the timer that is used by Darrell's Elapsed Timer code), then the PWM on channel 2 works. Stop timer 1, and channel 2 PWM stops working. But if I comment out all of Darrell's code and recompile, both PWM ports work perfectly.

    PWM only uses Timer 2, so I am baffled. I do have an LCD attached, I will try reading the CCP2CON register and see what its thinking.

    Thanks--

    --Alan

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I think the default for channel 2 is Timer1 unless you use the DEFINE HPWM2_TIMER 2 option.
    Channel 1 defaults to Timer2 so you would still see this channel working when disabling Timer1.

    See if adding DEFINE HPWM2_TIMER 2 doesn't cure the problem.

    Edit: Scratch that one. This is apparantly only for 17C7xx device types.
    Last edited by Bruce; - 25th July 2008 at 20:20. Reason: Only for 17C7xx devices
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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

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

  6. #6
    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 09:01. Reason: Mr-E
    DT

  7. #7
    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; - 29th July 2008 at 00:56.

  8. #8
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,172


    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

Similar Threads

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

Members who have read this thread : 5

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