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

    "master and 2 slaves", mmm kinky!

    Well, I can answer part of it.

    Just change ...

    <pre>T1CON = $11 ; Prescaler = 2, TMR1ON</pre> @ 48mhz, that will give an interrupt every 10.9 ms. No need to reload the timers.

    According to the PBP manual, USBservice should be called every 10ms, but it doesn't have to be that precise.

    However,

    I have no idea what will happen when you interrupt another USB routine and try to do a USBservice.
    My guess is that it won't be pretty.

    More than likely, you will need to INT_DISABLE the TMR1_INT, before doing anything else with the USB, then INT_ENABLE it when it's done.
    <br>
    DT

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    Ok, I added the disable/enable at both assembler USB routines generated from HIDMaker but the device is not recognized. I rummaged through the datasheet for TMR1 and T1CON and found this:

    ================================
    When Timer1 is enabled, the RC1/T1OSI/UOE and
    RC0/T1OSO/T13CKI pins become inputs. This means
    the values of TRISC<1:0> are ignored and the pins are
    read as ‘0’.
    ================================

    Now that sucks, I'm using those pins as output to a LCD. I expected the LCD to spaz out but it's working fine.

    I had started with an 18F4550 QFP but had downgraded to a 18F2550 SOIC, easier to solder. I don't have any output pins to spare either, the only pin I'm not using is A3.

    I hate to have to yank all this off the breadboard to put back the 18F4550, again, but I might not have any choice.

    I think I'm going to comment out all unnecessary code (interrupts/HSERIN/HSEROUT) until I have a working USB program again (sprinkling USBSERVICE everywhere). Then I'll put the USB interrupt back in and go on from there.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    D'oh! Enabling the USB interrupt before USBINIT was not one of my better ideas.

    Step 1: I commented out everything except the LCD and sprinkled USBSERVICE everywhere it is recognized.

    Step 2: I comment out all USBSERVICE and restored the TMR1 interrupt for USBSERVICE and it failed to be recognized (enabling it immediately after USBINIT).

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    Step 3: I skipped over all code relating with the LCD and it still is not recognized.

    So now I've narrowed it down to the TMR1 interrupt not working perfectly. How can I tweak it to interrupt at a faster rate?

    I assume I have to accelerate the prescaler, I just don't know which way is which. And then possibly adding a counter to fine-tune the interval between USBservice.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    I had screwed up the disabling/enabling of the interrupt during USB subroutines.

    Step 4: Disabled TMR1 _before_ the assembler loop, manually issue USBSERVICE within the loop and then enabled TMR1 after the loop and the device is recognized.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default

    Step 5: Reactivated LCD logic along with USART and RX interrupt and device is still recognized.

    Go figure, the LCD works properly even if I'm using pins C0 and C1 to output the data and commands to the LCD.

    Robert


    EDIT: I'm thinking the LCD works because I'm not using an external oscillator for the timer.
    ================================
    When Timer1 is enabled, the RC1/T1OSI/UOE and
    RC0/T1OSO/T13CKI pins become inputs. This means
    the values of TRISC<1:0> are ignored and the pins are
    read as ‘0’.
    ================================
    Last edited by Demon; - 25th July 2006 at 13:46.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  7. #7
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Can DT_INTS-14.bas be used with 12Fxxx PICs?

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 : 4

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