USB and PIC programming... ??


Results 1 to 10 of 10

Thread: USB and PIC programming... ??

  1. #1
    Join Date
    Jun 2004
    Location
    Washington, DC
    Posts
    378

    USB and PIC programming... ??

    Hi!

    First off, I'm gonna say that I don't know much about any of this (nor exactly what I need to do), but a buddy of mine wants me to program a PIC for him that would be able to control things plugged into his USB *in Windows, but that's not at all important for this topic )

    Here's the deal: I need to have 8 "switches" into which I could plug just about whatever I want and then he can build a program to run this thing. (I assume he simply means operate his switches). My job would be to actually find out the addresses, etc and make the interface to the USB device. If possible, it would also be great if this thing could be loaded with commands and then unplugged and work off "buttons." As he put it, he's simply looking for a universally programmable controller.

    So, my question is, can you offer me any advice? Where should I start looking to find out as much as possible about PICs? And what about this USB thing? How could I find out USB info? Addresses? How could I control this? I'm just looking for as much advice as possible so that I could get started thinking about the actual programming...

    (BTW I think that this will all be done in Forth, cause I am the most familiar with that and getting assembly out of Forth is easy... And yes, I do know about PICForth I just don't really know about PICs and USB stuff...)

    Thanks again!

    Rinias
    Di mi se mai fu fatta alcuna cosa || Vivir con miedo, es como vivir a medias

    If Linux doesn't have the solution, you have the wrong problem.

    -- mdwatts, Grand Master, >> 40000 posts
    RIP: August 25, 2004

    ***Funky stars and monkey bars***

  2. #2
    Join Date
    Feb 2004
    Location
    austin, tx
    Posts
    145
    i'm not really clear on what you're trying to do still. do you have a specific example of a possible device that might be implemented. from what i read so far is just seems like you want something to allow windows to switch between various usb devices?

    at this point all i can really do it give you the general info that you probably already know of. but if you're just getting started you'll need a PIC programmer to flash the code onto the PIC. i think a usb kit will run something like $60 (you'll need to do some soldering). and a decent emulator so you can test your code first, i use OshonSoftware's PIC Simulator. it's an obscure peice of software but it works great for testing i/o behavior. and of course you'll want the specific data sheet for the PIC model you'll be working with. and i have no clue about the usb stuff.

    sorry if this is all noob stuff to you, i'm not sure where you stand at this point.
    Last edited by flukshun; 01-10-2006 at 01:46 PM.
    Roses are red, violets are blue. All my base, are belong to you.

  3. #3
    Join Date
    Jun 2004
    Location
    Washington, DC
    Posts
    378
    Haha! I hope I didn't come off as knowing much about this, cause I really don't. The difficulty is that this "thing" isn't really my idea and it's not down on paper so it's difficult for me to explain it to others or even imagine it myself... I hope that I clear that up soon or else this is going to be rather difficult. From what I understand, this guy wants something that will, for instance, control a couple of solenoids that he hooks up to it. All it is really, I guess, is a bunch of little switches that can be programmed. Thing is, I think he wants it to be easy to modify the program running the switches, ie we're not building something that will always do the same job but rather a versatile interface for other things. For what? I don't even think he knows Anyway, he's willing to pay for it, so I'm willing to spend some time and effort on it!

    To be quite honest, I first heard the word PIC when he mentioned it today... SO I really don't know anything about it. I had a look at the PICMicro website which helped, and I am looking at Pic Microcontroller Projects by a certain "Myke". The PIC starter kit looks pretty good for getting me off the ground, I think Ill tell him to pick it up.

    Now, if such a thing already exists, I don't know either. I wouldn't even know what to search for, so it would be hard going into Google. I guess we can forget about the USB stuff for a moment cause the important part is going to be figuring out how PICs work and how my friend wants HIS PIC to work... Though I think what we're going for is basically the starter hit which hooks the PIC up to a USB port so that we can tell it want to do. If that's the case, then I'll save time and he'll save money, and I'll tell him to go pick up this kit...

    Unless you have something better in mind?

    Sorry if it's hard to follow, I'm having a little trouble myself
    Di mi se mai fu fatta alcuna cosa || Vivir con miedo, es como vivir a medias

    If Linux doesn't have the solution, you have the wrong problem.

    -- mdwatts, Grand Master, >> 40000 posts
    RIP: August 25, 2004

    ***Funky stars and monkey bars***

  4. #4
    Join Date
    Feb 2004
    Location
    austin, tx
    Posts
    145
    hmm, yah it is pretty difficult looking at this from an abstract standpoint haha.

    but as far as controlling solenoids with switches, that's definetely well within a PIC's capabilities. i'm not sure how solenoids are generally operated, but if it's simply on/off states controlled by a 5V input signal, or even a PWM signal, the logic to control them would be fairly easy. the PIC i'm familar with is a 16F88, which seems like a reasonable choice for this project since there's 16 i/o pins basically controlled by 2 8-bit registers. so you can control these 8 switches of yours by bit twiddling 1 8bit register, which will keep the logic pretty clean.

    here's the data sheet for the 16F88:
    http://ww1.microchip.com/downloads/e...Doc/30487c.pdf

    i will say that'll you'll have a much easier time understanding the data sheet and planning the project if you go ahead and pic up MPASM, since that's what's used throughout the data sheet to illustrate the operating procedures. here's the manual for that:
    http://ww1.microchip.com/downloads/e...INK_33014h.pdf

    i'd use that mostly as reference. a good tutorial will get you up to speed alot quicker. here's one i found really helpful:
    http://www.mstracey.btinternet.co.uk...al/picmain.htm

    even if you dont have any previous assembly experience it shouldnt be to hard to get up to speed. my knowledge is extremely limited but let me know if you have any questions.
    Last edited by flukshun; 01-10-2006 at 03:50 PM.
    Roses are red, violets are blue. All my base, are belong to you.

  5. #5
    Join Date
    Mar 2004
    Location
    Gatineau Quebec
    Posts
    823
    I just got a Microchip Pickit that plugs into usb.
    I checked out http://charm.cs.uiuc.edu/users/olawl...003/microchip/
    and downloaded usb_pickit but am having a problem if I run
    Code:
    usb_pickit flash_4.hex
    It tells me
    Code:
    Found USB PICkit as device '003' on USB bus '004'
    Fatal error> Error setting USB configuration.
    Somehow it seems this should be fairly straight forward; any ideas on how to correct it??

    Thanks!!
    Linux user #367409

  6. #6
    Join Date
    Apr 2003
    Location
    whereever, depends
    Posts
    203
    I work w/ the picmicros for my robotics projects. the programer I have is a warp13 (but its no longer made- you might find a second hand one) any of the kitsrus.com ones will work (the k128, k149, k150, or the k182) as there is a linux driver availible for these (the k150 works the best) also any of the programmers supported by the picp program would work http://home.pacbell.net/theposts/picmicro/ as for the microcontroller the 18F2550 or the 18F2455 have a builtin usb comm. you could also use a 3rd party chip to provide this (just converts the usb to a standard 5v serial) id suggest using relays and/or optoisolation for the controller to protect it (you didnt say much about the loads itll be driving). Id also sugggest using a C compiler/assembler for the picmicros as the asm for them can be a difficult if you dont have any previous assembly experience (both http://www.htsoft.com/ and http://www.ccsinfo.com/picc.shtml make decent C compilers for the picmicro and have linux ver.)
    Somethings are but lost
    to the times of ones conscience

    Til our paths cross again.

  7. #7
    Join Date
    Jun 2004
    Location
    Washington, DC
    Posts
    378
    Thanks so much for the info!!!

    Look, scratch the PIC (for the moment). What I want to do is as "simple" as this:

    1- I plus a USB cable into my laptop, I type the command and hit Enter. There is a LED on the end that lights up. I type another code and this LED turns off.

    2- I have a USB cable with a LED on the end. The LED is hidden (I can't see it). I type a code, and I know whether the LED is on or off.

    I guess that 2 actually comes before 1 (no exestentialism there, btw ) but I would like to be able to both, and the IDEAL (though I know not easy) is that there is no module at the end- just the LED.

    Thanks so much!

    Rinias
    Di mi se mai fu fatta alcuna cosa || Vivir con miedo, es como vivir a medias

    If Linux doesn't have the solution, you have the wrong problem.

    -- mdwatts, Grand Master, >> 40000 posts
    RIP: August 25, 2004

    ***Funky stars and monkey bars***

  8. #8
    Join Date
    Apr 2003
    Location
    whereever, depends
    Posts
    203
    you'll need something to interpret the commands you are sending so you will need some kind of "brains" on the end of the cable. A good place for parts is either digikey.com or sparkfun.com (lots of cool toys at the latter) and batchpcb.com can do a printed circuit board for you. I also hope your "friend" knows what he's asking for. A design&build house would ask for a nice chunk of money for a completed project such as this. Not so sure about the frontend but i think that a simple VB program (believe there are modules for VB) to access the comm ports would take care of that side of it
    Somethings are but lost
    to the times of ones conscience

    Til our paths cross again.

  9. #9
    Join Date
    Jun 2004
    Location
    Washington, DC
    Posts
    378
    Thanks!

    Yeah, unfortunately my buddy does know exactly what he wants- otherwise we would just go out and buy something that exists I'm just a little mechanical engineering student (he's an engineer, also mechanics), and though I don't know much about it, I like challenges What EXACTLY he wants to do with it, I don't know, but he seems to think that the world would be at his feet "if he just had..."

    Haha! I'll take a look at those sites. And thanks again!

    Rinias
    Di mi se mai fu fatta alcuna cosa || Vivir con miedo, es como vivir a medias

    If Linux doesn't have the solution, you have the wrong problem.

    -- mdwatts, Grand Master, >> 40000 posts
    RIP: August 25, 2004

    ***Funky stars and monkey bars***

  10. #10
    Join Date
    Feb 2004
    Location
    austin, tx
    Posts
    145
    Quote Originally Posted by Rinias
    What EXACTLY he wants to do with it, I don't know, but he seems to think that the world would be at his feet "if he just had..."
    sounds like your buddy is designing a usb-attachable quantum computer cluster
    Roses are red, violets are blue. All my base, are belong to you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •