Where to start with programming PICs?

Started by NeveSSL, July 22, 2005, 01:31:30 AM

Previous topic - Next topic

NeveSSL

Hi all!  I figured this would be better than the lounge.  :)

I have a bit of programming background, and I'm a computer geek (just like, I'd be willing to bet, a LOT of the rest of the population here ;) ) and I was wondering if any of you guys had any recommendations on getting started PIC programming?  

I'm specifically wanting to do some stuff with MIDI, and PICs seem to be the way to go, specifically the 16F84's.  Any thoughts?  I'll be taking some classes not too long from now, but I'd like to get a bit of a jump-start if possible.  I also have a $25 gift card to Barnes and Noble that is burning a hole in my wallet that I'd love to use if possible.  :D  Thanks!

Brandon

travissk

You might want to take a look at the different makes of uC's out there - PIC and Atmel are pretty much the standards. I believe that PICs have been losing market share to Atmel for some time, and because of this, samples.Microchip.com will send you free samples of PIC's. This includes the new DSPic line, which is a hybrid DSP and uC. I took a look at the datasheets for those, but decided that I'd stick with normal PICs and the ATMegas.

If you're opposed to samples, you can get these from most online electronics sellers. I've gotten uC's from ebay and futurlec.com just fine, though futurlec seems to be taking too long with orders these days.

If you go with PIC's, you might want to use the newer 18x series. They're not that much more expensive (still free if you go the samples route; 1 or 2 should be enough to get you started since they're reflashable), and you get more features and some future-proofing. Still, when all is said and done, they remain 8-bit microcontrollers when compared to the 16- and 32-bit competitors. They're plenty powerful for most MIDI/switching/etc apps, but perhaps someone who works with uC's more frequently than I can speculate on where everything's going. I've been busy with school for the past couple years and just use my stock of PIC 18F's and ATMega16's when I need uC's), so I'm probably missing out on the state of the art :).

ucApps.de is a popular site that has some MIDI-related open-source projects. They now run on the Microchip PIC18F452, if I remember right. Some of the projects are backwards-compatible to the 16x series. It's all based around a "Midi OS" that you can use to create your own custom apps; most people use this to create homemade control surfaces, but their projects also include a MIDI footpedal/patch selector and a synth that is based on the 6581 SID chip found in Commodore 64's.

If you have some experience with assembly, it might be fun to jump in and read through the MIOS code and guide on ucapps.de. I think they also have an API if you want to integrate their code into your C-based compiler, but I don't know of a free one for PICs.

The ATMegas (and maybe PIC's?) are targeted by some gcc distributions; we use this in some of our music technology courses here, and while it's a linux-based setup, I set up gcc for the atmels on my personal windows machine for a MIDI-controlled flamethrower project (for an experimental music technology class) :twisted:. Let me know if you need help with this setup.

I think I forgot to mention that there are also options from TI, Motorola, etc. I've heard the easiest introduction to microcontrollers is the "BASIC Stamp," but with the ucapps.de stuff out there, I'd at least consider PICs if you're interested in MIDI programming.

Good luck!

Peter Snowberg

As a product designer, I've been playing with PICs since the early 1990s and AVRs for the last three years.

At this point I would say GO ATMEL. :)

Being able to debug with JTAG is WONDERFUL!!!!!!! 8) 8) 8) 8) 8)

When I was in my PIC heyday, there were only 5 PICS to choose from.... now there are 50,000,000 different chips. The dsPIC looks cool for special applications, but I'm sticking with AVRs for the speed, features, flexibility, and ease of programming.

I used to be a PIC zealot (when 8051 was the "other" main choice). I still hate the 8051, but my new love is Atmel.
Eschew paradigm obfuscation

NeveSSL

Hey guys!  Thanks so much for the replies.

So Atmel is the way to go, huh?  Can you build their programmers at home as easily?  Also, since I have software for a MIDI switcher that's already been made for a 16F84 and have access to the source code, would it be easy to convert the code or would it be better just to leave it alone?

I'll have to check out ucApps.de a little more closely now that I understand more of what it's about.  I had been there, but didn't really take the time to dig into it.  Some of those MIDI controllers those guys are building are amazing!  Needless to say, I suppose, I'm interested in those, too, especially going to school for recording next semester.  ;)

What school are you going to, travissk?  I'll be attending Middle Tennessee State University (I finished my gen ed at a community college) next semester majoring in Recording Industry and Minoring in Electro-Acoustics and Aerospace (I want to get my private pilots certificate).  :)

Thanks again for the replies!

Brandon

niftydog

for what it's worth, microchip aren't offering samples because they're loosing market share. They have always been very open to sending samples, at least in the time that I've been using PICs.

Translating code is not usually a simple task because they use very different operands and doing the same task on two micros often requires a different approach.

For features, I would say go Atmel, but having never used them myself I can't really say much more. However, PICs are a far more mature technology and you may find they are cheaper, more prevelant and easier to find literature on than the Atmels.

I can't speak for the Atmel website, but the microchip datasheets and application notes are an excellent free resource. So too is //www.piclist.com once you get the hang of the place.
niftydog
Shrimp down the pants!!!
“It also sounded something like the movement of furniture, which He
hadn't even created yet, and He was not so pleased.” God (aka Tony Levin)

Peter Snowberg

Eschew paradigm obfuscation

Ethan

Hi, If you are a beginner, go with the pic.  Here is a great book:   It gets you up and going fast using PIC_BASIC language. You will have to buy a PIC_BASIC compiler though, for about $70 and the EPIC programmer for about $35.  You will soon figure out to design project that suit your needs.

http://www.amazon.com/exec/obidos/tg/detail/-/0071437045/qid=1122323820/sr=1-10/ref=sr_1_10/002-3638051-2073622?v=glance&s=books

If you want to program in C, here is a good CD I ordered:
http://www.elexp.com/trn_ccst.htm.

-ethan

NeveSSL

Thanks for the replies, guys.  I'll sift through everything tonight and get back with you guys.  Thanks!

Brandon

David

There is a project on www.ucapps.de called the Floorboard.  It is a MIDI controller unit.  What makes it interesting to me is that it will send MIDI note numbers if you assemble it with a certain directive active.  If this were implemented, it would be a real simple, compact way to implement bass pedals by driving a NanoBass.

The only flies in the ointment are:

It can only implement 12 pedals -- the pedalboards I've seen have 13.
It would be really cool if you could select the octave -- like a momentary pushbutton toggling a 4017 to select one of the unused inputs on the PIC.

I posted these questions at the MIDIBox forum -- about two weeks ago.  Yesterday I finally got a response -- that my question should go in the MIOS forum.  ARRGGGGHHHH!!!!!  I doubt I'll get an answer there since this isn't a MIOS unit!

Here is what I posted there:

 Stupid question about old Floorboard project
« on: 2005-07-14 at 18:22 »    
Embarrassed newbie here.  I live to play guitar, but I make my living coding software, so PICs don't scare me too much.  I need to make a set of bass pedals to use at church.  Since I just snagged an Alesis NanoBass, that dictates that my project will take the MIDI approach.  The old Floorboard project here looks like it's 97% of what I need.

I just have one teeny, tiny stupid question.  Upon reviewing the button code with the USED_AS_KEYBOARD assembler option, I note that this will generate notes C through B.  I'm hoping to adopt an actual organ pedalboard for my task, so I have 13 pedals to give me a full octave.  I need to implement one more pedal.

Is there anything keeping me from creating a modified version of the button code that starts from the D3 pin instead of the D4 pin and implements a 13-bit instead of a 12-bit shift register?  Would it be OK with the designer if I did so?  This unit is for my personal use only.  I just want to build it, get done and get back to playing!

While we're on the subject, would it be possible to add switches to some of the other unused pins to implement multiple octaves?

I hope my writing is clear.  Electronics is not my strong suit and my writing is very idiomatic when I'm excited about something.

Thanks in advance for any help!

Could one of the PIC experts here (Peter, Chico, Andrew, et. al.) please help the prodigal son out and look at this project?  I don't need or want to know HOW to add the 13th pedal -- I can figure that out.  I just need to know if it CAN'T be done.  As long as it can, I can go from there.  I've got a programmer and MPLAB.  You guys could probably figure this out in a heartbeat.  That forum seems to have some very smart people, but their arrogance factor is off the scale!