Continue to Site

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.

  • 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.

PIC or AVR

Status
Not open for further replies.

jrz126

Active Member
Hi,

I'm trying to get involved in microcontrollers. I already have a couple of Atmel's AVR micros and I've been playing with them, but I'm trying to use assembly language and I've never used it before.

I'm probably going to be taking a microcontrollor course next semester, and they use a PIC for it. and assembly language.

I was just wondering if a pic was easier to understand and use compaired to the AVRs, and if I should look into buying a couple to start playing with before I take this class.
 
jrz126 said:
Hi,

I'm trying to get involved in microcontrollers. I already have a couple of Atmel's AVR micros and I've been playing with them, but I'm trying to use assembly language and I've never used it before.

I'm probably going to be taking a microcontrollor course next semester, and they use a PIC for it. and assembly language.

I was just wondering if a pic was easier to understand and use compaired to the AVRs, and if I should look into buying a couple to start playing with before I take this class.

It's mostly a matter of personal choice, with PIC being by far the most popular - but they have been about far longer!. Atmel basically jumped on the MicroChip bandwagon following MicroChip's success.

A PIC is a RISC processor and has far less instructions than an AVR, so you 'may' find it easier.

As I see it you have two competing advantages:

1) You already have some AVR's.

2) You will be starting a PIC course.

I think PIC is the way to go, because you will be learning how to program them on the course - this gives the PIC a MASSIVE advantage over the AVR.
 
but does the PIC anywhere near the same amount of processing power as the AVR? For my roof LED project I plan on using a micro for a wide variety of functions, so I dont think a pic is up to the task.

Also, since programming the AVRs is more difficult than PIC's, and if I knew how to program the AVRs, wouldn't it be easy to program a pic?
(I'm a very cheap person, so I'm looking for reasons to stick with the pic)
 
stick with the pic.. lol.. sounds like an ad campaign..

ok here is my two cents
i am not sure if atmel gives free samples but microchip does.. :)
i have never seen so many functions packed into such a small package as the pic line has..
A/D
comparators
digital I/O
timers
sleep mode
internal/external clocks
multiple interrupt capabilities
and the ever elusive PWM modules ..
and no i dont work for microchip..
granted all pics dont have all these features but the 18F series has most of them
 
as Nigel said, it is just a matter of choice. its up to you to choose the PIC or the AVR. okay now one thing dont compare processing power of microcontrollers. it isnt that much important because most of the time the microcontroller is doing nothing. in microcontroller applications the main issue is the functionality. if u visit https://www.microchip.com u can browse the whole range of PICs. you will see that PICs are fully packed with functionality and are in no way behind the AVRs. and as williB said, microchip offers free samples of PICs, which Atmel doesnt offer.

and dont be afraid about using assembly with PICs. there are just 35 instructions and even out of them a couple are just rarely used. so i would suggest that u read the book "The Quintessential PIC Microcontroller" and go the Nigel's website and read the tutorials on his site.

have fun
 
jrz126 said:
but does the PIC anywhere near the same amount of processing power as the AVR? For my roof LED project I plan on using a micro for a wide variety of functions, so I dont think a pic is up to the task.

There's not much difference in processing power, AVR's may have the edge on the top end devices - but nothing to worry about, unless you're really requiring the absolute maximum from the device?. Most applications require you to slow a PIC down drastically - I imagine the vast majority of PIC programs (and AVR ones) spend almost all their time sat in loops waiting for something to happen!.

Also, since programming the AVRs is more difficult than PIC's, and if I knew how to program the AVRs, wouldn't it be easy to program a pic?
(I'm a very cheap person, so I'm looking for reasons to stick with the pic)

AVR code looks nothing like PIC code, so it probably wouldn't help yopu too much - apart from the practice!. I wouldn't particularly say that AVR code is 'harder', just that it has more instructions - the RISC architecture used in the PIC only has a small number of instructions - 33 for the 12 bit core, and 35 for the 14 bit core (the most popular one). This means you have less instructions to try and remember, but you may need to use a number of instructions to duplicate what an AVR can do in a single instruction.

There's also a LOT more code and help available on the net for the PIC's, and it's surprising how many PIC's you find in commercial equipment!.
 
jrz126 said:
but does the PIC anywhere near the same amount of processing power as the AVR? For my roof LED project I plan on using a micro for a wide variety of functions, so I dont think a pic is up to the task.
AVR's are faster and more efficient then pic's, but most of the time it'll be stuck waiting for events anyway.
However, on some occasions i was forced to use a AVR, just because it is faster.

jrz126 said:
Also, since programming the AVRs is more difficult than PIC's, and if I knew how to program the AVRs, wouldn't it be easy to program a pic?
(I'm a very cheap person, so I'm looking for reasons to stick with the pic)
They both have a diffirent architecture, you'll need to start from the beginning again.

AVR's are also better to program in C. Their larger instruction set and software stack makes them a much better target for C support. There's a good free C compiler at www.avrfreaks.net
 
Nigel Goodwin said:
and it's surprising how many PIC's you find in commercial equipment!.

I haven't seen much pic's used in commercial products. I've seen 1 on a hauppauge TV card for pc, to decode IR...

Where have you encountered pic's? would be interesting to know where they all end up :)
 
Exo said:
Nigel Goodwin said:
and it's surprising how many PIC's you find in commercial equipment!.

I haven't seen much pic's used in commercial products. I've seen 1 on a hauppauge TV card for pc, to decode IR...

Where have you encountered pic's? would be interesting to know where they all end up :)

I've just been given two Xenon 25 Strobe units, they have 16C55's in them, presumably for the DMX control system?. I've seen them in telephone diversion systems, where they automatically route calls via the cheapest provider (they had three SM PIC's in them). I've also seen one in something at work within the last couple of weeks, but I can't remember what it was now! - OH! - just remembered!, it was in the controller for an electric under-blanket, that was SM as well.
 
Wow, looks like everyone is saying pic. but what about the cost of the chips? and how complicated/expensive is the programmer?
With the AVR (90s8515 is what I have now) I can use the isp programmer, which is just a 74244 ic connected to the parallel port. I'm hoping to be able to include the programmer in my controller pcb. Then I just have to connect it to the parallel port to update the software.

I remember looking at pics awhile back, and they seemed too expensive.


They both have a diffirent architecture, you'll need to start from the beginning again.

So could you say that pics is like programming in C and AVR's is like programming in C++? (what I'm trying to say is most of the concepts are the same, but just different sytax?)

If I have time at work, I'll try to come up with the requirements that I'm going to need for the microcontroller for my roof led project. Then if it can be done with a pic, I'll use it.
 
Exo said:
Nigel Goodwin said:
and it's surprising how many PIC's you find in commercial equipment!.

I haven't seen much pic's used in commercial products. I've seen 1 on a hauppauge TV card for pc, to decode IR...

Where have you encountered pic's? would be interesting to know where they all end up :)

i asked a person working in a biomedical related company about the equipment they have. and he told me that most of the equipment is PIC based these days. and believe me guys biomedical technology is the extreme in precision electronics.

i saw a document on microchip's website that had a list of the top manufacturers of 8-bit micrcontrollers and Microchip was second on that list. so all those PICs have to be somewhere, i mean not all of them are given away for free to students and engineers.

jrz126 said:
but what about the cost of the chips? and how complicated/expensive is the programmer?

for the price you will have to contact your local dealer. and for the programmer, Nigel's site has the schematics for the programmer that is very easy to build and it works great. the link of the developer of the programmer is **broken link removed** basically it is based on the P16PRO40 hardware and it is fully compatible with Nigel's software. so you wont have to look all around the internet. just build the programmer, download Nigel's software and start programming. and the programmer isnt much complex. just a single buffer chip, a couple of transistors and resistors and bla bla and thats it.

So could you say that pics is like programming in C and AVR's is like programming in C++? (what I'm trying to say is most of the concepts are the same, but just different sytax?)

yes, its something like that. actually whenever you go from one microcontroller to another you have to learn its assembly and architechture because there are alot of differences between architechtures of microcontrollers. but migrating to PIC wont be much of a trouble if u have a common sense of the workings of assembly and microcontrollers.

If I have time at work, I'll try to come up with the requirements that I'm going to need for the microcontroller for my roof led project. Then if it can be done with a pic, I'll use it

i believe it could be easily done with a PIC. by the way will you try explaining a little bit about this project
 
heres a start on the specs, it still needs a lot of work, and I pressed for time,but I'll post what I got now in case you have any questions (i'll probably update later tonight)
 

Attachments

  • roof_design_specs.doc
    81 KB · Views: 220
I think I went into too much detail with that last post, but I was pressed for time and I wanted to get it posted.
I'll try to keep it basic:
I'm going to have 2 PCBs. 1 will just be a driver board consisting of shift registers, 3 voltage regs (1 for all of the logic circuitry and 2 for led driving), and high current drivers (they will sink the LED current (bring to ground). This will allow control of 64 LEDs. which will be outputted through 2 40 pin connectors (32 leds per connector, the extra 8 in each will be connected to the voltage regs for supplying the led power)

The reason why I'm making 2 seperate PCBs is so that I can upgrade the control logic and not have to worry about redoing the driving portion. (and I have a lot of components going on the board with limited space so I need to break it up a bit).

Since I have a seperate logic board, I cant limit the control of each individual shift register (ie connecting the output enables of all the shift registers together). This gives me 2 more 40 pin connectors. 10 groups of 8 pins
1. Mem reset
2. clock
3. Output Enable
4. select0
5. select1 (used to make SR shift right or left or hold)
6. Shift right input
7. shift left input
8. Q0 (shift left output)
9. Q7 (shift right output)
10. common (this is on the ULN2803 IC (current driver) when brought low it will enable all of the outputs) (i want to use this so that I can use the leds as my dome light ( I open the door and it turns on all the leds)

I'm going to connect a 4x4 matrix keypad and 1x16 LCD screen (it's the hd7440, or whatever the most common one is) to it too. I may need a seperate micro to conrol the LCD because the cable between the primary micro will be about 15-20 feet. Maybe I could look into serial comm. between the LCD and primary micro instead of adding another one.

I was planning on using the MOSI and MISO pins on the AVR to shift the bits too.

oh yeah, how do I get some free samples of pics?
EDIT: oh wait I found the sample request thingy. Now my question is, which samples should I get?

Thanks
 
it sounds like your project is something i wanted to do..
which was make a LED display/brakelight..
i am not really sure how legal it would be /because of distracting other drivers..
with all legalities aside and the fact that i was going to have a switch installed to make it a " regular " stop light ..
the sign could have several canned messages..
but alas i never got around to it...


anyone seen that round toit...lol
 
nice project. i wish i had the time to do something like that.

anyway i think that the PIC16F877A would do the job. it has 33 I/O pins available so you can do alot with it. have a look at it **broken link removed**

and you can also get samples for this microcontroller from Microchip's website
 
Ok guys, I'm sold on using a pic to control it. I've seen a ton of source code and stuff online. plus a lot of people on this board use pics, and this board is MUCH more friendly than that AVRfreaks.net forum. So I know I can get some friendly support from you guys.

I'm gonna get 2 of the 16f877a's, and I can get 3 more samples. Which ones should I get?

Samcheeta, did you look at that word document that I posted. Does it look like that pic will have enough program space for what I want to accomplish? I have some more functions that I want that arent in the document, so I'll want room to spare on it.
Also keep in mind that I'll want to have the programming cirucit included in my circuit that will go in my car, so all I'll have to do is connect a computer to it to update the software.
 
i agree, this forum is the most freindly forum i have ever seen. i would suggest that you go to http://www.piclist.com. if you have seen tons of code on other sites, you will see hundereds of tons of code there.

about the samples, well i would say that you should complete most of Nigel's tutorials. So you should also order samples of the PIC16F628. although you can do all the tutorials with the 877 (with a few modifications) even then you should order the 628. its like if you have more toys to play with, the more happy you are :lol:

i think that the 877 would be more than enough for the task you want to accomplish. if you want to see the capabilities of PICs you should have a look at electronics magazines like EPE. there are tons of projects in those magazines.

with PICs programming a system "in-circuit" is very easy. its called ICSP (in circuit serial programming). you can find alot of projects on the internet and in magazines that use in circuit programming.

as an example ill tell you about a project i made from the EPE magazine. it was the "EPE PIC controlled intruder alarm". it had two 4x4 keypads, one 16x2 LCD, four alarm outputs, 8 monitoring zones, one panic zone and in-circuit programming capability. it was quite a beauty and i enjoyed making it. and believe me that this was nothing as compared to other PIC projects. now i am trying to modify the program code and see how it works. in my opinion trying out someone else's code and then modifying it gives you alot of knowledge. so you should also look for projects that are simillar to your requirement and then modify it to work for your needs.

have fun
 
I prefer atmel's myself, the programmers are easy to make and you can build one into your breadboard so all you have to do is plug in the serial cable, program it, and go back to work without ever removing the chip, sticking it in a programmer, programming it, putting it back in the board... you get the idea.

This board is definatly biased towards PICs, probably becuase Nigel is a PIC expert and get's everyone directed that way... but Atmel's definatly are a great line of microcontrollers, and are used in many many many commercial applications. I know Garmin (they are a popular GPS manufacturor) use atmels, so there are alot to them and they are extremely powerfull. For simple applications, i use a simple atmel 1200 chip, for more complicated applications i use an atmel 8535... there line of products is incredible though, and what they have on them is incredible. You can also write code for AVR's using assembly or a very strange veriation of C.

PICs are good for there ease of use and are generally easier to learn to write code for as there is alot smaller instruction set.

The main thing you want to get out of this is learning how a microcontroller works. Once you get a good grasps on the different ports and different types of things you can do with microcontrollers, then it is a LOT easier to migrate over to other microcontrollers. You may have to learn new instruction sets, but you'll have the basic idea of how most of the instructions work and more importantly, how a microcontroller works and can be used and abused. Start out with a PICs if you think it will be better, your AVR's will always be there when you need the power.

Also, there are plenty of good resources for AVR's, just google "atmel tutorials" and a lot come up.
 
plot said:
This board is definatly biased towards PICs, probably becuase Nigel is a PIC expert and get's everyone directed that way... but Atmel's definatly are a great line of microcontrollers, and are used in many many many commercial applications.

It's not just this board that's biased towards PIC's, it's the entire world!, PIC's are the biggest selling micro-controller.

A fair while back someone posted a poll on this board asking which processors people used, I seem to recall that PIC won it by a long way?.

PIC's were out there a LONG!! time before the AVR, which was simply Atmels attempt to 'jump on the PIC bandwagon'.

You will notice that I've never criticised AVR's, I freely admit that AVR's may be more suitable for a few applications, but PIC's are more suitable for some as well. The speed difference between PIC's and AVR's isn't a great deal, any only rarely has any bearing - plus the 24 bit 80MHz PIC is probably faster than AVR's anyway.

The 'best' microcontroller for any job is the one you can do the job with, regardless of who makes it, or what code it runs - it's obviously advantageous to use one you can write code for, and for any micro-controller (PIC, AVR or other) a decent knowledge of assembler is essential, even if you mainly use a high level language.

From a hobbiest point of view PIC's are cheap, fast, and have plenty of support available - the AVR probably comes second, although the larger instruction set makes it slightly more complicated to use.
 
Ok, I'm going to order 2 samples (maybe 3) of the 877A's and 2 of the 628's. About how long does it take for the samples to come in? (and I think you guys are going to regret getting me convinced to use PICs, because I'm probably going to have a bunch of questions)

I found googled for an ICSP programmer and this came up https://www.olimex.com/dev/pic-pg1.html The schematic is very simple, using the serial port, 2 transistors and a handful of caps, diodes, resistors.
The software that this programmer will use is here:
Is this software easy to use?

Also, how do I go about generating the hex file? (which compiler do I need?)

What clock speed should I run it at? (what crystal should I order? looking at the schematics at Nigel's site, I'm assuming 20MHz.)

Whats the minimum number of I/O that I would have to use to connect a 4x4 matrix keypad, and a standard 14 pin LCD?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top