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

AVR or PIC

Discussion in 'Microcontrollers' started by beginer electroner, Aug 5, 2006.

  1. ThermalRunaway

    ThermalRunaway New Member

    Joined:
    Apr 9, 2005
    Messages:
    895
    Likes:
    4
    Location:
    South Wales, UK
    Actually, can anyone shed any light on why Microchip organised the PIC this way? Why not just use an 8-bit address for the registers and do away with the status bit for the register banks altogether? Is there some advantage to having just a 7-bit address?

    Brian
     
  2. philba

    philba New Member

    Joined:
    Mar 12, 2006
    Messages:
    1,886
    Likes:
    8
    Location:
    Seattle
    8 bits for regs would get you 256 addresses. how do you expand beyond 256? banks. doubling the size of a bank really doesn't buy you very much. basically the PIC14 architecture was originally designed to have a max of 128 regs and 2K words of code. banking and paging allowed clumsy expansion beyond that.

    it's really a shame that the designers did not pay attention to the trends that have going on since the dawn of the computer age. every successful architecture bumps into it's limits much sooner than the designers think.

    to be fair, it's always a trade-off. chip size vs features. more address bits means programs are larger which means a smaller available market. larger chips cost more to make which means higher prices - smaller available market again. while the "learning curve" drives the prices down, it's a risky move to start too far up the learning curve (i.e. price yourselves out of the market). where was the tipping point for success? no one really knows when designing a product, you can only tell later. Had the designers known how successful the PIC would be, maybe they would have been a little more generous but hindsight is 20/20.
     
  3. eblc1388

    eblc1388 Active Member

    Joined:
    Jan 25, 2005
    Messages:
    2,228
    Likes:
    18
    Location:
    UK
    This question is not difficult to answer. The 7-bit address is a limitation imposed by the core design of 14-bit word microchip.

    PIC instruction execute in single instruction cycle with pipeline and thus everything needed for decision must be ready or presented inside a single instruction word, which is 14-bit for 16F628a.

    Inside these 14 bits one must also allocate different bits for the actual instruction itself so the instruction can be decoded. The remaining bits being used to carry data. With 35 instructions, all single word, one would need 6 bits (64 combinations) to decode them separately. This leaves 8 bits available for data and is of not much use. However, using special cases of these 64 combinations, part of the data code space can be turned into instruction space but now the available data width is reduced. Therefore only a few instructions can enjoy 11( the GOTO instruction) or 10 bit(BTF instructions) dedicated for data use, a few that have 8-bit data(those that deals with literal) and most of remaining uses 7-bit for data(register addresses) instead.

    Your suggestion for 8 bit register address wil bring out two problems. First, the number of registers will be limited to 256, which is not sufficient for modern microcontroller and also means that one still has to switch banks to access more than 256 registers. The second problem is one cannot possible fit 8 bit register addresses into the current 14-bit word instruction set without reducing the data width of some of the existing instructions.
     
    Last edited: Aug 8, 2006
  4. dave

    Dave New Member

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


     
  5. dknguyen

    dknguyen Well-Known Member

    Joined:
    May 6, 2006
    Messages:
    6,742
    Likes:
    71

    Flip a coin and let the gods decide!
     
  6. beginer electroner

    beginer electroner New Member

    Joined:
    Aug 5, 2006
    Messages:
    17
    Likes:
    0
    :cool: :confused: :mad:
     
  7. dknguyen

    dknguyen Well-Known Member

    Joined:
    May 6, 2006
    Messages:
    6,742
    Likes:
    71
    I mean, just pick one and use it. It doesn't matter if you have no history in either chip. PICs are just yelling out "PIC ME!", however.
     
    Last edited: Aug 10, 2006
  8. hjames

    hjames New Member

    Joined:
    Jun 7, 2006
    Messages:
    677
    Likes:
    6
    Location:
    Bezerkeley, USA
    Agreed - When starting out, nearly any microcontroller is sufficient. And once you know how one of them works, it's relatively easy to jump ship and swap to another one later on. And if you're interested in getting a really deep understanding of microcontrollers, the question should be "AVR or PIC, which one first"?
     
  9. mramos1

    mramos1 Active Member

    Joined:
    Sep 15, 2005
    Messages:
    2,403
    Likes:
    9
    Location:
    Boynton Beach, Florida USA
    Just pic a chip. That is the point really.

    Let's do this.

    I am you. I want to learn.

    I can pick a 16F84. There are sites all over about it. It will work fine if you have a programmer, read the docs and have an assembler/compiler..

    I am looking at the 16F88 at this point.. So I would recommend that chip. In the PIC world, you have to read..
     
  10. ThermalRunaway

    ThermalRunaway New Member

    Joined:
    Apr 9, 2005
    Messages:
    895
    Likes:
    4
    Location:
    South Wales, UK
    Using your advice, the only things left to consider would seem to be the cost of development equipment and the availability of information. I think the PIC would win on those counts, so it's probably better for the beginner to start with the PIC.

    Brian
     
  11. mramos1

    mramos1 Active Member

    Joined:
    Sep 15, 2005
    Messages:
    2,403
    Likes:
    9
    Location:
    Boynton Beach, Florida USA
    Not really. They are both tied now IMHO. For me, I need a cheap program to make and both have them. A free basic compiler, they both have them. Cost are about the same.

    So they are abount the same for me. I went PIC maybe 6 months ago and have spent about $400+ (on compilers as the free one did not get it).

    On the Atmel I spend $129 for a programmer.


    Again, this is going BASIC, it was cheaper for me. If I went ASM, a tie.
     
  12. ThermalRunaway

    ThermalRunaway New Member

    Joined:
    Apr 9, 2005
    Messages:
    895
    Likes:
    4
    Location:
    South Wales, UK
    The huge internet resource would swing it for me. The PIC has massive support. Not only would he be better off starting with the PIC, there's no reason why he shouldn't stay with the PIC afterwards as well because it's a good Microcontroller series.

    Brian
     
  13. mramos1

    mramos1 Active Member

    Joined:
    Sep 15, 2005
    Messages:
    2,403
    Likes:
    9
    Location:
    Boynton Beach, Florida USA
    I use both.

    I like the AVR as they are a little faster for one and assembler is easier for me.

    But the ICD2 is a nice feature for the pic and many website.

    They are both good.
     
  14. Tarsil

    Tarsil New Member

    Joined:
    Jul 1, 2006
    Messages:
    290
    Likes:
    0
    Location:
    Timisoara, Romania
    Anyway....for pic you can use a cheap, homemade JDM programer and ICprog (Free download). The main problem with the JDM is that, on some (most) ports, doesn't give enought yoltage for programing (12-13.5V). U can modify it by using an external voltage source just for the Prog enable. The developing tools.........
     
  15. Tarsil

    Tarsil New Member

    Joined:
    Jul 1, 2006
    Messages:
    290
    Likes:
    0
    Location:
    Timisoara, Romania
    I've heard that code for 16F84 runs on 16F628.
    Is that true?
     
  16. mister_e

    mister_e New Member

    Joined:
    Jul 14, 2006
    Messages:
    350
    Likes:
    2
    Location:
    Montreal, Canada
    With some minor modification... true
     
  17. eblc1388

    eblc1388 Active Member

    Joined:
    Jan 25, 2005
    Messages:
    2,228
    Likes:
    18
    Location:
    UK
    If what you meant is to show that PIC is better in this respect, I bet you don't know one only needs, at the minimum, a few resistors and the parallel port to program an AVR.
     
  18. William At MyBlueRoom

    William At MyBlueRoom New Member

    Joined:
    Feb 28, 2006
    Messages:
    721
    Likes:
    1
    Location:
    Toronto, Canada
    Does the AVR have a built in debugger?
     
  19. williB

    williB New Member

    Joined:
    Aug 30, 2004
    Messages:
    2,217
    Likes:
    3
    Location:
    New Jersey
    how does that debugger work?

    because i was thinking of using my pc - spi interface to clock in four clocks into a PIC , note the output , clock in four more .. ect
    that way i could keep a running total of clocks and repeat a step or sequence , immediatly if needed.
     
  20. Tarsil

    Tarsil New Member

    Joined:
    Jul 1, 2006
    Messages:
    290
    Likes:
    0
    Location:
    Timisoara, Romania
    Yes, I have no experience with AVR, and limited with PIC's. I was just answering to a post that said that has spent 400$+ for a PIC programer and 129$ for AVR. The JDM works, and I've seen kits for less then 10$.
     
  21. Tarsil

    Tarsil New Member

    Joined:
    Jul 1, 2006
    Messages:
    290
    Likes:
    0
    Location:
    Timisoara, Romania
    Btw, you made me curious. Got a link to a tested schematic for AVR?
     

Share This Page