8051 ,PIC ,AVR ?????

Status
Not open for further replies.
yes IAR has three compilers for the PIC line. one for the dsPIC, one for the 16/17 series PICs and one for the 18 series PICs. for more info go to https://www.iar.com
 

If you want use C, I think 8051 is the best.
 

If you want use C, I think 8051 is the best.

i agree with djalli. the topic of using C or assembly is already very complicated. dont make it more difficult. C compilers made for the PICs and AVRs are highly optimized so i dont think there is such thing as "C best with 8051"
 

Just completed conversion from PIC16F7x assembly code to AVR atmegax8
for a production product, here is what I found:

1) PIC assembly instruction is more symatrical in register access. you don't have too many suprise in which registers can be used for what instruction in PIC, the AVR have lots of limitation in which register can be used for which instruction.

2) PIC chip program memory is noramlly quoted with words, such as pic16f72 is 2 k word device, pic16f73 is 4 k words device. the AVR chip program memory is noramlly quoted with bytes, but their instructions are 16 bit wide !! e.g. ATMEGA48 is 4 k byte device but you only have 2k instruction step to use therefore it is equ. to pic16f72. same for ATMEGA8 is equ. to pic16f73 and is 4k instruction device.

3) the price of PIC 16Fxx chip is about the same as AVR Atmega chip with same program memory "WORD" space. in quantiity. ATMEGA8 is about the same price as PIC16F73 in quantity with the same 4 k words program memory.

4) the speed of PIC instruction cycle = clock/4 i.e. 20Mhz=5mips
the speed of AVR instruction cycle = clock/1 i.e. 20Mhz=20mips.

BUT in real life: the PIC instruction need only 1 cycle to move data in between registers and W register for operation by ALU. the AVR need 2cycles, also AVR has only 32 registers can be accessed directly by ALU, you need to move data to register from RAM first, it costs 2 cycles. So, in average the AVR needs about 35% more cycle to process in my conversion code. compared to the original PIC. the code size of AVR is also larger than PIC, about 30% more.

5) the MPLAB from PIC is better and more stable than AvrStudio for AVR. still found bugs in AVRStudio. the TRACE function in MPLAB is very useful for optimizing your code. it is not available in AvrStudio unless you buy their ICE. the same for Proteus VSM for PIC and AVR, (strange bugs in AVR model).

conclusion:
1)PIC is slower than AVR in terms of instruction cycle. they are limited by clock/4. AVR are faster but need 35% more cycle to get the job done.
2)PIC code size is smaller than AVR. about 30% smaller in my case.
3) PIC chip is more easy to use than AVR, instruction set is simple and easy to understand. RETLW, PC modified jump are most usefull. AVR instruction set are more difficult to learn and lots of exceptions in terms of regiater/ram access(therefore need more instruction and cycle to get the things done). for beginner I recommand PIC.

4) I like SX chip from Ubicom but they are about 2 times expensive than PIC and AVR. also I/O pin count is a problem. (you need to pay even more)

5) PIC clone from Taiwan company are cheaper/faster but only have OTP, not re-programmable FLASH. which is important in terms of product revision update.
 

I just want to give my opinion regardinf porting applications to the 51 .Well is not easy ..If you have to migrate a program to the C51 .Well one of the bigest problems is the memory you have to pay attention to where you need to put your variables . DATA ,IDATA ,XDATA,PDATA . this means to rewrite portions of the code in order to handle all this . Is funny to read the keil C51 doc about pointers .. "xdata char idata *mypointer ". a little mistake and it will take you hours of FUN to discover the problem .New C51 chips out there have Xdata ram idata ram data ram . and have to use banking to be able to handle more tha 64K . So if you write an application departing from the 51 . Is almost not PORTABLE to another architecture .. unless you decide no to use the fastest memory .On the other side the c51 tools are very sofisticated .. Is amazing all the crap developped to handle this old chip but still a standard of the industry .. Is too bad that the designers came up with so many address spaces . But i imagine the INTEL ingeniers 27 years ago . programming in assambler and for the first time integrating RAM on board ..128 bytes must to have seem like a LOT .. but 5 years latter another guy said .."we better put some more ...maybe 128 again will be enough" this was the guy that made the awful mistake .. HE BETTER STAYS OUT OF ELEKTRODA!
 

eltonjohn said:
a little mistake and it will take you hours of FUN to discover the problem

"hours of FUN" !!!!!!!! thats a nice one.

eemapir said:
i think 8051 is easier to program

could u explain how?

from abc123's post i have concluded that PICs only have one disadvantage against the AVRs, it takes 4 clocks for one instruction. that means the PIC is slower than the AVR. but i must say that speed is not what u want in control systems. for most of the time the microcontroller is wasting cycles (like in a delay routine) or waiting for something to happen.
 

i thinsk that all mcu are the same if you program in C.

But pic has mcu with mane periphelars like lcd drive......

xxtigerxx was here
 

avr too...

I think that all MCU in each familly can have an equivalent in each other family...

The choice you can make is :

1. Specific feature that doesn't exist in other MCU.. (feature, speed or so on that is mandary for your design)
2. Developmenent toolchain (IAR, KEIL, ICC, GCC...) some are free, some other are expenssive
3. availibility of samples (if you want for private usage)

regards
 

AVR because it has most of auxiliaries, has new and very powerful RISC core it's easy to program and has great C compilers... and many, many other reasons...
 

not very objective because nowadays, we could find a lot of feature in high-end MCU like PIC18F or the enhanced 8051 that arise on the market...

We must concentrate onto the beginning of the topic :
ojer25 : what is your criteria/constaint to choose a MCU ?
if none, then it depends on the price you want to spend in it, the time you have to search info on the web and anywhere else, the amount of MCU you want...

please, be more specific, bacause as you can see, all people have differents opinions and all are valuable...

you can still put ask for a poll in order to see the amout of elektroda people among the MCU world
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…