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.

AVR or PIC

Status
Not open for further replies.
Tarsil said:
Btw, you made me curious. Got a link to a tested schematic for AVR?

Here you go:

**broken link removed**

However, I would rather add a 74HC244 to buffer the parallel port signals and isolate the AVR after I'm done with the programming.

Added: the schematic is here: **broken link removed**
 
Last edited:
mister_e said:
With some minor modification... true

With VERY minor modifications, turn off the comparators, alter the header and config fuse settings, and change the GPR start address - the 628 was the replacement for the 84 last century, but people seem to keep in in production by ordering the long obselete 16F84?.
 
eblc1388 said:
Here you go:

**broken link removed**

However, I would rather add a 74HC244 to buffer the parallel port signals and isolate the AVR after I'm done with the programming.

Added: the schematic is here: **broken link removed**
Wow...is realy simple..Th a lot.
 
Hmm .....AVR uC are ofering same features at a much lower cost.
What's the catch?:confused:
Is any? ...aside of a biger intruction set.
 
Nigel Goodwin said:
With VERY minor modifications, turn off the comparators, alter the header and config fuse settings, and change the GPR start address - the 628 was the replacement for the 84 last century, but people seem to keep in in production by ordering the long obselete 16F84?.
Can u give some details about how this is done pls?
 
Tarsil said:
Can u give some details about how this is done pls?

Just check any of my tutorials, the header changes and GPR start address are at the beginning, and the lines to disable the comparators are clearly commented. This is the beginning of my LCD tutorial, I've marked the relevent lines in red.

There used to be a migration document at MicroChip, but it's from so long ago I can't find it there any more?.

Code:
;LCD text demo - 4 bit mode
;Nigel Goodwin 2002

[COLOR="red"]	LIST	p=16F628		;tell assembler what chip we are using
	include "P16F628.inc"		;include the defaults for the chip[/COLOR]
	ERRORLEVEL	0,	-302	;suppress bank selection messages
	[COLOR="red"]__config 0x3D18			;sets the configuration settings (oscillator type etc.)[/COLOR]




		cblock	[COLOR="red"]0x20[/COLOR]			;start of general purpose registers
			count			;used in looping routines
			count1			;used in delay routine
			counta			;used in delay routine
			countb			;used in delay routine
			tmp1			;temporary storage
			tmp2
			templcd			;temp store for 4 bit mode
			templcd2	
		endc

LCD_PORT	Equ	PORTA
LCD_TRIS	Equ	TRISA
LCD_RS		Equ	0x04			;LCD handshake lines
LCD_RW		Equ	0x06
LCD_E		Equ	0x07

		org	0x0000

		[COLOR="Red"]movlw	0x07
		movwf	CMCON			;turn comparators off (make it like a 16F84)[/COLOR]
 
Nigel Goodwin said:
With VERY minor modifications, turn off the comparators, alter the header and config fuse settings, and change the GPR start address - the 628 was the replacement for the 84 last century, but people seem to keep in in production by ordering the long obselete 16F84?.

I think the reason for this is that a lot of existing projects use the old 16F84 and that's why beginners still get it in their heads to use them. Actually, if you try to get information about the 16F84 on Microchip's website they warn you that it's obsolete and they advise you to order the 16F628 instead.

Brian
 
ThermalRunaway said:
Actually, if you try to get information about the 16F84 on Microchip's website they warn you that it's obsolete and they advise you to order the 16F628 instead

do you have a link of such a page that tells you to use the F628 instead of the F84?

actually i am asking because the page **broken link removed** tells you to use the F84A instead of the F84.
 
I've just checked their website and you're right it does suggest the 16F84A instead. I'm sure I read it on there somewhere though. Maybe I'm mistaken, as I can't immediately find where I read that on their website. Either way it's good advice to use the 628 :eek:

Brian
 
samcheetah said:
do you have a link of such a page that tells you to use the F628 instead of the F84?

actually i am asking because the page **broken link removed** tells you to use the F84A instead of the F84.
This link gives u some reasons for using 16F628 instead of 16F84.
The 16F628 is superior to 16F84A an ~half it's price.
http://www.finitesite.com/d3jsys/16F628.html
 
Last edited:
Nigel Goodwin said:
Just check any of my tutorials, the header changes and GPR start address are at the beginning, and the lines to disable the comparators are clearly commented. This is the beginning of my LCD tutorial, I've marked the relevent lines in red.

There used to be a migration document at MicroChip, but it's from so long ago I can't find it there any more?.

Code:
;LCD text demo - 4 bit mode
;Nigel Goodwin 2002

[COLOR="red"]	LIST	p=16F628		;tell assembler what chip we are using
	include "P16F628.inc"		;include the defaults for the chip[/COLOR]
	ERRORLEVEL	0,	-302	;suppress bank selection messages
	[COLOR="red"]__config 0x3D18			;sets the configuration settings (oscillator type etc.)[/COLOR]




		cblock	[COLOR="red"]0x20[/COLOR]			;start of general purpose registers
			count			;used in looping routines
			count1			;used in delay routine
			counta			;used in delay routine
			countb			;used in delay routine
			tmp1			;temporary storage
			tmp2
			templcd			;temp store for 4 bit mode
			templcd2	
		endc

LCD_PORT	Equ	PORTA
LCD_TRIS	Equ	TRISA
LCD_RS		Equ	0x04			;LCD handshake lines
LCD_RW		Equ	0x06
LCD_E		Equ	0x07

		org	0x0000

		[COLOR="Red"]movlw	0x07
		movwf	CMCON			;turn comparators off (make it like a 16F84)[/COLOR]
Th..and the tutorials come in handy.
 
one minor point, even the 16F628 is old, microchip recommends the 16F628A which is even cheaper than the 16F628. no differences to worry about unless you are writing programmer code.

And, yes, I totally agree that 16F88 is a much better chip to learn on. It has a slightly different pin-out but is much nicer in many ways.
 
Philba.

I learned that too after getting the 628A and making an ICD2..

16F88 is my choice too. But I am doing ICD Otherwise, the 16F84 works fine far as burn and test it. It draws more power, but works fine and there are a lot of website with projects.
 
mramos1 said:
16F88 is my choice too. But I am doing ICD Otherwise, the 16F84 works fine far as burn and test it. It draws more power, but works fine and there are a lot of website with projects.

The whole point though is the 16F628 is a drop-in replacement for the 16F84, just requiring the VERY minor code changes I gave above.

As for MicroChip listing the 84 as obselete?, they did for many years, but it was so long ago that it's probably been removed now?. (You don't get a note on the Ford site telling you to buy a Ford Focus instead of a horse and cart :D ).
 
Been a few posts since a PIC vs AVR rummble so here are my 2 cents worth on PIC vs AVR...

I started in Z80 assembly and later dabbed in the mindf!ck known as 8086 assembly (bank switching anyone?) before discovering the beauty and pleasure of writing for the 68000. I came across pics when I got sick of the Z80 + 2764 + 6264 + glue to do what were relatively simple tasks, then I found the AVR's. Hate to say it but I find writing assembly for PIC akin to stabbing myself in the face (just like in the 8086 days but for a different reason), Except its not even that efficient, because I have to move the knife into the working register first (movlw KNIFE), before I can stab myself (movwf FACE). Even makes the 6502 with its 3 working registers look like it has something going for it.

Sure 35 instructions is less, but it is not nescessary a case of less is more, I'm tighter and neater in AVR than PIC as to do the same job in a pic can take more instructions.

But at the end of the day, it is a case of what you are comfortable with, what is available to you and what you are trying to do. Most microcontrollers these days can wack the bejesus out of a Commodore 64, PC-XT or even a PC-AT and although I have nothing against the PIC, I must say I prefer to go bare metal with the AVR anyday, particularly where there is any degree of algorithm or computation required.

Nick.
 
Nick9494 said:
Sure 35 instructions is less, but it is not nescessary a case of less is more, I'm tighter and neater in AVR than PIC as to do the same job in a pic can take more instructions.

Or it can take less, depending what the task actually is?.

Your background (Z80 and 8086) is probably more biased towards AVR code than the PIC?, the VERY CISC instruction sets of the Z80 and 8086 are more like the AVR than the PIC.

I came from a 6502 background (and a little 68000), and it's fairly easy from 6502 to PIC.

Bear in mind, one HUGE difference is the PIC's Harvard architecture, which does make it quite different from almost any other processor - but, in some ways, is an advantage?.
 
I've heard a saying that "a Fortran programmer can write Fortran programs in any language" and something similar about C programmers and Perl.

Your coding mindset tends to get optimised for the language or in this case processor you are familar with so when you move to a different processor with a fundamentally different architecture it can seem like a piece of junk in comparison and coding hard work.

Inevitably some feature or functionality of one processor will be poor in comparison to another but I don't believe that the overall difference between good and bad in the PIC vs AVR debate is as big as some make it out to be.

Pete
 
Nigel Goodwin said:
Or it can take less, depending what the task actually is?.

Your background (Z80 and 8086) is probably more biased towards AVR code than the PIC?, the VERY CISC instruction sets of the Z80 and 8086 are more like the AVR than the PIC.

I came from a 6502 background (and a little 68000), and it's fairly easy from 6502 to PIC.

Bear in mind, one HUGE difference is the PIC's Harvard architecture, which does make it quite different from almost any other processor - but, in some ways, is an advantage?.

If by Harvard Architecture you mean separation of the program and data memory then there is no difference between the PIC and AVR, they are both Harvard processors. However the other 40 pin beasties including the 64 pin 68k (oooo I love those ceramic 64pin dips:p ) are not. Separation of data and program memory should allow a perfomance increase. The AVR executes nearly everything except conditional branches, literals and hardware multiplies in one clock cycle (others generally take 2), The PIC (like the Z80) seems to need at least 4 cycles to do anything.

I will admit that my approach to coding is influenced by the other processors and I prefer the flexabilty afforded by the AVR architecture, just my personal choice:) . I like being able to do anything to any register with any other register(sounds very orthogonal and RISC like doesn't it :cool: - except R0-R15 won't do it with any old literal that comes in from the program space, R16-R31 are more promiscous in this regard:eek: ) as well as having the freedom of otherwise RISC style addressing modes. The AVR architecture was developed by two Norwegian sudents (Alf and Vegard from memory) and AVR allegedly stands for "Alf and Vegard's RISC processor".

I'm sure the study that concluded most CISC addressing modes aren't used is because they were looking at output generated by compilers that weren't designed to take advantage of them.:confused: This is all well and good, design a processor to suit the compiler, save several tens of thousands of transistors as well as several thousand manhours and some tenths of grams of silicon.

My advice for the novice is to just chose a microcontoller and start some where. Once you have built up some experience you can try something else. I've written for half a dozen diffferent cores and whilst there are differences between them, there are also a lot of concepts that remain unchanged. Not everything you learn will be portable but a great proportion of it will be. Don't expect to see many 5 or 6 letter nemonics for instructions in other processors though... ;) In time you will develop your own tastes and who knows you may decide pics and avrs are pooh and go off with ST7's ARM's or the next as yet unreleased product.:D

N.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top