Pages: [1] 2 3   Go Down
Author Topic: Similar Microcontrollers to Arduino/Atmega??  (Read 4645 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Computer Science Major from USA. I Love to Build!! -Joe
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, I'm new to this forum and somewhat new to the Arduino.  I'm a computer science major so I've spent quite some time programming and within the last 3 months or so have branched off from single-purpose IC's to the Arduino board.  I have to say that I absolutely love it!!  The IDE works perfect with much of my programming knowledge in C++ and Processing.  In recent, i've been branching off and seeing what other microcontrollers exist for the purpose of custom, standalone projects that I build.  I calculated that if I was to write a program on the Arduino Board and then pop out the Atmega chip and insert it into a custom PCB it'd cost me about $12, before I add all the other components of the project. 

I started looking into the PIC microcontrollers because of how much cheaper they are and have been reading some text (The PIC Microcontroller:  Your personal Introductory Course) and am finding that the language the PIC's are programmed in (I actually haven't been able to get a solid answer on this) is ridiculous.  Perhaps I haven't been programming long enough, but it's some type of lower-level language and is absurd. 

My question is, are there anymore microcontrollers (preferably DIP's) that have a similar "style" to the Arduino and Atmega chip as far as programming is concerned??  Can they handle in-circuit programming like the PIC's can?  (I think that's the coolest feature of these chips).  Are there any PIC's that are compatible with other IDE's (i'm assuming another boot-loader is pre-programmed into them) similar to the Arduino IDE?  Thanks guys.  -Joe
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There's the PICAXE, which is, I believe, PIC chips but with a bootloader and a nice programming interface. I'm never worked with them, but I've heard great reviews.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 360
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm wondering - where did you get the $12 figure from?

By my calculation, it'd be

$4.98 AVR ATMega328P
$0.54 Ceramic Resonator, 16 MHz
$0.09 10 kiloohm resistor
$0.09 330 ohm resistor
$0.62 LED
$0.33 28 pin IC socket
$1.76 1x40pin male header strip
Total: $8.41

And this assumes you don't already have the various passives.  It's quite well under your $12.00 original estimate.  If you get rid of the LED and run off the internal RC oscillator, it'll be only $7.16, and the second one will be able to use the same header strip as the first (you won't use all of them).  

A picaxe would be about the same price, I guess, but you'd need to learn the environment (and you still need the piles of passive components).

EDIT: An Arduino is just an AVR with a bootloader - it supports ICSP programming too, but most people are happy with bootloading.  Like an AVR, a PIC is programmed in hex.  What you're looking for is a C/C++ compiler - for PIC, these are usually expensive (~$100, if I remember correctly), for good ones, whereas Atmel provides the avr-gcc compiler for free. 
« Last Edit: May 19, 2011, 06:51:05 pm by Aeturnalus » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
Computer Science Major from USA. I Love to Build!! -Joe
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

WizenedEE:  ah, I've heard of PICAXE and was just assuming it was a newer version of the PIC microcontroller (i guess it is in some respects).  I will definitely look into it!

Aeturnalus:  I added $4 for the PCB.  Most places that i've looked charge $6 alone for the Atmega328/168 with the Arduino Bootloader.  Where do you normally shop cause your prices seem good.  I usually use futurlec but they always mess something up or take a month.  Anyway, thanks for letting me know about the compiler (i figured there was a solution like that); but short of spending $100 on a C/C++ Compiler, what are my options??

Thanks for the speedy replies guy!!!
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 360
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Get it without the bootloader, and use your Arduino to simulate an ICSP programmer (ArduinoISP sketch in examples) and flash the bootloader on.  I usually shop at Digikey, and of course, quantity pricing will make it much cheaper.  Mouser is also an option - basically big electronics suppliers are more reliable, even if their websites are somewhat painful.  Since you already have an Arduino, its ability to replace an external AVR in-circuit programmer can be used to drop prices for yourself =).

The PCB is a universal cost - I don't think you can really avoid it.  It's also not going to get any cheaper - a PICAXE is actually slightly more expensive than an Arduino for the same capabilities, due to markup premiums and suchlike. 

Regarding the compiler: If you use PICAXE, you'll need to live with BASIC, otherwise you don't get to use the bootloader (thereby defeating the whole point of the PICAXE).  For C/C++, you'll need to buy an external hardware programmer, and there are a number of limited free C/C++ compilers for PIC (they're all crippled in some way or another, but you can often live without half the memory or no libraries or etc).

You can also look into the ATTiny series, which the Arduino libraries have been ported to (I forget which ones).  You'll need to use the Arduino board you have as an external ISP for these, as they don't have bootloaders (as far as I know), but they're cheaper than the ATMega series.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
Computer Science Major from USA. I Love to Build!! -Joe
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hmmm...very interesting.  I was looking through my stockpile of stuff and realized I have two starter kits for the PICAXE (8-pin and 20-pin i believe) so that's where I'll start (guess i was drunk that night and ordered the wrong book, though probably not a bad idea to have a reference-book). I'll probably order this book:  Programming and Customizing the PICAXE Microcontroller 2/E (Programmable Controllers Series) and see where that takes me (the reviews say there's some errors, but it has its uses).  If you or anyone has a better suggestion about learning tools or anything, feel free to let me know.  In the meantime, i'm just reading online about all the above-mentioned microcontrollers.  THANKS GUYS!!!
Logged

Kentucky, US
Offline Offline
Full Member
***
Karma: 1
Posts: 193
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

And there is also this from MicroChip:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2095&param=en553910

Jim
Logged

TC4 Open Source Digital Thermometer and Temperature Controller
http://code.google.com/p/tc4-shield

Offline Offline
Newbie
*
Karma: 0
Posts: 17
Computer Science Major from USA. I Love to Build!! -Joe
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm looking more for a single DIP IC that I can program and play around with, and then solder the IC into a PCB with whatever else is required for the project and be able to go back and program it, in-curcuit (ICSP), not a platform like the Arduino Board or Freeduino.  -Joe
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8600
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The Picaxe is a good system but it's nowhere near as versatile as an AVR or PIC, mostly because of the interpreted BASIC. That arguably makes it easier to use for a beginner but also limits what it can do.

However you may not reach those limits, it depends on what you want to do. I've seen some pretty fair projects done with Picaxes.

______
Rob
 
Logged

Rob Gray aka the GRAYnomad www.robgray.com

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 135
Posts: 6788
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can get C compilers for PICs.  The newer PICs even use gcc, just like the AVR in Arduino.
But I'm not convinced that PICs are so much cheaper than the AVR once you get to similar specifications.  $4 AVR vs $3 PIC.  Hmmph.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
Computer Science Major from USA. I Love to Build!! -Joe
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks for all the input guys!! I'll probably tinker around with the PICAXE's a bit, but in the end, I think i'll just stick with the AVR Atmega and burn the bootloader for free using my Arduino board.  -Joe
Logged

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 5594
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

...[snip]...I'm a computer science major so I've spent quite some time programming...[snip]...and am finding that the language the PIC's are programmed in (I actually haven't been able to get a solid answer on this) is ridiculous.  Perhaps I haven't been programming long enough, but it's some type of lower-level language and is absurd.

[raises an eyebrow]

If what you are seeing is assembler...then I am left wondering just what it is they are teaching "computer science majors"...?

I suggest that if you don't understand how a CPU fundamentally works down to the "bare metal" - then you really don't have an understanding of how a CPU works; I would also be very hesitant at calling you a computer scientist, as well.

I don't say this to be rude or mean, by the way - but I am questioning, again - what you are being taught (or not, as the case may be)? Maybe you just started your degree, but prior to this you had been programming without understanding the lower-level basics (registers, program counters, flag registers, addressing, stacks, etc).

Regardless - don't discount it as "absurd" - it is anything but; in fact, it is the fundamental way in which a computer (well, CPU) works.

I am now left wondering whether Church/Turing are ever brought up in computer science studies nowadays (among the names of many other great people who laid the foundations of computer science - a knowledge of whom which will benefit any student studying compsci).

Maybe I'm just "old" and need to go back to fiddling with an Apple IIe ROM monitor...

smiley
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Offline Offline
Newbie
*
Karma: 0
Posts: 17
Computer Science Major from USA. I Love to Build!! -Joe
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't say this to be rude or mean, by the way - but I am questioning, again - what you are being taught (or not, as the case may be)? Maybe you just started your degree, but prior to this you had been programming without understanding the lower-level basics (registers, program counters, flag registers, addressing, stacks, etc).

Sorry dude, I guess I was just frustrated at the time I made the post haha. I'm still reading the book and getting the hang of it, it's just obviously not as convenient as the compiler used on the Arduino (that I'm much more comfortable and familiar with).  And you're right, when I said I was a CS major, I've only taken a few entry classes and so far only learned C++ in class.  I read Getting Started with Processing and I read a text book on Visual Basic.  All my work prior to these courses (this past year) has been with single purpose IC's (no programmable microcontrollers).   

But as to your question:  No, aside from the current book I'm reading on PIC's, I've never heard of program counters and flag registers (though we have reached them in the book, just not into too much detail yet).  We dealt with addressing in my C++ class, but have not done any work as far as microcontrollers in class or compilers/assemblers. 

So honestly, i'm still a noob...just not a helpless noob haha.  I'm still learning  smiley-wink

-Joe
Logged

Portugal
Offline Offline
God Member
*****
Karma: 6
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You are probably seeing how real persons do it, in Arduino you can also do "ridiculous" things as well...
Things like this:
THis is a blinky with direct port manipulation and no Arduino functions, just the bare metal, this compiles to something smaller than 200bytes, and not 1K or wathever it eats in Arduino.
Code:
#include <avr/io.h>
#define F_CPU 16000000UL
#include <util/delay.h>


int main(void){



DDRB |= (1<<PB5);

while(1){
PORTB |= (1<<PB5);
_delay_ms(1000);
PORTB &= ~(1<<PB5);
_delay_ms(1000);
}

}


This is how you do some pwm:
Code:
void timer0_init(void){

TCCR0A = ((1<<COM0B1)|(1<<WGM00)|(1<<COM0A1)); //Phase correct pwm, mode 1

TCCR0B = ((1<<CS01)|(1<<CS00));



}



void timer2_init(void){

TCCR2A = ((1<<WGM00)|(1<<COM2A1));

TCCR0B = ((1<<CS01)|(1<<CS00));

}



void update_pwm(uint8_t red, uint8_t green, uint8_t blue){



OCR0A = green;

OCR0B = blue;

OCR2A = red;



}

This is how you use the adc, portguese commentaries, sorry:
Code:
void adc_init(void){



ADCSRA |= ((1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)); //16Mhz/128 = 125Khz

ADMUX |= (1<<REFS0); //Referencia de 5v

ADMUX &= ~(1<<REFS1);

ADCSRA |= (1<<ADEN); //Adc ligada

ADCSRA |= (1<<ADSC); //Fazer uma primeira conversão para iniciar o circuito e porque é a mais lenta

}



uint16_t read_adc(uint8_t channel){

ADMUX &= 0xF0; //Limpa o canal anterior

ADMUX |= channel; //Define o novo canal a ler do ADC

ADCSRA |= (1<<ADSC); //Inicia uma nova conversão

while(ADCSRA & (1<<ADSC)); //Espera que a conversão seja feita

return (ADCL + (ADCH<<8)); //Retorna o valor do ADC

}

Its no non-sense its register manipulation, non sense is using an Arduino and thinking that its all ponnies and rainbows and that everyone doing bare metal is just non-sense.

In my opinion the 8bit family from Microchip is just way to bad, to limited and just a wrong architecture, but their 16biters like PIC24 and dsPic are just awesome and the PIC32 is even better.

You can download free compilers from microchip and start codding or you can keep using Arduino and have an heart attack when you learn assembly lol.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
Computer Science Major from USA. I Love to Build!! -Joe
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

 smiley-eek-blue
Logged

Pages: [1] 2 3   Go Up
Jump to: