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, if I look at my girlfriend ... Moon's and Mood's have the same period, 27.3 days.

    Don't know how that fit's in with you though
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Yeah, it remind me something... sometimes i'm glad to be 'single'
    Last edited by mister_e; - 31st December 2006 at 12:49.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Steve,

    I got my parts in for USB (gotta love ebay), and I've built up a breadboard with a 4550 and LED's, switches etc.
    I've looked at the example from post #143, the second one, with DT_INTS, and found two problems. The ...

    INTCON = %10100000 ' Enable global and TMR0 interrupts

    was causing the TMR0 interrupts to start servicing the USB before it was initialized. DT_INTS handles all the interrupt enable bits, so you don't need it anyway.

    The other problem was ...

    goto skipmacro

    was skipping over the interrupt defintion. That section of code needs to execute so that it can handle the enable bits and setup a couple other variables.

    Once I made those changes, the program works as expected, and never looses connection.
    <hr>
    But here's the good part,

    After going through the USB18.ASM file and seeing how things worked, it soon became apparent that those routines are setup to use the USB interrupts(even though PBP doesn't use them that way). It just needs a "kick-start" to get it going. The "kick-start" is simply a tight loop servicing the USB until the driver gets to the "CONFIGURED_STATE". After that it takes off and handles itself.

    But the best part is that it doesn't use ANY PBP system variables to service the USB. So the whole thing can be treated like ASM interrupts, and tied directly into the USB_INT interrupt.

    This also seems to improve the response time since it can react immediately to each step of the USB protocol, instead of after each interval of the timer, or whenever ON INTERRUPT get's around to it, but I don't have any hard data to back that up yet.

    Here's your PIC program from the [USBDemo, something to learn USB a little bit ]thread /.zip file.
    Modified to use DT_INTS-18 and the USB interrupt.
    All the other files are the same.

    http://www.darreltaylor.com/files/USBDemo2_DT.txt

    Works great with the "Mister E USBDemo" program.
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default


    Yup it's working really well indeed. Interesting how it could be handled as ASM... Being said, it open a wide range of USB testpoints as well.

    Oh... when i compiled your example i got an error message... Config fuses related... in this line
    Code:
        __CONFIG    _CONFIG1H, _FOSC_XTPLL_XT_1H & _FCMEM_OFF_1H . . . . . .
    Must be _FCMEN_OFF_1H

    Thank you very much Darrel for your time on this one!

    Now, i have to read the USB18.ASM file to understand WHY it's working like that now, AND to see what else we can do with

    ; Modified by Darrel Taylor, Don't blame Steve
    Last edited by mister_e; - 7th January 2007 at 10:15.
    Steve

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

  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 mister_e View Post
    Must be _FCMEN_OFF_1H
    Interesting, I got the same error with your's. Except I had to change it to _FC_MEM

    After further review I see the P18F4550.inc file in my "MPASM Suite" folder shows these configs for CONFIG1H
    Code:
    ;----- CONFIG1H Options --------------------------------------------------
    _FOSC_XT_XT_1H       EQU  H'F0'    ; XT oscillator, XT used by USB
    _FOSC_XTPLL_XT_1H    EQU  H'F2'    ; XT oscillator, PLL enabled, XT used by USB
    _FOSC_ECIO_EC_1H     EQU  H'F4'    ; External clock, port function on RA6, EC used by USB
    _FOSC_EC_EC_1H       EQU  H'F5'    ; External clock, CLKOUT on RA6, EC used by USB
    _FOSC_ECPLLIO_EC_1H  EQU  H'F6'    ; External clock, PLL enabled, port function on RA6, EC used by USB
    _FOSC_ECPLL_EC_1H    EQU  H'F7'    ; External clock, PLL enabled, CLKOUT on RA6, EC used by USB
    _FOSC_INTOSCIO_EC_1H EQU  H'F8'    ; Internal oscillator, port function on RA6, EC used by USB
    _FOSC_INTOSC_EC_1H   EQU  H'F9'    ; Internal oscillator, CLKOUT on RA6, EC used by USB
    _FOSC_INTOSC_XT_1H   EQU  H'FA'    ; Internal oscillator, XT used by USB
    _FOSC_INTOSC_HS_1H   EQU  H'FB'    ; Internal oscillator, HS used by USB
    _FOSC_HS_1H          EQU  H'FC'    ; HS oscillator, HS used by USB
    _FOSC_HSPLL_HS_1H    EQU  H'FE'    ; HS oscillator, PLL enabled, HS used by USB
    
    _FCMEM_OFF_1H        EQU  H'BF'    ; Fail-Safe Clock Monitor disabled
    _FCMEM_ON_1H         EQU  H'FF'    ; Fail-Safe Clock Monitor enabled
    
    _IESO_OFF_1H         EQU  H'7F'    ; Oscillator Switchover mode disabled
    _IESO_ON_1H          EQU  H'FF'    ; Oscillator Switchover mode enabled
    Is yours different?

    If you want more info on the ASM handling of the USB_INT, I can elaborate some.
    <br>
    DT

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Interesting, I got the same error with your's. Except I had to change it to _FC_MEM

    After further review I see the P18F4550.inc file in my "MPASM Suite" folder shows these configs for CONFIG1H

    Is yours different?

    If you want more info on the ASM handling of the USB_INT, I can elaborate some.
    <br>
    Just checked mine for grins...
    I've got FCMEM in my 4550.INC file

    Also checked the file straight from the .zip file from Microchip, it's the same.

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


    Did you find this post helpful? Yes | No

    Default

    Yup! seems mine is different... looking on another forum thread (12 Bytes code one ) i know we don't have the same MPLAB version... 7.50 Here, MPASM 5.06

    Here's a .inc file quote]
    Code:
    _FOSC_HS_1H          EQU  H'FC'    ; HS oscillator, HS used by USB
    _FOSC_HSPLL_HS_1H    EQU  H'FE'    ; HS oscillator, PLL enabled, HS used by USB
    
    _FCMEN_OFF_1H        EQU  H'BF'    ; Fail-Safe Clock Monitor disabled
    _FCMEN_ON_1H         EQU  H'FF'    ; Fail-Safe Clock Monitor enabled
    
    _IESO_OFF_1H         EQU  H'7F'    ; Oscillator Switchover mode disabled
    _IESO_ON_1H          EQU  H'FF'    ; Oscillator Switchover mode enabled
    and above... with the new CONFIG plah plah...
    Code:
    ;   Fail-Safe Clock Monitor Enable bit:
    ;     FCMEN = OFF          Fail-Safe Clock Monitor disabled
    ;     FCMEN = ON           Fail-Safe Clock Monitor enabled
    Anyways.. it's no surprise at all that Microchip change it from a version to another

    If you want more info on the ASM handling of the USB_INT, I can elaborate some.

    EDIT: i'll download the new MPLAB version and see what's different or Still the same... interesting...

    EDIT #2 : Just remove and re-install V7.50 (No i never download a interim version) and FCMEN is still good. Maybe they discover that Fail safe Clock Monitor Emable make no sense? Same as mixing Moon and Mood :-]
    Last edited by mister_e; - 7th January 2007 at 11:13.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Hmm, I think we have a Spock moment here... "Fascinating!".

    OK, 3AM here, sleep first. ASM Interrupts tomorrow.

    EDIT #2 : Just remove and re-install V7.50 (No i never download a interim version) and FCMEN is still good. Maybe they discover that Fail safe Clock Monitor Emable make no sense? Same as mixing Moon and Mood :-]
    Looks like it's time for an upgrade on my end. Arrrrgh!
    But here, let me shoot the moon first.

    <table width=200 height=150><tr><td bgcolor="White" align=center><b>Censored</b></td></tr></table>
    Whew!, You're lucky that didn't go through.
    <br>
    DT

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

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