1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Good to start with?

Discussion in 'Microcontrollers' started by Marks256, May 16, 2007.

  1. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    ONLINE
    Who's counting? - well you obviously! :p

    I've only seen one AVR, but lot's of PIC's - it might depend on the type of equipment I suppose?. MicroChip do publish their sales figures, it's an incredible number of PIC's they sell each year!.
     
  2. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    That's why I so strongly suggest AVR's to Marks Nigel, because he has NO experience, and starting off the architecture of a simple AVR is simpler than the architecture of a PIC. AVR's are RISC the same as PIC, but their register setups are far different. AVR's have 32 general purpose registers, 16 of which are accesable directly to any instruction that uses registers. The other 16 are more storage registers as they aren't directly accesable to the math unit, there is no pageing messiness like with PIC's and the readability of basic ASM code is singnifantly easier than a PIC to someone that is learning an ASM for the first time. This is not just my opinion but the opinion of many users, and a simple fact of the difference in architecture, just look up the wiki entries for AVR and for PIC. While the 18F series fixes a lot of the PIC's major weakness in comparison to the AVR architecture the BASE AVR architecture is easier to understand and use for a newbie than the PIC is. That and the I/O and base clocking abilities of the AVR's are an order of magnitude higher than the PIC line, though the PIC does have some advtantages in the ASYNC timers. I'm not aware of any asyncronous timers on an AVR.
     
  3. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    ONLINE
    I (along with many other users) would disagree, for complete beginners I would suggest the PIC's Harvard architecture is considerably simpler than the conventional Von Newman architecture. If you're already experienced in asembler from something else?, it's more of a problem - because you're used to Von Newman - but from scratch it's a simpler idea - plus the far smaller number of instructions make it easier to learn.

    Memory paging isn't a concern at all, it only affects you if you're writing truely HUGE programs - and if you stick to the smaller PIC's (like the 16F628) doesn't even apply.

    But like anything else, it's YOUR choice - either will do the job, and the ease of learning is probably more dependent on the particular person than any inherent specification of the device.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Marks256

    Marks256 New Member

    Joined:
    Jul 14, 2006
    Messages:
    2,350
    Likes:
    9
    Location:
    Minnesota, USA

    On the electronics side of things, maybe, yes, but on the software side, that is an unfair statement. Oh, and i already said "no" to AVR's, so, yeah... :)
     
  6. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    Why not for zero $ investment start with a simulator like the one in MPLAB, I'm sure AVR has got something similar.

    Another nice simulator both PIC, AVR, Z80 & 8085 is made by http://www.oshonsoft.com/index.html

    It's fun but the demo is limited to a number of uses.
    The Unicorn LCD was tested with it, works the same both on the real Unicorn & LCD or the PIC18F simualators LCD
    [​IMG]
     
  7. Marks256

    Marks256 New Member

    Joined:
    Jul 14, 2006
    Messages:
    2,350
    Likes:
    9
    Location:
    Minnesota, USA
    Does the simulator with MPLAB work well?
     
  8. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    Imho the mplab ide is excellent except when it comes to i/o. if you're just trying out a little coding and want to get the hang of working with mpasm. Try a simple pic to start like the 12F508 (this is one simple PIC)
     
  9. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    Nigel AVR's are Harvard Architecture as well, and I looked up a little more about the pic architecture, and the messiness is with the single accumulator that is used with most PIC instructions. With a few limitations between the first 16 and the last 16, all AVR registers can be used the source or destination to an ALU instruction. And again it's single biggest advantage over PIC's is the instruction cycle. ALL PIC's are 4 clock ticks per instruction cycle, even the one's with PLL's. ALL AVR's are 1 clock tick per instruction cycle. Some instructions like jump and certain memory accessing take more than one (usually 3-4 for jumps and 2 for memory) But all the actual math routines are single cycle, even the hardware multiplier. It also has several index registers which let you do many things in ASM and are designed to make C programming significantly faster. I'm not really trying to downplay PIC's here, but the fact of the matter is the architecture of an AVR is significantly more modern than a PIC's. If you've never programmed micro controllers before but have some programming experience, learning AVR's is going to be easier period.

    Also. besides AVRStudio (which is a little awkward to use) there is a nice AVR simulator called VMLAB which allows LCD/LED virtual serial terminals and a few other functions as well as some albeit crippled but still useful spice like functions. The authors tried to make it pay software for a while but they eventually made it freeware. Has a nice 'virtual scope' too.

    http://www.amctools.com/download.htm

    Marks, I'm really curious why you said no to AVR's? The hardware is easier to learn, and the user base is compareable to PIC's. AVRfreaks.net is a huge forum full of users that will answer any questions, and between the slightly quirky but useful PDF files Atmel's appnotes contain both ASM and C code for a variety of applications, everything from software divide/multiply to software uarts. Calibration of the oscillators using the STK500. One of their more recent chips. The tiny25/45/85 even have on die temperature sensor and with a resistor for voltage feedback allow temperature/voltage calibrated onboard oscillator, the tiny85 has 8k of flash 256B of SRAM and 256B of eeprom, all in an 8pin DIP or 20 pin QFN/MLF (even smaller than SOIC) The 24/44/88 series is the same device in a 14 pin DIP which gives you more usable IO, but you really can't pack much more into that size package. My only major gripe about them is they don't have a hardware 16 bit timer. Sure you can do software, but 16 bit timers are nice. One REALLY nice thing they added to the timers was a PLL mode, which allows up to 64MHZ operation. in PWM mode that lets you generate on/off output 50/50 duty cycle at 32MHZ, and every time you half the frequency you gain an extra bit for the duty cycle. That can actually allow the chip to be used as an ASK FM transmitter directly.
     
    Last edited: Jun 6, 2007
  10. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    ONLINE
    Interesting idea, how did you come to that (completely mistaken) conclusion?.

    Perhaps you might try searching the net for the amount of information and sites on each, or even comparing the relative sales figures for PIC and AVR?.

    Basically your entire argument is that IN YOUR OPINION it's easier to learn AVR than to learn PIC - but it's just YOUR OPINION, and many more people consider it's easier to learn PIC than AVR.
     
  11. Marks256

    Marks256 New Member

    Joined:
    Jul 14, 2006
    Messages:
    2,350
    Likes:
    9
    Location:
    Minnesota, USA
    I would rather use a PIC because i see them more. They are more common to me. Why would i (or someone else) want to learn about something they never see? To be honest, i have only seen 2 AVRs in equipment i have torn apart as apposed to the uncountable amount of PICs i have seen.
     
  12. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    Marks, I'm going to quote a post you made a ways back that is almost perfectly analogous in this situation. Which answers your question very well.
    A quick lookup shows that Intel's market share is about 82.5% and AMD's market share is about 15.7%. I don't know, why would you go with something you don't see very often? The only numbers I could find in reference to Atmel and Microchip were that Atmel has a 30% market share of 8 bit flash micro controllers. Though I'm not sure how much to trust that number because the micro chip market has a much more complex product line than do PC processors and support chips, it is a good indication that Atmel has a higher market share vs the rest of it's market than AMD does vs Intel. It appears obvious now that you're not actually researching the various chip lines you're intending on actually purchasing very throughly, which means you may want to postpone any purchases until you've narrowed things down to what's really right for you. I spent almost a year and a half on electronics forums and at least 6 months researching various hobbyist friendly micro controller lines and I picked AVR's because they won hand down in every category of usability usefulness and accessibility to anyone.
     
  13. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    It's very simple Nigel, I didn't qualify the four to one clock difference in AVR/PIC instruction cycles which gives the AVR it's major I/O and processing advantage as an opinion nor the simplicity of it's register setup as an opinion, nor it's C oriented hardware optimizations as opinion because they aren't opinion's, they're bonfied differences in the way the hardware is constructed, they're differences not opinions. Look it up yourself.

    By the way Marks, most of the PICs you'll find in devices are mask programmed and useless for someone that wants to alter the circuit in any way. I'm not aware of any mask programmed AVR's, they're primarily flash based. PIC's are used because they're industry standard and for compatability and the engineers familiarity with them, not due to architecture advantages. They have been around longer so more people know how to program them well, which only goes to prove that not enough people know how to program AVR's well, which should be one more reason to give them a chance =) You still haven't mentioned what about the hardware architecture difference between the PIC and the AVR's that made you chose PIC's.
     
    Last edited: Jun 7, 2007
  14. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    ONLINE
    I don't dispute that some AVR's are faster than some PIC's (but Atmel don't do a low spec range), MicroChip are still producing (and selling) chips they have been making since well before Atmel decided to try and grab a slice of the market. But the high end PIC's are as fast, and faster, than AVR's - however, for 99% of applications speed isn't a concern anyway.

    There are plenty of websites, and threads, about the relative advantages and disadvantages of the two devices, generally they come to the conclusion there's nothing much between them!.

    But it's a simple fact, that FAR more people learn PIC assembler than AVR assembler, possibly because it's far more common and popular?, and possibly because it's easier to learn?. YOU might not find it so, but many others do - so it's YOUR personal opinion that AVR is easier to learn.
     
  15. Marks256

    Marks256 New Member

    Joined:
    Jul 14, 2006
    Messages:
    2,350
    Likes:
    9
    Location:
    Minnesota, USA
    I went AMD when Intel started sucking. I may start with PICs (as they are most popular, and i am sure there is A LOT of code out for them), but i will probably give AVRs a try. Yah, yah, i know there is quite a bit of code out for AVRs, but what does it matter to you what i start with? Who knows, maybe i will like AVR's better, and will be wasting my time with PIC's. That way, when/if i go with AVR's, then i will appreciate them more.
     
  16. Peter_wadley

    Peter_wadley New Member

    Joined:
    Mar 20, 2007
    Messages:
    376
    Likes:
    1
    Maybe because the thread you made is called Good to start with?
     
  17. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    170
    Location:
    Toronto, Canada
    I went to Microchips 16 bit seminar Thursday, wow. 40MIPs PICs like the tiny 3.3V 18pin 24HJ12GP201 and with no bank switching :D. These things need a special highspeed cable for the Real ICE to debug at full speed. Microchip has also killed off EEPROM in most of their high end PICs as the FLASH is now high endurance and hardware DMA is now supported on some very new PICs
     
  18. Oznog

    Oznog Active Member

    Joined:
    Apr 21, 2004
    Messages:
    2,879
    Likes:
    11
    Location:
    Austin, Tx
    I've been doing extensive work with the dsPIC 33F series.

    Not just 40MIPs, the 16 bit core is efficient, esp if you need 16 bit math which is fairly common. Can easily use a single instruction in place or 4 or 8 that it might take on an 8-bit core. And yeah without bank switching it's not only fewer instructions but easier to write for.

    The DMA controller is a great, great feature. Collect readings from the peripheral modules and dump them directly into data memory without interrupts. In fact you can even Idle the core while leaving the peripheral modules and DMA controller working, only restarting the core when a buffer is filled.
     
  19. bloody-orc

    bloody-orc New Member

    Joined:
    Aug 23, 2004
    Messages:
    723
    Likes:
    4
    Location:
    Estonia
    Do you want 8, 16 or 32 bits from your micro?
    I suggest go with AVR32 series. 32 bits of raw processing power. Can drive anything you like. Play VGA, Svideo, whatever you like! even TFT. And please don't bother with that ASM. It's old and slow (to write, not to run). Just go with C. Yes I know ASM is a better language for some applications, but certainly not for all. C is way better, when you need to do serious stuff with your controller, that takes a lot of time to write. Like a game with a laptop monitor or something. Also CAN, ETHERNET; USB, USART, Timers etc.etc.etc.
     
  20. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,642
    Likes:
    109
    Location:
    Michigan, USA
    Do you happen to have sample code you'd like to share? The dsPIC still seems very intimidating to me and I'd love to see an example.
     
  21. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    ASM is perfect for Atmel's smaller chips and those that need to squeeze performance out of their mid range line. But definitly not for the AVR32 line. That's one of the reasons why it's so difficulty to compare PIC's and AVR's because all AVR's are flash based 8 bit processors, there are few word based instructions but not enough to call it a 16 bit processor, so you really have to compare similar chips, Microchip has a very widely based product line. Atmel's AVR32 line is very very nice, but I wouldn't really call them micro controllers, they're more compareable to ARM chips. Same thing with DSPPIC's they're not really micro controllers, they're DSP. There are no formal guidelines for what is classified as a micro controller vs a DSP vs a micro processor so the lines a little blurry.
     

Share This Page