Shop OBEX P1 Docs P2 Docs Learn Events
broadening my scope — Parallax Forums

broadening my scope

tobdectobdec Posts: 267
edited 2011-08-25 14:15 in General Discussion
What do you guys think of the ATmega168 as a next step from the bs2? Not that theres nething wrong with my bs2 I just want to learn different languages and mcu's for a better understanding of it all.
«1

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-08-18 12:19
    It depends on what you plan to do with the ATmega168. If you're just going to use the Arduino software or even just the C/C++ toolchain, you're not going to learn that much about the microcontroller itself. Frankly, I would suggest using the Propeller, perhaps getting one of the new QuickStart boards. You can use Catalina for a C compiler, plus there's Spin, Assembly, PropBasic, and Forth. You should look at 12Blocks too for an example of a graphical programming system. ViewPort is a good debugging and development tool.
  • LeonLeon Posts: 7,620
    edited 2011-08-18 12:37
    The ATmega168 is a nice chip to program in assembler and C, with good free tools and low-cost hardware. Plenty of support is available on the AVR Freaks forum. Get an AVR Dragon ($50) for programming and debugging.
  • rod1963rod1963 Posts: 752
    edited 2011-08-18 12:48
    The Atmega is a nice chip and you can't go wrong learning about it. There's C, Forth, assembler and compiled Basic available for it.
  • tobdectobdec Posts: 267
    edited 2011-08-18 13:02
    From what ive gathered the atmega's can use multiply languages as long as you use the correct compiler? My main goal i guess is to learn C. Ive got a solid background in electronics now and want to program more.
  • LeonLeon Posts: 7,620
    edited 2011-08-18 13:42
    C is generally used with AVR devices. There are one or two other languages but no one uses them for professional applications.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2011-08-18 14:03
    If you can find a source the ATmega328P might be a better choice, simply as it has more memory. Otherwise, it's the same chip. The 328 is the one used in the latest Arduino Uno, so it's not quite as easy to find in stock. The two are more or less the same price.

    Atmel offers their free coding tools, and there's the gcc toolchain, of course. There are some people that use the Arduino IDE (which extends gcc), but code in straight C. The IDE will create the hex files, which you then download via a programmer. For programmers there are a bunch in the $20 or $30 range. I have one from Pololu that's not bad.

    It can be, er, um, a learning experience setting all this up. After doing it you get to appreciating the ease of getting started with something like the BS2.

    -- Gordon
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-08-18 15:08
    I agree with Mike Green (again).

    The Propeller is a great chip for robots. I'm often frustrated reading Robot, Servo or Nuts & Nuts articles as the author struggles with keeping jitters out of their servos or they have some other timing problem that could have been easily solved with a Propeller.

    I confess, I also plan to learn to use AVR's chips.

    @Leon, Is "AVR Dragon" really needed for occasional programming? I'm willing to pay for programming tools if needed but I'd prefer free software if it's good enough.

    Duane
  • LeonLeon Posts: 7,620
    edited 2011-08-18 15:33
    It makes things much easier, and doesn't cost much more than a programmer such as the AVRISP Mk2.
  • tobdectobdec Posts: 267
    edited 2011-08-18 15:35
    I found a great kit here http://www.nerdkits.com/kits/ at 75 bucks with the programming guide ill prob be able to jump right in. Plus ive got loads of c, c+ ,c# books just begging to be used!
  • HumanoidoHumanoido Posts: 5,770
    edited 2011-08-19 03:48
    I agree with Mike Green and Duane Degn. The prop has 175 programming languages for ever conceivable project!

    http://forums.parallax.com/showthread.php?113091-ULTIMATE-List-of-Propeller-Languages&highlight=ultimate

    You can learn one language and move on to 174 others.
  • LeonLeon Posts: 7,620
    edited 2011-08-19 04:23
    How many of those languages are suitable for programming serious applications, though?
  • Erik FriesenErik Friesen Posts: 1,071
    edited 2011-08-19 05:01
    The prop is a good bridge between some of the micro's that use C. It is so easy to run a program that a beginner doesn't have to fight it. Once you get the hang of it, the concepts are there enough to move on if needed. Just try configuring the oscillator for usb on a pic32, for example of diffcult, or the dspic33 series.
  • AleAle Posts: 2,363
    edited 2011-08-19 05:05
    If your goal is to learn C, then use your PC (or Mac or GNU/Linux powered machine, or whatever you have). I'd suggest you learn C first and then apply it to a uC. The ATMegas (any of them) are as easy to setup as the propeller and are very capable, have loads of peripherals and plenty of documentation.
    I haven't used Catalina (for propeller programming) as I program the propeller only in assembler: the REAL only language that provides an alternative to a penitential robe ;-) :D:D:D. BTW, the propeller offers many advantages over an ATMega but they are really different beasts!
    The AVR Dragon is an useful programming/debugging board, at some point you may need such capabilities.
  • Heater.Heater. Posts: 21,230
    edited 2011-08-19 05:16
    As you want to learn C and this a Parallax forum, why not start with the Propeller and the Catalina C compiler?
    Mind you with a Prop on the bench and the simplicity of programming in Spin/PASM with the Prop Tool or BST or PZST IDE's you may forget all about moving to C.
    As for the AVRs I would get the biggest ones you can find and use the free avr-gcc C compiler. I have had good luck using a simple home made programming circuit and the free PonyProg download software.
    You can even make a USB avr programmer out of a few resistors connected to a small avr and the avr-usb software.
  • tobdectobdec Posts: 267
    edited 2011-08-19 06:13
    wow i didn't know the prop was capable of soo many languages! Maybe I should go with a prop first and then move on to the more hardcore mcu's like atmega and straight pic's. From what I understand theyre alot more in depth to set up and configure. Not so "plug and play" like i'm used to with the bs2.
  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2011-08-19 16:48
    The ATmega168 is great! So is the propeller!
    I suggest using them both. Sometimes they work well together as
    well as separately. You might get more bang from the very similar
    328p though...more flash.

    I'd use WinAVR/GCC for the atmegas and Catalina for the Prop.
    That way you will be learning C for both chips :-)

    There are some very inexpensive USB programmers for the Atmel
    chips available on ebay. We are talking 7-15 USD delivered.

    I like combining the ATmega1284p and the Prop.
    The 1284p has 128K of flash, 16K ram 4K eprom.
    And runs at 20MIPS at 5v down to 4MIPS at 1.8v
    costs 5.00 USD ea
  • Erik FriesenErik Friesen Posts: 1,071
    edited 2011-08-19 18:59
    One problem I see with using avr is that you may become an avrfreak.
  • tobdectobdec Posts: 267
    edited 2011-08-19 19:36
    Even if i do become an avrfreak parallax always makes great acessories for ANY mcu. Im gona try a prop though just to see how I like them.
  • rod1963rod1963 Posts: 752
    edited 2011-08-20 10:21
    If you are new to C and need to learn it, learn it on a PC. It's easier that way than trying learn it on a on uC.

    And yeah ATmega1284p is a good choice as well for a uC. Comes in a Dip40 package so it's hobbyist friendly.
  • tobdectobdec Posts: 267
    edited 2011-08-20 10:46
    What is uC? Is that a simulated C console on a linx or mac box?
  • LeonLeon Posts: 7,620
    edited 2011-08-20 10:48
    uC - micro-computer or micro-controller. MCU (micro-controller unit) is less confusing.
  • tobdectobdec Posts: 267
    edited 2011-08-20 10:58
    O lol its an mcu that runs on C. I have a nice stack of books on C#....is that similar to C? Can C# be used on the prop? What are the advantages of one language over another on an mcu? Sorry for all the questions Im just rly excited to dive into programming.
  • LeonLeon Posts: 7,620
    edited 2011-08-20 11:06
    C# isn't relevant to C used for embedded applications. I'd start with assembly language and then learn C.
  • tobdectobdec Posts: 267
    edited 2011-08-20 11:28
    Really? Why is that? Maybe i'm missing somthing but it seems like going from PBASIC-C-Assembly makes sense more than PBASIC-Assembly-C. Kinda like going from changing oil to making custom cam shafts. Maybe i'm missing somthing though.
  • LeonLeon Posts: 7,620
    edited 2011-08-20 11:37
    You can't use C effectively unless you know something about the architecture of the chip you are using. Programming in assembler is the best way to learn about the chip.
  • tobdectobdec Posts: 267
    edited 2011-08-20 11:49
    O so each chip uses a slightly different version of Assembly? Like amd, intel, motorola (tablets), or pic, etc... Then C will build upon that speicific version of assembly based on the chip?
  • LeonLeon Posts: 7,620
    edited 2011-08-20 11:56
    They have different architectures and instruction sets. Once you've used a couple you should be able to cope with new ones without any problems.
  • tobdectobdec Posts: 267
    edited 2011-08-20 11:58
    I bet its tricky to make apps for windows that can use both amd and intel then.
  • LeonLeon Posts: 7,620
    edited 2011-08-20 12:15
    They are usually written in C++, these days.
  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2011-08-20 15:39
    Leon is correct, there is a lot to be gained from knowing asm for
    the particular uC you are working with. It is not an absolute must
    though. Much good work can be done without low-level knowledge
    of the uC. However, if you need to work near the limits of the uC a
    working knowledge of asm can make the difference. C is very very
    good but once in a while you must use asm to squeeze out that
    last bit of goodness. I use C for probably 95%+ of my coding and
    asm for the interrupt code that needs to do its job very quickly.

    Once you know one flavor of asm then the skills quickly transfer
    to any other uC. I learned asm on the 8 bit PIC uC. When I moved
    to the Atmel chips it only took a few days to pick up that dialect
    of asm. Asm on the Prop is really fun! there is a lot of power in each
    32bit instruction...it's so versatile that you have to pay close attention
    or you overlook ways to optimize your code.

    For a beginner I have come to the conclusion that the best way to instruct
    is to have a primer that starts from the very elementary steps of binary
    math and logic and proceeds by giving simple and very detailed examples
    of code and hardware using both C and asm to do the exact same tasks.
    Learning C and asm side-by-side just makes sense to me. And if you already
    know C or asm then the side-by-side examples make learning the other
    language much easier.

    The Prop1 and 2 could benefit from a primer that had examples of C, SPIN and
    PASM for every exercise. For these uC's you really need a knowledge of all
    three languages to do the best work possible.
Sign In or Register to comment.