Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    Jun 2005
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Hi--

    I'm having a problem with Instant Interrupts that I can't figure out... I'm using Darrell's Elapsed Timer with V3.2 of DT_INTS-18 and Reenter-PBP-18. The chip is an 18F4520 running at 16MHz. The interrupt-driven elapsed timer system works beautifully, but then I can no longer use the second PWM output, CCP2, which I have set up to output on portc.1. CCP1 works perfectly. This is true whether I use the HPWM command and PBP defines or set up the PWM registers directly as described in the data sheet.

    What happens is that portc.1 goes low and stays that way. If I disable the DT includes and the interrupt handler, the PWM CCP2 port functions normally. I have checked and double checked things like the portb/c multiplexing and the tris output settings, etc. What I think is happening is something in Darrrell's code is clearing CCP2CON, but I haven't been able to find it.

    Does anybody have any ideas to try?

    Thanks--

    --Alan

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

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

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

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

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

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

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