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.

Which Microcontroller to choose

Status
Not open for further replies.

nunotins14

New Member
Hi all, I would like to know which microntroller to buy...
I have a PIC16F84A but its expensive, doesnt have PWM, doesnt have ADC, old, etc...

Also i have a problem with my PIC16F84A, whenever i try to use input(..) (CCS) my output LED flashes randomly, i can activate it with my finger etc...

ATMEL or PIC?

Well, i bought this PIC because I found a cheap homemade programmer...

So, my "needs" are, easy interface, PWM, ADC, homemade programmer, possibility of use C code instead of ASM, many samples on the net etc, before I bought PIC16F84A i searched google for it and i found 300k results, I tried with other ones and only found around 80k...



Thank you all ;)



EDIT:

Ok, i read the "Newcomers, please read! (PIC regarded) Upd. 0xD" and i see that a good choice is 16F88, but i cant find an homemade programmer :/
Also that article is from 2005, I bet theres something better outt here

By the way, with my old PIC (16F84A) i use **broken link removed** both schematic and PicProg software
 
Last edited:
There is no solid answer to the ATMEL or PIC question. Both are good.

There is more support for the PIC here then for other processors.

I use CCS C. Sounds like you have a floating input that is effecting you LED. Would need to see your schematic and code to be sure.

There are basic types of PIC programmers.

Serial. They are the simplest to build buy do not work with all PC's. Not all PC's have serial ports and some that will not work.

Parallel. For the most part if you build them correctly they work.

ICD2 clones. These communicate with the PC over RS232 or USB. The actual programming is done by an on board pic.

ICD2 clones are popular. Microchip provides the software so do not have to depend on a 3rd party to keep the chip support up to date. I can be used as a run control tool (hardware breakpoints) to debug your code in real time. aka debugger. To build one of these from scratch you need to get your hands on a programmed chip. Chicken egg sort of thing.

You can get an Inchworm ICD2 kit from DipMicro, or build one from the schematic found on Bill's site https://www.blueroomelectronics.com/

You can find schematics for serial and parallel programmers at sparkfun.com and elsewhere.
 
there are a lot of PICs with different numbers of I/O pins that do all of that. microchips website has all of them listed in a chart that shows thier specs for you to compare each. It depends on who many IO you need really. I use the 12f683 for 1 I, 5 I/O and the 16f690 for when I need up to 18. The 16f690 is pretty cheap also.

You found more results for the 84 because it is old. There still seems to be a lot of them left though.
 
Last edited:
hmm ok, but what about the other things like PWM ADC etc?
I found a programmer for the 16f88 and i think this one feets all my needs...

my schematic is simple, i have the 4Mhz with two 27pf capacitors and my LED is connected directly to PIN_A1

my code:

Code:
#include "16F84A.h"
#fuses XT, NOWDT, NOPROTECT
#use delay(clock=4000000)

void main()
{
	if (input(PIN_A0) == 1)
		output_high(PIN_A1);

	else if (input(PIN_A0) == 0)
		output_low(PIN_A1);
}

Im testing this near my notebook, sound system etc, im using a 6V supply...

If i connect PIN_A0 to GND it sets PIN_A1 to GND always, and same for VCC, but i cant make it "stable"

Also, im trying to communicate trough infrared, if i make a LED flash (delay_ms()) it works, if i connect a Tx IR i can "capture" the IR beam with a TSOP1736, but this only work with the transformer, if i use batterys which should have 2A the signal is weak...

My main problem with IR is that when i use "output_low()" the LED (output), on TSOP1736 doesnt turn off
 
Last edited:
and its in ASM :/, but ill have a look, also its for 16F628 which can have more "stuff" than 16F84A, and i cant see the schematic :/
 
lol, ok, well, i dont understand ASM quite well, can you explain how to "play" with the IR?
I see LCD variables, this means that i need a LCD?

A bit above i see Device Command so i think i really need a LCD, can i make it so i only need a LED to test if its working? probably i can use LED's instead of LCD but since i dont understand ASM....


Also, can you translate it to C? :p
 
nunotins14 said:
lol, ok, well, i dont understand ASM quite well, can you explain how to "play" with the IR?
I see LCD variables, this means that i need a LCD?

Only to duplicate what I did.

A bit above i see Device Command so i think i really need a LCD, can i make it so i only need a LED to test if its working? probably i can use LED's instead of LCD but since i dont understand ASM....

The Device Command stuff is simply part of the Sony SIRC's system.

Also, can you translate it to C? :p

Nope, I don't do C.

If you check my radio tutorial, there's a link to where the routines came from, he has similar Mancester type IR routines as well.
 
hmm, sorry i didnt understand the most of your last post, but ill get it :p tomorrow ill buy the components to test it, thank you for your help ;)


By the way, wheres the radio tutorial?
 
Last edited:
Check out AVRFreaks.net, plenty of information and resources there. Cheap programmers included.

An AVR running at 5MHZ will runs instructions as fast as a PIC16F84A will at 20MHZ. The PIC can't even compare on a clock per clock basis for instruction and I/O speed, even higher end PICS which have internal PLL's can't run at significantly fast enough speeds to make up for the 4X clock to instruction cycle divisor (could be wrong on that).
 
Sceadwian said:
Check out AVRFreaks.net, plenty of information and resources there. Cheap programmers included.

An AVR running at 5MHZ will runs instructions as fast as a PIC16F84A will at 20MHZ. The PIC can't even compare on a clock per clock basis for instruction and I/O speed, even higher end PICS which have internal PLL's can't run at significantly fast enough speeds to make up for the 4X clock to instruction cycle divisor (could be wrong on that).

But PIC assembler is more efficient, any speed differences are fairly small, with the higher end PIC's being faster than the AVR's.

But in any case, speed is only very rarely of any importance - probably most of the time a processor is just wasting time.
 
How specifically is PIC assembler more efficient? Also what about complexity? Basic code in ASM specifically is a lot easier to understand on an AVR than it is a PIC, they both might be RISC based but the similarities stop there. A speed difference of 4 to 1 per clock is pretty big by anyones standards, which specific higher end PICS are you referring to vs which specific AVR's?

DSPIC's can't be included of course because they're not really a 'PIC' much like an AVR32 isn't an 'AVR'
 
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.

nunotins14 said:
Code:
#include "16F84A.h"
#fuses XT, NOWDT, NOPROTECT
#use delay(clock=4000000)

void main()
{
	if (input(PIN_A0) == 1)
		output_high(PIN_A1);

	else if (input(PIN_A0) == 0)
		output_low(PIN_A1);
}
I'm not sure what you mean by "stable" or about PIC C compilers, but typically, at least in avr-gcc, if you want to constantly monitor a signal to change another, you'll need to make an endless loop:

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);
        }
}

Now you should have a $6.00 line driver :D
 
Sceadwian said:
How specifically is PIC assembler more efficient? Also what about complexity? Basic code in ASM specifically is a lot easier to understand on an AVR than it is a PIC

Presumably you mean that YOU find AVR assembler code easier to understand?, just because you do doesn't mean the rest of the world does. The far smaller instruction set means that many people find it easier to learn.

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.

they both might be RISC based but the similarities stop there. A speed difference of 4 to 1 per clock is pretty big by anyones standards, which specific higher end PICS are you referring to vs which specific AVR's?

AVR's have a 4 times higher clock speed, but they don't run programmes four times faster - PIC assembler is pretty efficient, because it's very accurately targeted at doing a specific job. If you're trying to do micro-processor type applications?, then the AVR has significant advantages, as it's less specifically a micro-controller.

As always though , both will do almost all jobs, as will many other micro-controllers, it's really just down to personal choice.
 
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?
 
nunotins14 said:
Guys what about the Intel 8051 family i read it controls over 40% of the microcontrollers market
Is it a good choice?

It's a good choice if you have a job lined up programming for it - but essentially it's a very old, fairly low spec, design, a micro-processor that was modified to make it somewhat micro-controller like.

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.
 
hmm...i just said this cuz im using them at school :D
Nigel what you use, what's the "best" for you, that has PWM, ADC etc?
 
Status
Not open for further replies.

Latest threads

Back
Top