# Selecting a micro that can

1. Jan 6, 2010

### Yportne

hey guys...i'm looking for a micro-controller to toy around with. I'm a newbie so bare with me with a couple newbie questions...

Is their a micro that can run straight c code or do I have to do it in assembly?

I need it to be able to store a little bit of data much like a variable stores data...only a few kilobytes worth.

I also need to to be able to do simple computing on the data much like a basic C program could do with logic operators and basic I/O with other parts.

Does this make sense or am I a little lost? I've found many micro controllers but I don't understand their spec sheets and I can't find their assembly data sheet that shows me how to code them :(

I bought and complete a micro-controller education kit that showed me how to code a basic stamp...so i'm kind using that as my basis for micro-controller knowledge. With a stamp I can move a servo, light up LED's change how fast they blink etc.

2. Jan 6, 2010

### Staff: Mentor

All you need is to get a C compiler for the uC that you want to use, and obviously choose a uC that has enough memory for the data storage that you intend.

I think we discussed C compilers for the PIC uCs in a thread a while back. I'll see if I can find it with a search...

Welcome to the PF, BTW!

3. Jan 6, 2010

### ranger

The basic stamp is actually a PIC uC with an interpreter so that you can use PBASIC. PICs or AVR uC can all be programmed very easily using (freely) available C compilers.

Have you looked at the C Stamp?
http://www.c-stamp.com/index2.htm [Broken]

Last edited by a moderator: May 4, 2017
4. Jan 6, 2010

### Staff: Mentor

And here is the search that I used to find it (Advanced Search for the word compiler in any of my posts in the EE forum:

https://www.physicsforums.com/search.php?searchid=1924715 [Broken]

That hit list may give you other ideas...

Last edited by a moderator: May 4, 2017
5. Jan 7, 2010

### Yportne

Hey guys thanks for the replys!

But I have another question. In that other thread posted above they mentioned they were straying from pic's because of the start up cost being say $200 or more for a dev-kit. Can you not just buy a pic, download a compiler and attach it to a breadboard? What is a dev-board? Is that the little circuit board that my basic stamp came with that has a serial port hooked to it to load up your code? Do i need a dev kit for each different pic or is their one kit per family of uC's? 6. Jan 7, 2010 ### vk6kro If you don't need great speed and can program in Basic, have a look at Picaxe chips. The language is very much like the Stamp but the chips are nowhere near as costly. The chips cost about$5 to $20 (depending on type) and the programming editor is free. The cable from your computer costs about$10 to make or you can use an old serial mouse cable. It only uses 3 wires.

The chips have an impressive range of tools built in and they are very simple to get going. Lots of fun too.

Have a look at :
http://www.phanderson.com/picaxe/
if you are in the USA

Get the free software and chips from :
http://www.rev-ed.co.uk/picaxe/

These chips just go in normal IC sockets so you don't need the expensive "development kits". Just wire them up yourself.

The chips still have the original PIC numbers on them, but the bootlooader lets you do easy programming without the bit bashing of assembler. They cost about the same as the original chips because of bulk buying.
The serial bootloader is not available though. That is Rev-Ed's property.
Easy programming reduces development times so serious programs can be produced very quickly.

Here is a typical fragment of code from a NiMH battery charger program. The comments at the right are ones I just added.:

Start: '................label

pause 1000 '.................wait one second
high portc 5 '..................put 5 volts on one pin
pause 1000 ' ..............wait one second
low portc 5 ' .................put 0 volts on the same pin

if w1>1000 then start '.........check for overvoltage

w3 = w1*49/100 '........integer arithmetic

You could have a look at this earlier post:
https://www.physicsforums.com/showpost.php?p=2314873&postcount=14

Last edited: Jan 7, 2010
7. Jan 8, 2010

### MATLABdude

A full dev kit (with simulator, in circuit debugging / emulation) will be costly (usually in the $200 to$400 range, IIRC) However, programmer-only arrangements are a lot cheaper (around \$50), especially those that use in-circuit programming (TIP: buy a breadboard).

Microchip has the PicKit 2 or PicKit 3 which program the majority of their chips (see the documentation for specifics). MPlab is free, but C compilers for PIC are not (the official Microchip ones are free for student use, but lose a little of their optimization after the trial period).
http://www.microchip.com/stellent/i...E&nodeId=1406&dDocName=en023805&part=DV164120

ATMEL has the AVRISP mkII, which likewise programs the majority of their chips (again, see the documentation for specifics). There is a free (and widely-used / supported) GCC port available (unlike PICs, which were designed to be programmed in assembly, ATMEGAs were designed to be programmed in C)
http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3808

These programmers are available at DigiKey, Mouser, and the likes. Probably not the 'Shack, however. You can buy more 'universal' programmers on eBay, but quality / compatibility / support varies a great deal. You can buy something like the Xeltek (which actually will work and program a huge number of chips), but will set you back a grand or two.

Last edited by a moderator: Apr 24, 2017
8. Jan 8, 2010

### Yportne

Hey guys i've done some toying around. I managed to obtain mplab along with a c-compiler so i think i'll toy around with some PIC's.

I'm eyeballing the PIC16F1937. It only has 14kB of program memory, is that a pretty simple program or does the program condense when it's compiled to machine language? I'm wondering how much you can do with 14kB as i haven't really made a micro-controller program before...