USBDemo, something to learn USB a little bit


Closed Thread
Page 1 of 7 12345 ... LastLast
Results 1 to 40 of 279
  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 01: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
    953


    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
    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 09:20.
    Steve

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

  5. #5
    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

  6. #6
    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 00:43.
    Steve

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

  7. #7
    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

  8. #8
    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 05:09.
    Steve

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

  9. #9
    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!

  10. #10
    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.

  11. #11
    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...

  12. #12
    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 18:02.
    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

    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.

  14. #14
    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

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


    Did you find this post helpful? Yes | No

    Default

    and unless you want to waste your time debugin it... maybe it's just some blown pcb tracks...

    A in-line fuse could be used as well, but i stick with the external PSU.

    To do this one i used Mikroelektronika a EasyPic 4 board.

    Nice board, but the on-board programmer fail sometime with 18Fs device.
    Last edited by mister_e; - 11th January 2007 at 19:38.
    Steve

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

  16. #16
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Default

    Bravo, Bravo, Bravo!!!

    Steve that EasyPic 4 board looks fantastic! I see that it has an add on PLCC programming kit but in your experience can it program the PIC18F4550??

    Has anyone made a test PCB for this yet and willing to post on site?

    Cheers
    Squib.

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


    Did you find this post helpful? Yes | No

    Default

    The on-board programmer work with most PIC. The 18F4550 also work... but sometime it fail to program at the first time, you just need to reprogram it once again... no big deal but sometimes annoying.


    I don't have the PLCC board, but it should work... it's just an adapter, so i don't see why it shouldn't work... unless the programming pins are not at their usual places...
    Last edited by mister_e; - 12th January 2007 at 03:11.
    Steve

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

  18. #18
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    The on-board programmer work with most PIC. The 18F4550 also work... but sometime it fail to program at the first time, you just need to reprogram it once again... no big deal but sometimes annoying.


    I don't have the PLCC board, but it should work... it's just an adapter, so i don't see why it shouldn't work... unless the programming pins are not at their usual places...
    I made an adapter for an '8722 awhile back that puts it in a 40pin 18F socket using a 40 wire ribbon cable on an IDC socket (think '452 with a load more memory), and another 40pin dual row to get to the rest of the pins. Do you think that would work in this? It worked in my mp3 player.

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


    Did you find this post helpful? Yes | No

    Default

    In theory... all 40 pins device have the programming pins at the same place or the EasyPic 4 would have a second 40 pins dip socket.
    Steve

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

  20. #20
    Join Date
    Sep 2003
    Location
    INDIA
    Posts
    161


    Did you find this post helpful? Yes | No

    Default

    Here's a small contribution from my end to support the good work.

    Thank you steve for the help

    regards.
    Attached Images Attached Images

  21. #21
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by charudatt View Post
    Here's a small contribution from my end to support the good work.

    Thank you steve for the help

    regards.
    And I would think that a similar dev board for a '4550 would be practically the same except for the obvious pin differences...
    I hope so...'cause that's what I'm building...still waiting on the '4550's though...

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


    Did you find this post helpful? Yes | No

    Default

    Sure,

    There's just a little something i would point so far. Yes the 1.5K is recommended if you don't enable the internal one as i did. Now i think the generic code do it for us... but for safety sake i did it in mine. the two 100nF could be replace with a 470nF. In some occasion it seems to be better when using a higher value. EasyPic 4 use 2X110nF but i changed it. It's just for safety sake so far. If it's working for you... use it

    Now, the Darrel's code mod comes really handy. It free 1 timer... really interesting...

    Instant Interrupts - Revisited, post 148
    http://www.picbasic.co.uk/forum/show...&postcount=148

    Thanks to everybody posting in here!
    Steve

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

  23. #23
    Join Date
    Jan 2007
    Posts
    70


    Did you find this post helpful? Yes | No

    Default 470nf cap substitute?

    Does anyone know if i can substitute a different value for the 470nf capacitor that pulls the usb+ to vcc? Somehow I haven't got any nf value capacitors - plenty of pf, uf...

    I read a post somewhere at some point where a guy said he was using a 2.2uf and it worked ok.

    Thanks

    Robert

  24. #24
    Join Date
    Jan 2007
    Posts
    70


    Did you find this post helpful? Yes | No

    Default usbdemo troubles!

    Hey!

    First, Mister E, thanks so much for putting this together, I can tell it will be a huge springboard for me, if i can ever get it to work!

    I already mentioned that I am using a 10pf capacitor instead of the 470nf one specified. I haven't got any nf capacitors at all! oi!

    Anyways, i loaded the included .hex(still cant compile it from source) and my computer recognizes an 'unknown usb device', not a HID device.

    Ive got a 4mhz resonator on there.. i tried it with a 20mhz and it didn't seem to do anything.

    Any advice please?! I took the day off work to do this stuff today, and it is frustrating!

    Thanks!

    Robert

  25. #25
    Join Date
    Jan 2007
    Posts
    70


    Did you find this post helpful? Yes | No

    Default thanks for the help

    i got it to work! Now to understand it all! Not to mention get it working alongside a USB bootloader.

    Thanks for the example. The code looks excellent. Way beyond anything I can conceive of.

    cheers.

  26. #26
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Talking Works a treat!!

    Yep got mine working today too!!! Woo Hoo!!

    Golly gosh, loaded Mr E's sample prgram, connected the USB cable and Presto - Windows detected it and it started to work first time!!!

    On the demo PCB I added a serial connector so that I can program the 18F4550 via serial ICSP, and also added a couple a RS422/232 line driver receiver so that the PC can communicate via USB to serial devices.

    I'm sure I'll have more to add once I've played around with this toy some more.

    Cheers
    Squib.

    See photo attached.
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default

    Now there's a circuit that made for the mister_e USBDEMO.

    Uhhh, let me guess.

    USB to DMX convertor?
    <br>
    DT

  28. #28
    Join Date
    Jan 2007
    Posts
    70


    Did you find this post helpful? Yes | No

    Default

    hey squibcakes - nice demo board..

    question... you have 3 LEDs by you USB port, is one an activity indicator by chance? I want to put a activity LED on my USB, and was wondering if that is what you have there..

    what do you plan on doing with that board, just learn? i considered building a special purpose mister e pcb as well.. but didnt.. instead i put most of the circuit on a protoboard from demicro.com, and the rest is on a breadboard with leader from sockets i put on the protoboard IO..

    that code mister e posted is.. yeah... have you got any plans to move it into .net? i may start a seperate thread detailing my progress attempting to convert the usbdemo software from vb6 to .net... i dont know if i can do it without help...

    thanks!

    Robert

  29. #29
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Default

    Hi Vacpress,

    The Two LEDs are for the PWM output and the Other green led is just connected to Vdd to indicate that there is power on the board.

    I built the board for two reasons -
    1. Get a grip on all this USB stuff
    2. Use it as a programmer for these chips.

    I added a DB-9 / Max3486 chips so that I can learn a bit about serial to usb as well.

    Now can someone please explain how to use Microchip's CDC? http://www.microchip.com/stellent/id...param=en022625

    No plans for Dot net. We use PowerBasic around these parts.

    Cheers

  30. #30
    Join Date
    Jan 2007
    Posts
    70


    Did you find this post helpful? Yes | No

    Default

    powerbasic. cool... i wish i wasnt addicted to the VB language...

    if vb would compile for mac like powerbasic does i would be extremely happy.. in the meantime ive downloaded so much stuff in an attempt to learn cross compatability... and never really got too far, as i havent got a mac so it is no fun..

    hehe... you must use power basic cuz its free... i like .net express for the same reason!

    how is the usb battle going? any luck comprehending the usbdemo code? it sure looks different from my picbasic code!

    currently i am trying to find the best usb bootloader, hopefully one that has code for the PC side as who knows, I may eventually develop something marketable!

    carry on
    -robert

  31. #31
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Default

    Yeah your right it is a battle!

    Couple of things.,... I am finding that jumping straight into USB with these 18F chips may be a bit ambitious.

    These 18F series do seem to be a bit more complex than your average 16F chips.

    Just getting my head around the config fuses and using mpasm as opposed to using PBP Compilier is mind boggling but I think I got it.

    At this stage I'm just trying to get the 18F to flash the LEDs and stuff LOL!

    On another note, I tried to compile Mr E's usbdemo.pbp file and I get all soughts of errors. Any idea why? I mean the hex file works, but cant I compile his pbp file. I want to make sure that I can get the basics working first.

    I tried tiny bootloader which apparantly supports 18F4550 chips but couldnt get it to work yet.


    Squib

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Squibcakes View Post
    On another note, I tried to compile Mr E's usbdemo.pbp file and I get all soughts of errors. Any idea why? I mean the hex file works, but cant I compile his pbp file. I want to make sure that I can get the basics working first.
    mmm, i suspect those usuals
    1. upgrade your MPASM version
    2. comment all default PBP config fuses in the 18F4550.inc file, AND if you don't have PBP 2.47, modify the LIST line to.....
    Code:
            LIST p = 18F4450, r = dec, w = -311, w = -230, f = inhx32
    once done, if everything is in the same directory, it MUST work!3

    for the Tiny loader, i know there's some DEFINEs to add... wich? i don't know, i don't and won't use it.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by vacpress View Post
    how is the usb battle going? any luck comprehending the usbdemo code? it sure looks different from my picbasic code!
    What's not clear enough?
    Steve

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

  34. #34
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Default

    HI Mr E,

    Yep tried that but still get those errors BTW I have Mpasm 5.03, PBP 2.46.

    Anyways after searching the posts the only thing that works is this (I think maybe one of your ideas)....

    Don't use any preset fuses in the main code, and edit them manually in the .inc file. This for sure is working!!!

    I have all the fuses setting in this file, and just REM out the ones I dont use.

    OK after all that, I now have some simple programs working on the demo PCB at last including my serial coms!!!

    Squib

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


    Did you find this post helpful? Yes | No

    Default

    interesting. So i can't confirm if it's a MPASM problem (5.06 now) or a PBP V2.46 problem.

    I know they fixed the config fuse problem in 2.47, but can't say if they have only edit the .INC file (LIST line) or they also change something else.

    Anyways, if it's working
    Steve

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

  36. #36
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Talking 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

  37. #37
    Join Date
    Jan 2007
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Good

    Thanks for your sharing!


  38. #38
    Join Date
    Feb 2007
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Nice

    Thanx for share

    I have a problem when I program the PIC with the version of the zip and that I makes all the connection necessary,
    I connect it on the USB and Windows says to me every 3 minutes Unrecognized device

    20MHz
    10nF on pin 18
    resistor 1k5 on pin 23 ?

    what did I wrong?

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


    Did you find this post helpful? Yes | No

    Default

    This example use a 4MHz crystal (as stated in the code and in post #1), and i suggest something higher than 220nF and you don't need the 1.5K resistor as i set the internal one.

    Now if you want to stick with the 20MHZ crystal, you'll need to modify the first __CONFIG line to
    Code:
        __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    all should be fine after that.
    Last edited by mister_e; - 22nd February 2007 at 01:24.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    For 20mhz, you also need ...
    Code:
        __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEM_OFF_1H & _IESO_OFF_1H
    DT

Closed Thread
Page 1 of 7 12345 ... LastLast

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07: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, 10:38
  3. Replies: 9
    Last Post: - 31st July 2008, 08:56
  4. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 00:55
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

Members who have read this thread : 3

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