![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) | |
| Usually programming in C will produce code that's quite a bit less efficient than if programmed carefully in assembly. However, I've found that generally it's fair, and sometimes the simplicity of C overshadows the costs, in terms of time of writing and debug, of straight assembly. Of course, stuff that's *really* critical to get right, including dealing with running out of program memory, getting every single last byte through assembly is crucial. Because C is much easier to write and maintain, I think I'm about to GPL my really simple AVR-C tachometer (configurable to both fake-analog or 7-segment) without actually building the circuit and getting other people to fix it... Actually, I'm planning on doing this to see how many people bite and build one despite that fact of missing the hardware sample. I think both PIC and AVR assembly have their strengths and weaknesses, both have nice features, but I personally prefer AVR as it seems more natural to me. Quote:
Code: #include "16F84A.h"
#fuses XT, NOWDT, NOPROTECT
#use delay(clock=4000000)
void main()
{
while(1)
{
if (input(PIN_A0) == 1)
output_high(PIN_A1);
else if (input(PIN_A0) == 0)
output_low(PIN_A1);
}
} | ||
| |
| | (permalink) | ||
| Quote:
Personally I find PIC assembler far simpler, and so do many others - I think it really depends on your programming background?. I've always considered that a 6502 background means you find PIC easier, and a Z80 background means you find AVR easier. Quote:
As always though , both will do almost all jobs, as will many other micro-controllers, it's really just down to personal choice. | |||
| |
| | (permalink) |
| boxer4 sorry i forgot that part...i did it too, if you notice i said the lad flashes, its impossible for it to flash without the loop Guys what about the Intel 8051 family i read it controls over 40% of the microcontrollers market Is it a good choice? | |
| |
| | (permalink) | |
| Quote:
The reason it's around in large numbers is because it's made by lots of different manufacturers, and it's been about for such a long time. If you search these forums you will notice that almost all posts regarding it come from India and the surrounding area - the rest of the world moved on from them a long time ago. | ||
| |
| | (permalink) |
| hmm...i just said this cuz im using them at school Nigel what you use, what's the "best" for you, that has PWM, ADC etc? | |
| |
| | (permalink) | |
| Quote:
Once you've learnt 8051 at school, and you want to move to something more modern, I would suggest the Atmel AVR - which is probably second in popularity, but more similar to the 8051 than the PIC. | ||
| |
| | (permalink) |
| hmm i see...but i cant find a cheap easy programming popular with PWM and ADC PIC :/, by the way...where is the radio project in your website? | |
| |
| | (permalink) |
| With PWM and ADC? Lots of pics have both of those features, lots of AVR's have those features as well. There are cheap programmers by the dozen on the net and you can home brew SPI programmers with a few discrete components plugged into a parallel port and using software such as ponyprog. You can usually home brew something for a few dollars. Try actually looking =) http://www.lancos.com/prog.html Supports the bulk of the PIC and AVR lines as well as eeproms and allows communication to any device that use an I2c bus. Circuit schematics provided for all interfaces.
__________________ "Because I be what I be. I would tell you what you want to know if I could, mum, but I be a cat, and no cat anywhere ever gave anyone a straight answer, har har." | |
| |
| | (permalink) |
| lol i know that there are many microcontrollers with these features, but my question was, cheaper with PWM, ADC, home made programmer, easy interface etc, you guys just say, there are many, you can use this you can use that, this site this this site that, but i want a reference | |
| |
| | (permalink) |
| I was using a 16C84 and 16F84 on one of my projects but quickly switched to the 16F628A as it's much cheaper and easily portable (minus a few setup, my code directly ran on the 628A). The programmer was fairly simple. I also use the AVR 90S2313 and think they're about the same in terms of dev starter costs. As usual I'd say don't use manufacturer to choose your design, use your design to choose your manufacturer. I still prefer AVR for its general purpose instruction set rather than a fairly hackish PIC architecture, though it's absolutely unnecessary to have general purpose. I like the general purpose nature because things like gcc can have natural backend mappers that work like any other CPU. You know things are a hack when things like PCLATH and bank switches need to be monitored carefully... And the fixed stack size (though you wouldn't want to go too deep anyway) can be quite annoying. One thing I should have done on PIC is macro btfss as naturally I'd think the next instruction _should_ be executed if true, not skipped | |
| |
| | (permalink) |
| Ok, we have many opinions, damn, why they make so many PIC's lol...but looks like I have some good info for the upgrade... Thanks alot guys | |
| |
| | (permalink) | |
| Quote:
Last edited by Nigel Goodwin; 3rd October 2007 at 09:14 AM. | ||
| |
| | (permalink) |
| Trust us, starts with PIC because it is simpler to get something working with PIC first. Then moves on to AVR, and this is what one gets. For about the same price per chip, 32 general purpose registers(six of them can be used as three 16-bit address pointer), linear SRAM memory addressing without banks to worry about, unlimited stack level within reasons, vectored interrupt handling and free full-featured GCC C compiler. I try not to mention the up to four time speed increases at the same crystal frequency as someone will jump in and said there is no point because most of the time the MCU is spent waiting. The down side of AVR, unlike PIC, which is foolproof on this aspect, is in its fuses programming. Unaware learner can program an AVR into a state where he cannot access it again using more general programmer hardware. That said, the fuse information is clear and it is always the user fault not understand them or following them closely or not knowing what he would end up with a particular fuse setting. Added: If one still wants to go ahead with AVR, the best one to try is the Tiny2313(20-pin). With 2K of flash, 128 Byte SRAM and 128 Byte EEPROM. One also gets a full 8-bit port and separate pins for serial RX/TX. Not even the bigger 28-pin brother Mega88 can beat that.
__________________ L.Chung Last edited by eblc1388; 3rd October 2007 at 10:27 AM. | |
| |
| | (permalink) |
| eblc1388 what PIC you recomend that fits my needs? | |
| |
| | (permalink) |
| Well, Atmel also has many varieties.. Atmel avr or 89 series and microchip has pic and its many varieties.. Actually both are good... 1. AVR by Atmel is a fresh controller.. and you can get its easy to make programmer also very easily.. at .. this page and refer the websites for tutorials and projects: www.avrfreaks.net www.avrbeginners.net --------------------------------------------------------------------- 2. while pic has many advantages that.. you'll get a lot of material on internet to work with.. programmers are easy to be found in the market.. and easy to make at home also.. and a lot of people working with this controllers.. in other words.. lucky to start with pic.. Refer our moderators site for further clarifications: www.winpicprog.co.uk ---------------------------- Please check my answer before taking decision.. Regards, Simran..
__________________ Simran.. 8051 Specialist.. Last edited by simrantogether; 4th October 2007 at 08:22 AM. | |
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Title | Starter | Forum | Replies | Latest |
| Why choose PIC instead of other microcontroller? | StupidDum | Micro Controllers | 33 | 21st October 2007 08:28 AM |
| Programming the Mini-Max 8051 microcontroller | blimon | Micro Controllers | 8 | 13th July 2005 03:42 AM |
| Answers for cisco test | faiz | General Electronics Chat | 0 | 13th July 2004 04:06 PM |
| Connection of Siemens c167 microcontroller to peripherals. | Roslan | Electronic Projects Design/Ideas/Reviews | 3 | 23rd March 2004 07:52 PM |
| Interfacing a microcontroller with a modem | matt_d82 | General Electronics Chat | 3 | 21st March 2004 03:43 AM |