Yup, that's what I was thinking, having the USB SERVICE come first, and have the USART interrupt 'whenever'.
Edit: WEEE !!!
Robert
![]()
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!
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:
Does that make sense? Or can I leave the USB Service interrupt enabled throughout the USB Reception interrupt?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
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!
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.
See there, you're always ahead of me. Was only midnight here.Originally Posted by mister_e
DT
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.![]()
Originally Posted by Darrel Taylor
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!
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
![]()
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!
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.
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!
Bookmarks