USBDemo, something to learn USB a little bit


Closed Thread
Results 1 to 40 of 279

Hybrid View

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

    Default 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
    1. play with both CCP (PWM) duty cycle and show it on 2 leds attach to your PIC CCP i/o (PORTC.1, PORTC.2)
    2. modify each PORTB bits status as you wish.

    You can also
    1. see the results of AN<1:0> ADC results in the progress bars
    2. monitor the status of those push-buttons attach to PORTA<5:2> inputs (with pull-down resistors)
    3. receive text string
    4. 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!
    Attached Files Attached Files
    Last edited by mister_e; - 31st December 2006 at 02:21.
    Steve

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

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default Question on MCHID.DLL

    Hi Steve

    Thanks for sharing your work with us. I for one have never designed around USB till now, but, have something to back me up now.

    Anyway, I looked at the VB code and have a question. There is a MCHID.DLL on which the code depends. Where do I get this? On the Microchip site or is it something you built?

    I hope you see this the first thing on the 1st morning of the new year. So, I wish you and the community here a HAPPY NEW YEAR in anticipation.

    Jerson

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default USBDemo

    No kidding! I've been a bit weary of trying out a bit of playing around with a PIC and a USB. Previously, I've only used the FTDI chips or the CP2102/2103 combo's. This little application could save me a fair amount of PCB space.

    Question in regards to the onchip transceiver. Where would one NEED or prefer to use an external transceiver for the USB, or, conversely, where would one want to use the internal transceiver exclusively?

    And BTW, thanks a lot, mister_e. Now I've got another project to play...like I don't have enough to play with to keep me up late at night as it is
    JDG

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    No kidding! I've been a bit weary of trying out a bit of playing around with a PIC and a USB. Previously, I've only used the FTDI chips or the CP2102/2103 combo's. This little application could save me a fair amount of PCB space.

    Question in regards to the onchip transceiver. Where would one NEED or prefer to use an external transceiver for the USB, or, conversely, where would one want to use the internal transceiver exclusively?

    And BTW, thanks a lot, mister_e. Now I've got another project to play...like I don't have enough to play with to keep me up late at night as it is
    JDG


    I forgot to order USB connectors. The average project will use a USB Type B Female on the box of the side of the project, right? Example....the 'normal' cable that a person would buy down at the local store has Type A male on one end, and Type B male on the other end, or is that wrong too? I know on the last 2 USB projects I've done (and this was just to get rid of the wrong stuff I bought in the first place), I had to go out and get special cables made up because I bought the wrong gender at both ends with the wrong type (A or B) at each end I done good with that one...

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


    Did you find this post helpful? Yes | No

    Default

    It's up to you guy, you know there's also this tiny model on digital camera ( or PICKIT 2) as well.... i don't remind the name...

    But most of the time, use a 'B type' on the PIC end... if you really want a connector.

    In meantime you can still hack an old USB mouse or buy a few $ USB cable. i got few 6' here in a local electronic store for 2$.

    Please, use an external psu for you tests.... you never know what could happen.

    EDIT.... i thought they could choose a more sophisticated term for those mini-tiny-usb connector... NOP mini-A or mini-B
    http://en.wikipedia.org/wiki/USB
    Last edited by mister_e; - 11th January 2007 at 19:02.
    Steve

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

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Mini- connectors - Those seem to be a bit more prevalent these days as opposed to the older/larger types. Will probably switch over to those in due time. A-type at the PC end, B-type female (mini or not) at the device end.

    External power - yes, most definetly. In the past, I've drawn a small bit of power off the USB bus to charge a small AAA NiMH pack, but the bulk of the power for the circuit comes from the AAA NiMH pack.

  7. #7
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Please, use an external psu for you tests.... you never know what could happen.
    Oh yes I do

    I have a board that I have been working on and had no problems with it whatsoever until I moved it slightly on the computer desk and my daughter had left a metal hair grip on the desk.

    Now have a PC with 4 dead USB ports on the mobo
    Keith

    www.diyha.co.uk
    www.kat5.tv

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Jerson View Post
    Anyway, I looked at the VB code and have a question. There is a MCHID.DLL on which the code depends. Where do I get this? On the Microchip site or is it something you built?
    This DLL comes with Mecanique EasyHID... wich i use all the time to generate those code template. I can't believe it's free

    So just download and install EasyHID HERE and this will solve the problem.

    Quote Originally Posted by Skimask
    No kidding! I've been a bit weary of trying out a bit of playing around with a PIC and a USB. Previously, I've only used the FTDI chips or the CP2102/2103 combo's. This little application could save me a fair amount of PCB space.
    indeed, it's a little tricky those first time, but once you have rebooted you computer over 1000 time to solve the USB connection failure, you learn really fast

    Quote Originally Posted by skimask
    Question in regards to the onchip transceiver. Where would one NEED or prefer to use an external transceiver for the USB, or, conversely, where would one want to use the internal transceiver exclusively?
    Sorry i can't help on that, i never use an external one. But probably THIS or THIS could help ?

    Quote Originally Posted by skimask
    And BTW, thanks a lot, mister_e. Now I've got another project to play...like I don't have enough to play with to keep me up late at night as it is
    Who need to sleep anyways

    You're welcome AND enjoy!
    Last edited by mister_e; - 31st December 2006 at 10:20.
    Steve

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

  9. #9
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post

    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.
    Thank goodness you didn't choose the 18F2550 -

    Steve, nice project, maybe this should be made a sticky in the main PBP section

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


    Did you find this post helpful? Yes | No

    Default

    Hehe, but.. will your PicProgrammer be able to program it ?

    First, i wanted to post it in the USB section... But, Code Examples have to be post in the right section...

    Hope you may use some part of it one day.

    Bear in mind it's only a Demo and a 1-2 hours job.. yeah i count the beer, coffe and cigarette breaks, but remove those phone calls i got when doing it... always like that when you don't want to be disturbed
    Last edited by mister_e; - 2nd January 2007 at 01:43.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Mister_E,

    I fart in your general direction ....

    This is all your fault. I've been totally cosumed by this USB stuff for several days now. I've been so affraid of USB for so long. But after your example showed how easy it is, I've been locked in a never ending cycle of, "hmm, what else can I do with it".

    Consequently, I've accomplished nothing else, "including going to work yesterday"

    I haven't answered your ASM question in the other thread (or anyone elses), I haven't eaten much, and Sleep is a requirement that I would have rather done without (wish I could).

    I'd like to say "Thank you for the great example", but it's ruining my life.

    So instead I'll say ...
    Thanks for the Mean, Vicious, Natsy, Brutal, Sadistic, yet Wonderfull piece's of code.
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Wink

    Disclaimer

    Mister E assume no responsibility for any addictions caused by the use of this actual thread, program, tutorial...
    call it as you want.

    Mister E don't want to be involve in any of your future or actual health, job and/or girlfriend/wife/boyfriend problem!
    So use with care.

    You read it, you use it... it's your problem what's happen next.

    LMAO!
    \_________________________________________________ ________________________________________________/

    <table><tr><td></td><td>Well Darrel i'm really sorry (yeah right), but at the same time... i'm proud of me. At least you lost this USB fear! And i think, for once, i teached you something... ???

    You know, I already said to few user here and there that PIC are addictive... i thought you took the advice... seems not... so
    TOO BAD FOR YOU !
    </td></tr></table>

    Now, go to sleep, eat and go back to work
    Last edited by mister_e; - 10th January 2007 at 06:09.
    Steve

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

  13. #13
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Mister_E,

    I fart in your general direction ....

    This is all your fault. I've been totally cosumed by this USB stuff for several days now. I've been so affraid of USB for so long. But after your example showed how easy it is, I've been locked in a never ending cycle of, "hmm, what else can I do with it".

    Consequently, I've accomplished nothing else, "including going to work yesterday"

    I'd like to say "Thank you for the great example", but it's ruining my life.

    So instead I'll say ...
    Thanks for the Mean, Vicious, Natsy, Brutal, Sadistic, yet Wonderfull piece's of code.
    <br>
    No kidding! I'm looking forward to reducing my sanity, food intake, sleepy time, and probably the wife soon after my 18F4550's arrive. So, if mister_e gets a call in the middle of the night from a screamin' female who he doesn't know, this thread is most definetly the reason why.
    I wonder how long it'll take before he's on the 'Jerry Springer' show as the unseen homewrecker.

    Thanks a lot...
    May the demons of evil get confused on their way to your doorstep!

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


    Did you find this post helpful? Yes | No

    Talking

    So, if mister_e gets a call in the middle of the night from a screamin' female who he doesn't know, this thread is most definetly the reason why.
    No problem then, my phone number is not hidden anyway... But, LOL, maybe she will have to repeat few times and be patient when i will try to reply to her... yeah my english writing is bad... imagine how bad i talk
    Steve

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

  15. #15


    Did you find this post helpful? Yes | No

    Exclamation USB Bootloader for EasyHID driver?

    Is it possible to use microchip´s bootloader since the driver is different than the one from easyHID?

    Haven´t tried but, is it possible to use MCS bootloader (Serial)? i have a version of 4 MHZ for 18f4550 that comes with MCS but i am not sure if this pic program made by Mister_e is runing 4Mhz or more with some PLL (i am newbie with this concept).

    Thanks AGAIN.
    Last edited by Josuetas; - 25th October 2007 at 15:10.

  16. #16


    Did you find this post helpful? Yes | No

    Lightbulb Two devices easyHID?

    Hello, i have done great things with this demo from Mister_E Thanks always. Its a great playground

    Now i made some changes and created my own device, its working already BUT how do i manage two of the same devices with my software? Where are we choosing one from another? if they both have the same ID, etc?

    Thanks for your replies,

    DJC

  17. #17
    Join Date
    Oct 2007
    Posts
    8


    Did you find this post helpful? Yes | No

    Default

    Hi....i'm new in 18f4550..

    Can picbasic pro program this PIC?

    How to open the USB port on this PIC?

    Thanks a lot....

  18. #18
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by thye View Post
    Hi....i'm new in 18f4550..

    Can picbasic pro program this PIC?

    How to open the USB port on this PIC?

    Thanks a lot....
    Read the thread...the WHOLE thread.
    It's all there. A complete project from start to finish.
    Many others have done it, I've done it, you can do it.
    However, I wouldn't expect others to do it for you.

  19. #19
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default Schematic link broken...can you provide??

    Quote Originally Posted by mister_e View Post
    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">
    Steve, the link to the PC interface schematic as posted in your original is broken. Can you please give me a valid link or email me the schematic at [email protected]? I want to check your USBDemo out!

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


    Did you find this post helpful? Yes | No

    Default

    Haven't seen him around for awhile.
    His website is gone too.

    Here's the schematic he had previously posted.

    DT

  21. #21
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Cool

    Hi,

    Last news for me are stamped August, the 14 th ....

    Steve was telling he still need some " quiet " time.

    But do not hope to read from him before " a certain time " ...


    Much Higher priorities thans solving "problems" ( seen quotes ??? ) when solutions just are "in the Manuals".
    May be he "simply" has to take care of himself, ... for once.

    No Forum for that ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 08:55
  2. How to receive stream of bytes using PIC USART
    By unifoxz in forum mel PIC BASIC Pro
    Replies: 34
    Last Post: - 20th June 2009, 11:38
  3. Replies: 9
    Last Post: - 31st July 2008, 09:56
  4. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 01:55
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 02:07

Members who have read this thread : 4

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