[SOLVED] difference between PIC16F887 and PIC16F877A

Status
Not open for further replies.

jay_3189

Banned
Joined
Sep 19, 2013
Messages
104
Helped
0
Reputation
0
Reaction score
0
Trophy points
16
Location
Ahmedabad
Visit site
Activity points
0
Hello Everyone

I want to use controller's 8 pin as a switch and that will be run by DS1307 I2C RTC.
I also want to use Temperature Controller LM35 and PWM with controller.
I will also use RS232 communication with MAX232.

I have 2 option PIC16F887 and PIC16F877A.
So, can any one say me which controller is good to use here from this two.
and also say me software list that all I need to install to write code and dump program at run time using ICSP pin and to design circuit.
I have installed 3 software upto now i.e., pickit2 , MPASMWIN, MPLAB IDE.
what is different b/w pickit2 and MPASMWIN?

I am using Embedded C language.
 
Last edited:



Hi,

There is little difference between those 2 chips and nothing for you to worry about.
Go for the 877A as it the more modern of the two chips.

If you are doing assembly then these tutorial should help get you going.

**broken link removed**
http://www.winpicprog.co.uk/pic_tutorial.htm
http://www.amqrp.org/elmer160/lessons/
http://www.epemag.wimborne.co.uk/resources.htm
http://www.mikroe.com/chapters/view/5/chapter-4-timers/


The Pickit2 can be run directly from MPLAB for programming and debugging as well as MPlabs SIMulator.
If you install PK2 V2.61 program it has a USART (rs232) simulator and Logic /Analyzer tool.

MPASM complies your Assembly code into a .hex file which the PK2 then programs / 'burns' in to your 877A chip


Below is a bit of working code that shows you how to set things up; its based on a 4 mhz crystal but other values will work ok, it will just run faster or slower.

Code:
;       progam to flash all of PortB pins on and off every 4 seconds


		list p=16f877a
		include p16f877a.inc
		__CONFIG _CP_OFF & _WDT_OFF & _XT_OSC & _PWRTE_ON & _LVP_OFF
	
		cblock 0X20			; specify user regiaters
		d1
		d2
		d3
		COUNT
		endc



		org 	0x000
		GOTO	Main



Main	CLRF	PORTB		; Set portb,c,d to digital outputs
		CLRF   	PORTC
		CLRF 	PORTD
		BANKSEL TRISA
		CLRF	TRISB
		CLRF 	TRISC
		CLRF 	TRISD
		BANKSEL 0

		

LOOP						; main program looP
		CALL	DELAY4s		; call this subrutine
		MOVLW   0xFF
		MOVWF	PORTB		; Set  port HIGH

		CALL	DELAY4s

		MOVLW   0x00
		MOVWF	PORTB		; Set  port LOW
		GOTO	LOOP		


;  SUBROUTINES
	
DELAY4s						; 4 SECOND DELAY
		movlw	0x23
		movwf	d1
		movlw	0xB9
		movwf	d2
		movlw	0x09
		movwf	d3
Delay_0
		decfsz	d1, f
		goto	dly1
		decfsz	d2, f
dly1	goto	dly2
		decfsz	d3, f
dly2	goto	Delay_0
	

		return

		END					; END OF PROGRAM CODE
 
Last edited:
There is little difference between those 2 chips and nothing for you to worry about.
Go for the 877A as it the more modern of the two chips.
Wrong . 887 is more modern than 877A
 
For your intended application, either 877A or 887 is sufficient. Go for the one you already have, or the one which is cheaper. And according to prices in Microchip Direct, 887 is much cheaper than 877A.

For more, side by side comparison, see **broken link removed**.
 
Wrong . 887 is more modern than 877A

Hi,

Thanks for the correction, misread it a 877 v 877A

However think the answer is still valid in the sense that the 877A is probably the more available and has more projects based on it than even the old 16F84A
 

Hi,

Thanks for the correction, misread it a 877 v 877A

However think the answer is still valid in the sense that the 877A is probably the more available and has more projects based on it than even the old 16F84A

With a few changes, code for 877A can be easily transferred to 887 (as for any PIC, datasheet reading is necessary).
887 has internal oscillator, it is cheaper than 877A, ...

For folks that are only doing Copy/Paste and then bragging on "their" project, I must say that those individuals are only attending "breaks" in between classes, rather than attending classes to LEARN something.
 


as 887 has internal oscillator I no need to use any external oscillator, is it?
If yes then do i need to configure it's (887) any pin for oscillator?
 
Last edited:


Hi,

Yes would agree with that sentiment in general terms, its usually quiet obvious when they post in this forum.
However, for a complete beginner looking for starter help, as Zasto appears to be, its often very helpful to be able to see or build existing projects in order to gain their coding experience.
When I started with pics I was grateful that certain folk had published their lcd routines which allowed me to get up and running much quicker and even routines for the popular DS1820 sensor which are really difficult to code in Assembly.

As for the chips, one thing I have learnt is that there does seem to be some form of discretionary supply of Pic chips worldwide.
I know that for instance the 18F chips were very limited in South America and that the 877A is widely available and cheap in India but certain newer 16Fs cheap and popular in the 'west' can be very expensive elsewhere

- - - Updated - - -

as 887 has internal oscillator I no need to use any external oscillator, is it?
If yes then do i need to configure it's (887) any pin for oscillator?

Hi,

Yes, you still need to use the CONFIG parameter to say its using the internal oscillator as you still have all the other options of crystals for very accurate functions like USB, though the internal oscillator will meet 99% of your needs , no problem.
The i/o pins that were available to the crystal will then be available for use as standard i/o pins

The Speed of your internal Oscillator is set by the OSCCON instruction in the fist lines of your Main Code.

Code:
Main	movlw	b'01100010'		; set internal osc to 4 mhz
		movwf	OSCCON
 

as 887 has internal oscillator I no need to use any external oscillator, is it?
If yes then do i need to configure it's (887) any pin for oscillator?

As I wrote many times, READ the Datasheet. Reading the datasheet for a particular uC you will familiarize yourself with it's capabilities.
As wp100 already gave you how to use internal oscillator, it frees you two pins for additional I/O.
When designing gadgets that don't need serial communication and are not time critical, internal oscillator is a benefit (3 components less on the board and some pennies morre in the pocket :-D)
Nowadays, Microchip has some uC's with USB capabilities that run on internal oscillator perfectly (very stable internal oscillator).
 
hi,
is it compulsory to use reset?
if I am not building reset button circuit in my circuit, is there any problem with that?
 

hi,
is it compulsory to use reset?
if I am not building reset button circuit in my circuit, is there any problem with that?

Hi,

No, a Reset Switch is not compulsory, but there are other conditions for Pin1, depending on the chip used.

As ZASto mentions, look at the datasheet pinout diagrams for both the 877A and 887 chips.

On Pin1 Mlcre of the 877A, like many earlier 16F chips, it shows that is functions only as Mclre or Vpp in programming mode.
For normal running you must connect pin1 to +5v ideally via a 10K resistor.

However if you are looking to do ICSP, programming to your completed circuit, you must add extra components as shown in the Pk2 user guide.

For the 887 you can see pin1 is available as VPP/Mclre and RE3 digital Input
In the Config you can specify Mclre ON or OFF, if ON then you must still pull it up to +5v.
If OFF then Mclre is internally tied to +5v and pin1 becomes available as an input, but again if doing ICSP you must ensure any device on pin1 does not affect the pk2.
 

hello

i have used pic16f887 but now there is some problems with that. i mean its not working.
so, at the place of that ic can i use pic16f877a in my already made hardware?
is that any difference in code i have to made?
if yes then what i have to see before putting pic16f877a at the place of pic16f887.
 


Definitely, there is difference in coding and CONFIG settings. Checkout this page for what you should do while switching from one controller to another, **broken link removed**
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…