Since the USB stuff is coming more and more popular, and as we see more and more questions, i decided to post my little contribution.
OK OK You already asked... but i'm in a good moon today, so let me believe it never been asked before

The whole thing will use a PIC18F4550 and a 4MHz crystal + few Leds, 2 trim pot... you should be able to figure this out easy.
There we go, here's the PC interface,
Sounds good eh?
With this you can
- play with both CCP (PWM) duty cycle and show it on 2 leds attach to your PIC CCP i/o (PORTC.1, PORTC.2)
- modify each PORTB bits status as you wish.
- see the results of AN<1:0> ADC results in the progress bars
- monitor the status of those push-buttons attach to PORTA<5:2> inputs (with pull-down resistors)
- receive text string
- Display your VendorName and ProductName.
__________________________________________________ _____
Darrel Taylor added the following for using the above with PBP v 2.60:
Post#198: http://www.picbasic.co.uk/forum/show...7423#post77423
With the release of PBP version 2.60, mister-e's USBdemo (or any other program derived from EasyHID) will no longer compile (without some changes).
The new way of doing USB with PBP is really nice.
So here's a modification to Steve's program that will allow it to be compiled with PBP 2.60, and hopefully show how much easier it is to do USB.
√. If you haven't already ... download and extract the USBDemo from the beginning of this thread. √. Then create a new folder (USBDemo260) and copy the USBDemo.pbp file from Steve's archive into the new folder.That is the only file that is valid with 2.60, so don't copy any of the others. √. Download the USBDEMOdesc.bas.txt (descriptor) file attached to this post and place it in the same folder. Remove the .txt extension. √. In the USB18 folder, inside your PBP folder ...Copy the following files to the project ... usb_dev.asmusb_dev.incusb_hid.asmusb_hid.inc
usb_mem.asm
√. Add this line to the USBDemo.PBP program ... and compile.
INCLUDE "USBDEMOdesc.bas"
And away you go, with a little Ding-Dong ... Or maybe a Dong-Ding.

Make sure you change the configs if you're not using a 4Mhz crystal.And comment out the UCFG EXT variable since it's not needed anymore. The Visual Basic part of mister-e's demo is the same.You can use the pre-compiled program, or modify it as desired.
___________________________________
Post# 214 http://www.picbasic.co.uk/forum/show...0434#post80434
USBDemo was a good starting point for me, Thanks Steve.
But there are several problems that don't coincide with what you want.
1) When you disconnect the cable, it will still try to send data, causing the PIC to enter a Locked Loop, waiting to send to an inactive bus.
2) You really have no indication that anything was received.
If there's no incoming data, it just goes ahead and sets the dutycycles again, using the old data left over in the buffer.
3) There's no indication of when it's connected, when something was received or when it's ok to send.
4) With the 1mS servicing from Timer0, it's a bit sluggish when enumerating, overall data rates suffer and it uses TMR0 when it doesn't need to.
5) EasyHID no longer works with 2.60, so it's difficult to make changes to the descriptors.
6) I don't use Visual Basic, so I can't update the PC program.
My main language is Delphi, and I stopped using mchip.dll a long time ago.
I would have worked with Steve to build a better demo, but alas, he's not here.
I'm thinking it's time to unveil DT_HID.It's the PIC side of USB, made ... yes, I'll say it ... EASY! The PC side is still up to you, but it even works with Steve's original VB prog, so that, or any other VB/Delphi program from EasyHID can be used as a "template". I'm not even going to tell you how it works.

___________________________________
With file attachement from Post#221 http://www.picbasic.co.uk/forum/show...0611#post80611
OK, this program should work with Steve's original USBDemo GUI.
18F2550/4550, 8Mhz, DT_INTS-18, DT_HID260.
Cheers,
Re: K42 and Timer Interrupts
Thanks for the explanation.
Ioannis - 28th April 2025, 19:28I misinterpreted these paragraphs. My understanding was to have ASYNC cleared and use Fosc/4.
Ioannis