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>
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
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.
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
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
Must be _FCMEN_OFF_1HCode:__CONFIG _CONFIG1H, _FOSC_XTPLL_XT_1H & _FCMEM_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.
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 CONFIG1HIs yours different?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
If you want more info on the ASM handling of the USB_INT, I can elaborate some.
<br>
DT
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]
and above... with the new CONFIG plah plah...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
Anyways.. it's no surprise at all that Microchip change it from a version to anotherCode:; Fail-Safe Clock Monitor Enable bit: ; FCMEN = OFF Fail-Safe Clock Monitor disabled ; FCMEN = ON Fail-Safe Clock Monitor enabled
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.
Hmm, I think we have a Spock moment here... "Fascinating!".
OK, 3AM here, sleep first. ASM Interrupts tomorrow.![]()
Looks like it's time for an upgrade on my end. Arrrrgh!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 :-]
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
Bookmarks