1 Attachment(s)
USBDemo, something to learn USB a little bit
Hi all,
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,
<img SRC="http://www.mister-e.org/Pics/USBDemo.JPG">
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.
You can also- 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.
So almost everything EASY will be covered in both code.
I tried to stay away of the cryptic-fashioned coding but i couldn't resist to use some macro etc etc. Eh, maybe you'll learn from it? Who knows?
In attachment, you'll find ALL FILES. PBP source code and VB6 source code AND a ready to run USBDemo.exe file. Everything is hardly commented so, read it carefully... it won't hurt!
The original folder was c:\PBP_PROG\USBDemo but it shouldn't cause any problem... well i guess. If so, you know where to send them.
NOTE: If you're going to use LONG variables, you MUST copy the PIC18Xxxxx.BAL file in your source directory as well, unless you'll receive some compilation errors.
The .BAL file is located in \PBP\USB18 directory.
Those who want to use PIC18F2455, 18F2550, have a look at post 99.
http://www.picbasic.co.uk/forum/show...8&postcount=99
Enjoy!
Got CDC driver working!!!
Mr_E
Yeah ok well thanks for your input anyway - always welcome I'm happy to edit the the .inc file and leave it at that.
Great news! I finally got the CDC virtual comport working!!!!!!
Now I can send data via USB (virtual comport) and out of the Pic 18F4550 USART! and vice versa!
I'm stoked that this actually works!
Squib