Im learning PIC, dont kill me

Just thought Id post here mainly to get some reactions but also in case anyone else has had the trouble Ive been having. I made judicious use of the month microchip decided to send out free samples without any shipping/handling/misc fees and ordered a few PIC microcontrollers to play with (plus some parts in case the OBDuino project ever ends up working out). And boy, Ive never been more grateful for the arduino development environment.

The PIC scene is chaos, from what my few days of searching have turned up. No matter how many times you tell me, Im not going to program in straight assembler, and Im not gonna shell out several hundred dollars for a new IDE when microchip gives away an amazing one for free. There is a huge dearth from what ive seen of simple getting started tutorials for working with a free C compiler. The one exception is this site: http://www.gooligum.com.au/tutorials.html I would like to give a huge shoutout to David for making such amazing tutorials, and if anyone wants to expand their horizons a bit (if only to gain an appreciation for what you already have), I highly recommend learning from these tut's.

(Btw, the reason im using pics right now instead of arduino is so that I can make my girlfriend a nifty led matrix V-day gift, but dont have any cheap atmegas on hand-darn my procrastination)

I had dabbled with PIC for a while too. A friend had given me a PIC Start plus programmer and I too had ordered free samples. Assembly code is awful! After more grief than anyone should bear, I bought an Arduino. What a wonderful tool! I will NEVER go back to PIC. Do yourself a favor. Order the Arduino now, finish your project with the PIC, and then kick yourself for procrastinating after you've successfully used some of the Arduino example sketches. That will take about an hour after opening the box. :slight_smile: You won't regret buying the Arduino, but you sure will wish you never touched the PIC. Well...maybe it will help you appreciate the Arduino that much more.

Two different subjects are being discussed here. C/C++ Vs Assembly language and PIC Vc AVR.

No argument here that starting out with a higher level language like C/C++ Vs Assembler is a much better and productive route for someone starting out fresh in this hobby. Assembler has it place and if anyone is really interested in how the base processor works, registers, status bits, etc then only Assembler will really unlock all that knowledge, however to just get a newcomer productive quickly then higher level languages are the way to go.

PIC Vs AVR is more of a religious/fan boy thing. Both make good products, and Microchip/PIC seems to be the larger company with a larger product line and user base. If the Arduino team had started with a PIC processor and developed the same IDE I would think it would have not made much of a difference to the existing users. However the the Arduino team, wanting a full open source platform, probably PICed (pun!) AVR because of the open source AVR/GCC C/C++ compiler that they could build on top of.

Lefty

I think Arduino has a far better progression to professional AVR programming, whereas PICBasic teaches you nothing about real PIC programming.

Had a play with Picaxe, which is sort of like arduino (with PIC chips) with a preprogrammed bootloader. Uses basic for prgramming, widely used in British schools because its so cheap. Its simple to get going, runs for weeks on 3 AA batteries, but its fairly limited and not a patch on Arduino.

http://www.rev-ed.co.uk/picaxe/

However the the Arduino team, wanting a full open source platform, probably PICed (pun!) AVR because of the open source AVR/GCC C/C++ compiler that they could build on top of.

That is probably the main reason. I don't know of any open-source PIC compilers (I would love to see an open source PIC Basic compiler).

I started out using the Arduino when I moved my linux workstation to a 64-bit distro (Ubuntu); I had been using an old 32-bit install of SuSE up until then. I was playing with a Basic Stamp 2 (based on a PIC) module I had (from Parallax) using their free tokenizer library and some glue scripting I created for my editor (so I could easily compile and upload to the Stamp). It worked pretty well, and I was beginning to do some serial comms stuff with the Stamp when I migrated.

The tokenizer library Parallax supplied no longer worked - it was written for 32-bit only, and there was only a binary supplied that was statically linked (!) to other libraries on the system, so there was no way to work around it (like using IA32 libs - I tried). I contacted Parallax, and they told me that they had no further contact with the programmer of the tokenizer library and they didn't have the source code, either. I was perfectly willing to compile it myself for 64-bit had they had the source code...

I did some more searching, and found Processing and the Arduino, and was instantly hooked. A quick order thru SparkFun and a week later I had the blink sketch running.

I have been burned too many times by closed source; the only thing I run currently now that is closed-source is the NVidia OpenGL drivers - I'll probably be burned by them someday, too (but what choice do I have for high-speed 3D graphics under linux?).

I have been burned too many times by closed source;

I agree. Even if you find a good fairly priced close source compiler, you still end up having to pay for version upgrades forever. Total full open source both for software and hardware, and being multi-platform (PC,Mac,Linux) is what made the Arduino platform unique in the industry and what any whanna be, (32 bit or not) has to compete against to get my attention.

Lefty

I don't know of any open-source PIC compilers (I would love to see an open source PIC Basic compiler).

There are no PIC Basic compilers, the PIC runs an interpreter unless you burn compiled C or assembler to it.

There are no PIC Basic compilers

Sure there are. PicBasic from melabs.com, XCSB form xcprod.com, and mikroBasic from mikroe.com to name a few.

There are also several C compilers that have "freeware" versions restricted to certain amounts of generated code. I've used cc5x from bknd.com, and found it useful. Also, some PICs are supposedly (somewhat) supported by the SDCC (Small Device C Compiler), which is an open source project. For some reason SDCC doesn't seem very widely used.

There is no definitive reason that an arduino-like system couldn't be build around a PIC instead of an AVR. There have been assorted "near" misses that haven't caught on much (USB Bitwhacker. PicAXE.) Someone has recently been trying to do something similar using JAL as the language (JAL ("Just Another Language") is a sort of C/Pascal hybrid.) It can be diverting to consider the reasons why there have not been big successes in this area...

dont forget that guy who ported arduino onto a pic

oh and I have a 32 bit bitwhacker, I find it extremely frustrating to work with ... not totally on a software side but it eats up an entire breadboard

i would desolder the male pins I have on it, but the pads are so small they would vaporize, and if I put female headers on it, then I cant see which pins are which

and all the ports are scattered all over the place, you might have A13 then G8 next to each other

then the software, you need special versions of the uploader, which no one really tells you unless you go digging around the forums, then magic tricks in mplab

once you finally get it working with each other, you memorized the 1000000000 page pdf datasheet right? been programming pics for a decade using a needle and a 9v battery right

no? well have fun and see ya :-/

The actual technical advantages of Arduino are actually amazing small, considering the massive improvement in usability that they seem to produce. Worth getting philosophical about, since if you can figure out how to do it over and over again, you can probably get rich and solve all the worlds problems at the same time!

Worth getting philosophical about, since if you can figure out how to do it over and over again, you can probably get rich and solve all the worlds problems at the same time!

Heck yea, maybe we should get the Arduino team to help the US congress on a health care bill. ;D

Lefty

Ive actually used arduino for a while now, and have three boards "sorta." I really enjoy the ease of making simple programs because of the hardware abstraction, and that seems hard to come by on the PICs im using. I did finally manage to get a decent C compiler I like and now my project is on track for the big Vday. After delving in tho, I do see a lot of value to going further than arduino, and am glad to have to sparingly modify registers directly.

maybe we should get the Arduino team to help the US congress on a health care bill.

Yeah, right: then we'll be invaded by a wave of tea-party types, flooding the board with GIFs of "Palin 2012" campaign posters, and demanding that the use of Arduinos be banned in U.S. schools because it's open-source, and a stalking horse for "European soshulism" [sic]

There is no definitive reason that an arduino-like system couldn't be build around a PIC instead of an AVR.

Depends on the PIC: the low-end ones are completely unsuitable to an Arduino-style environment, because the hardware can't support C (much less C++) well. Maybe some of the more "upscale" ones can, but I've only worked with the 16Cxx range, so I don't know much about their architecture.

Is there a "sub-family" of PICs that offers the fairly-orthogonal expandibility of the ATMegas?

http://www.hackinglab.org/pinguino/index_pinguino.html

Is there a "sub-family" of PICs that offers the fairly-orthogonal expandibility of the ATMegas?

Yeah; the larger PIC18F series support C pretty well, and could do an Arduino-like platform. They don't have a C compiler with the stature of avr-gcc, though, so it would be more difficult to set up. There are 18F chips with built-in USB and ethernet support. The PIC24/PIC30 (16bit cpus with and without DSP functions) would be VERY interesting (for instance, there's a 28-pin part with two UARTs.) The PIC32 line is based on a MIPS core; a worthy if less popular CPU than the ARMs; well supported by gcc and so on. A PIC32 would be a reasonable candidate competitor for an ARMuino.

I wouldn't mind seeing an Arduino-like environment become a defacto standard for evaluation of smaller microcontrollers, sort of the way linux has become the "big demo" for larger 32bit CPUs. Enough of all these proprietary one-vendor IDEs! Arduino for H8 and Coldfire, anyone? Theoretically possible...

you dont have to fool with it, the link above is a pic 18 with the arduino functions ported to it, so if you want to use a pic with arduino software ...

The Pinguino strikes me more as a "novelty" than a serious alternative to an Arduino: it's I/O-poor by comparison, and reminds me of making the step down from the 68HC11 to the 68HC05. It can be a sensible thing to do, trading increased development costs for a savings in per-unit costs, but it's not the sort of thing you want to inflict on hobbyists looking for easier implementation of their one-off projects.

Einstein said "Everything should be made as simple as possible, but no simpler", and the basic Arduino is pretty darned close to "as simple as possible": just look at the hassles many users go through trying to add an LCD or keypad to a project with a few sensors and servos or steppers. I/O pins, timers, counters, etc., are already "scarce", and I think there are far more folks who'd rather switch to a Mega than something like the Pinguino.

What free demo-sample chip did you ask from Microchip? Any tips?