Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Yup, that's what I was thinking, having the USB SERVICE come first, and have the USART interrupt 'whenever'.

    Edit: WEEE !!!

    Robert
    Last edited by Demon; - 15th August 2006 at 04:22.
    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!

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


    Did you find this post helpful? Yes | No

    Default

    Darrel,

    How about this one? I have one interrupt to generate a USB Service, that part works fine. I'd like to add another interrupt for USB reception, is that what USB_INT is for?

    Here is a snip of code:


    Code:
    ;----[High Priority Interrupts]-----------------------------------------------
    ASM
    INT_LIST  macro    ; IntSource,        Label,      Type, ResetFlag?
            INT_Handler   TMR1_INT,  _ServiceUSB,    PBP,  yes
            INT_Handler   USB_INT,    _ReceiveUSB,   PBP,  yes
        endm
        INT_CREATE               ; Creates the High priority interrupt processor
    ENDASM
    
    '---[USB - interrupt handler]------------------------------------------------
    ReceiveUSB:
       @ INT_DISABLE TMR1_INT   ; disable USB service interrupt
       USBBufferCount = USBBufferSizeRX 
    DoUSBIn:
       USBservice ; Generate USB Service manually
       USBIn 1, USBBuffer, USBBufferCount, DoUSBIn
       varUsbIn = conByteHigh  ' Set flag data has arrived
    @ INT_ENABLE  TMR1_INT   ; enable USB Service interrupts
    @ INT_RETURN
    
    '---[TMR1 - interrupt handler]--------------------------------------------------
    ServiceUSB:
        USBservice
    @ INT_RETURN
    Does that make sense? Or can I leave the USB Service interrupt enabled throughout the USB Reception interrupt?

    Robert
    Last edited by Darrel Taylor; - 15th August 2006 at 07:45. Reason: added [code][/code] tags
    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
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    almost 3 Am here.. it sounds good to me BUT i'll suggest to remove the USBSERVICE in the INT handler... m i'm sure i miss something anyway...
    Last edited by mister_e; - 15th August 2006 at 08:04.
    Steve

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

  4. #4
    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
    almost 3 Am here..
    See there, you're always ahead of me. Was only midnight here.

    DT

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


    Did you find this post helpful? Yes | No

    Default

    Well, I don't really know.

    But, the datasheet for the 18F4550 shows 12 different interrupts from the USB module that all funnel into the single USB_INT. So I doubt it's that easy.

    But if I were going to try it, I might set the ...

    TRNIE: Transaction Complete Interrupt Enable bit

    and see what happens.

    DT

    Added: and then all the others just to be sure.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor
    Well, I don't really know.

    But, the datasheet for the 18F4550 shows 12 different interrupts from the USB module that all funnel into the single USB_INT. So I doubt it's that easy.

    But if I were going to try it, I might set the ...

    TRNIE: Transaction Complete Interrupt Enable bit

    and see what happens.

    DT

    Added: and then all the others just to be sure.

    WHAT DO YOU MEAN "You don't know?"


    Hmmm, I would tend to believe that flag does not distinguish between upload and download transactions; I really need a PC-to-PIC complete flag.

    Well, since I have an interrupt controlling user input on the PIC, I can just loop the PC-to-PIC USB routine. This will make things much easier to manage, I'm not very fond of using that all-encompassing USB_INT interrupt.

    Now if I can only find out why Windows won't recognize the device, things would be peachy:
    http://www.picbasic.co.uk/forum/show...8&postcount=55

    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!

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


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel,

    I've found out why my device is not recognized, the USBSERVICE interrupt is either not working fast enough, or not working at all.

    I used the generated PBP program from EasyHID to test the interrupt logic. If I comment out the default USBSERVICE the device is not recognized, and then it works if I reinstate them. Any idea what I'm doing wrong?

    Robert
    Attached Files Attached Files
    Last edited by Demon; - 18th August 2006 at 17:29.
    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!

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


    Did you find this post helpful? Yes | No

    Default

    i can't try it here now, but here's a couple of suggestions.
    Code:
    ProgramStart: 
    '   gosub DoUSBIn ; remove it
       gosub DoUSBOut
       goto ProgramStart  
    
        
    DoUSBOut:
    '------- Disable INT here
       USBBufferCount = USBBufferSizeTX
       USBOut 1, USBBuffer, USBBufferCount, DoUSBOut
    '------- Enable INT here
       return
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    I LOVE YOU mon maudit francais. :P

    That was it, you can't mix the interrupt in there for some reason.

    So now I disable the interrupt just before the GOSUB and ENABLE right after.

    Robert


    EDIT: By the way, you forgot the USBSERVICE in DoUSBOut.
    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!

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