Newbie at PIC/microcontroller programming

Discussion in 'Mac Programming' started by not batman, Jun 26, 2006.

  1. macrumors newbie

    Joined:
    Jun 26, 2006
    Location:
    Toronto, Canada
    #1
    Sorry since there is already a thread about programming microcontrollers, but I thought it better to make a whole new thread rather than hijack that one.

    Basically the most experience I have with programming is a bit of very simple Basic Stamp work. I'm an art student and programming isn't really my forte, but after taking an electronics class at my Uni I have become very interested in integrating electronics into my work.

    I am getting pretty comfortable with programming my Basic Stamp (through the program MacBS2 http://www.muratnkonar.com/otherstuff/macbs2/) but I like the idea of how cheap PIC chips are. I don't really like the idea of having to shell our ~ $50 every time I manage to make and sell another electronic piece of art.

    SO! Getting to my point (finally :p) I want to learn to program PIC chips, and I want to do it on my Mac. I don't know if there is some way of programming them in some sort of Basic language, since I have no clue at all about programming in C, but I am sure I can learn pretty quickly and pick things up as I need to know them.
    If anyone could point me to some resources, tutorials, anything at all. Heck, even just tell me to give up now and stick with the Basic Stamp if you think that would be most appropriate. Really, anything to get me started on the way of programming PIC chips/microcontrollers would be greatly appreciated.

    Thanks a lot in advance!
    And if there is any more information as to what experience/equipment I have available I would be happy to divulge such details.
     
  2. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #2
    Sounds like you would really benefit from biting the bullet and learning C or Assembly and working with PICs. My limited PIC experience has been using Windows based tools so I can't be of much direct assistance, except to say look to the linux community for lots of help that could be portable to OS X...

    What kind of stuff do you want the PIC to be able to do in your art.

    B
     
  3. thread starter macrumors newbie

    Joined:
    Jun 26, 2006
    Location:
    Toronto, Canada
    #3
    Yeah, I have been thinking that I will just have to just buckle down and learn C, but kind of hoping there would be some easy way out. :p

    Do you have any recommendations for getting started? It would be awesome if you did.

    As to what I want to do with the PIC in my art, I mostly want to be able to make mass produceable, interactive art. I'd like to be able to have installations that can respond to user input or work "autonomously." I'm not exactly sure what I want to do quite yet because I don't really know exactly what I can do with PICs.
     
  4. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #4
    I'd buy the MPLAB ICD 2 and a PICDEM 2 Plus demo board from MicroChip. Then download the demo/student edition of the C-compiler and enjoy.

    The combination will set you back ~US$250 and requires Windows :( , but once you have it you have a full featured in-circuit debugger which'll help you figure out what is wrong. Custom boards for specific application can be built and populated extremely cheaply, you can even design online at places like http://www.pad2pad.com/

    B
     
  5. macrumors 6502a

    csubear

    Joined:
    Aug 22, 2003
    #5

    If you are going to do pic development then the icd 2 is the way to go. You can get a cheap knock-off here: http://www.olimex.com/dev/index.html

    Also, buy a cheap pc. Its way better than try to get virtual pc and the like to work.

    I've done a little PIC development, and they are fun little devices. A friend of mine suggested the AVR mircocontrollers. I guess you can cross compile binaries for them using gcc.
     
  6. thread starter macrumors newbie

    Joined:
    Jun 26, 2006
    Location:
    Toronto, Canada
    #6
    Thanks for those suggestions, I'll try to determine what will work best for me.

    I guess there are no real options for using my Mac? Hmm... I guess I'll have to work harder on getting my girlfriend to give me her IBM Thinkpad and replacing it with a Macbook...

    Thanks again!
     
  7. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #7
    I think that once you have it all working using the Windows tools you can make one of the Mac/unix tools work too, but learning on one of the slightly rougher tools might be a stretch.

    B
     
  8. macrumors newbie

    Joined:
    Feb 3, 2005
    #8
    Don't despair! There are always options.

    If you want to use your Mac to do the programming then it's worth considering a PICkit 2. It uses USB so you'll definitely be able to connect it to any Mac. You'll have to use command line tools to operate it but the latest version of PK2 works very well on MacOS and has a native driver.

    As far as languages go you might have trouble finding a PIC C compiler for MacOS but you can get a good quality assembler, GPASM, for free.

    All of these tools will require a certain amount of effort to setup. Nothing major but if you've never compiled anything before it may frustrate you. If you have any savvy friends they may be able to help.
     
  9. macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #9
    Why PIC? If you are talking about "installations" these are large pieces arn't they? You don't need the PIC for it's small size. Why can't you se a PC. Yes a full up PC. Find one that run with no fan, no monitor or keyboard. Run Linux on the PC. If you value your time ease of programming maers. PCs are close to free. Maybe old Pentium II notebooks? Linux PCs are very much like Macs and ship with much of the same software and you can program them in BASIC, C, Perl or whatever you want.
     
  10. thread starter macrumors newbie

    Joined:
    Jun 26, 2006
    Location:
    Toronto, Canada
    #10
    Those sound like great options, thanks for suggesting them!

    I have considered a PC, and while it would be a fine option for larger scale installations I have been working lately on smaller pieces that can be deployed into public places and so I need small and cheap. I wouldn't mind if someone made off with ~ $30 worth of electronics and hardware, but a whole PC is is too much for me to risk putting out in the world.
     
  11. macrumors newbie

    Joined:
    Jul 30, 2006
    #11
    >I wouldn't mind if someone made off with ~ $30 worth of electronics and
    >hardware, but a whole PC is is too much for me to risk putting out
    >in the world.

    don't rule it out. you can get a decent computer for free very easily. i've gotten several right off the sidewalk on trash day, at the recycling center, etc. craigslist is good for free and dirt cheap stuff like that too. i'm also an artist and honestly, i think of a whole PC before a microcontroller anytime possible - the programming is already something i know more about and it makes other things simpler .. troubleshooting on site by bringing a monitor/keyboard along maybe, ease of replacement of something breaks (new free PC with a copy of the boot disk in it), no power issues - you just plug it into a regular outlet.

    good luck,
    rahji
     
  12. macrumors newbie

    Cephus

    Joined:
    Jun 22, 2008
    Location:
    Salt Lake City, UT
    #12
    MPLAB 8 and an ICD2 or PicKit 2 works fine under Parallels with my MacBook. I'm just beginning to learn C and using the free educational C compilers offered by Microchip or Hi-Tech.

    It took no special configuration to get the USB PIC devices to work other than to tell Parallels to port them to the virtual machine.

    I'm still holding my breath that Microchip will eventually port MPLAB to OS-X.
     
  13. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #13
    I think this should be nominated for one of the oldest resuscitated threads. When this thread was started there were only iMacs and MacBook Pros on intel, and parallels wasn't yet available.

    I'm not trying to indicate that the information provided was not useful, only that I suspect the OP has come up with some solution by now.

    -Lee
     
  14. macrumors newbie

    Cephus

    Joined:
    Jun 22, 2008
    Location:
    Salt Lake City, UT
    #14
    Entirely my fault! I was searching for programming the PIC with OS-X rather than Windows and failed to notice the date of the post I replied to.

    Sorry about that! :)
     
  15. macrumors member

    Spinnaay

    Joined:
    May 14, 2007
    #15
    Hi there,

    Just wanted to drop in and see if there had been any updates on this over the last few years?
    I would really love a way to program my PIC's from Xcode on my macbook.

    Thanks

    Thom
     
  16. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #16
    Holy thread re-resurrection Batman! It just won't die. ;)

    Paralles/VMware still seems like the best bet. You can still use Xcode as your editor though...

    B
     
  17. macrumors 603

    notjustjay

    Joined:
    Sep 19, 2003
    Location:
    Canada, eh?
    #17
    Cheap netbooks might work out well too. The concept of a $200 Windows laptop was unheard of a few years ago.
     
  18. macrumors member

    Joined:
    Jan 2, 2009
    #18
    I've done a little PIC programming with Hitech C and a PicKit programmer. It's a commandline compiler, but I wrote a little cocoa wrapper for it so's I can click buttons rather than type commands to compile and load the hex files.
     
  19. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #19
    Shows it's been a while since I looked at it, but there was no Hitech C for Mac OS (only Windows and Linux) the last time I checked. (Which doesn't seem that long ago...)

    B
     
  20. macrumors member

    Spinnaay

    Joined:
    May 14, 2007
    #20
  21. macrumors newbie

    Joined:
    Feb 22, 2010
    #21
    An alternative approach?

    I am running a Microcontroller class for students on an HND course where they are designing and producing an electronic sculpture for the local art gallery. All the work is being done on Macs.

    Our platform is Arduino (http://www.arduino.cc) which is available on Windows, Mac and Linux. Boards (complete with USB) can be purchase for around £20 and the components to build a custom board for under £10.

    Custom PCBs are being designed using Fritzing (http://fritzing.org).

    The development cost is a fraction of using PICs plus programming is done in C using the dedicated IDE.
     
  22. macrumors 68030

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #22
    I do like Arduino quite a lot, but I would argue that PICs are cheaper if you want to do more than just a couple of custom installations.
     
  23. macrumors newbie

    Joined:
    Feb 22, 2010
    #23
    The benefit of Arduino is the massive online support plus complete cross-platform support. I looked a PIC a while back. If anyone can suggest a PIC solution as easy to work with as Arduino I will certainly be taking another look...;)
     
  24. macrumors 603

    Joined:
    Aug 9, 2009
    #24
    Welcome to the world of recurring vs. non-recurring costs.
     
  25. macrumors 65816

    Muncher

    Joined:
    Apr 19, 2007
    Location:
    California
    #25
    Arduinos can be quite cheap too, if all you need is the chip itself. Technically all an "Arduino" is composed of is an Atmel microcontroller with a bootloader.

    Look at Sparkfun's website. They sell all manner of arduinos in various stages of completion and size.
     

Share This Page