Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] pic16F877a basic circuit problem

Status
Not open for further replies.

cheetha

Full Member level 2
Joined
Sep 17, 2011
Messages
146
Helped
1
Reputation
2
Reaction score
2
Trophy points
1,298
Activity points
2,310
I am using PIC 16F877a micro controller initially i just want to on/off an led by giving high/low to RD0and portA is constantly high , the circuit is working fine in proteus simulation but not in hardware no any port is giving any output. I am using 4MHz oscillator with 15pf capacitors ....

Thanks in Advance

LIST P=16F877a,r=hex,n=80,x=off,st=off


#include <P16F877.INC>

__CONFIG _CP_OFF & _WDT_OFF & _HS_OSC & _PWRTE_ON & _LVP_OFF

ORG 0010H

BSF STATUS, RP0
BCF STATUS, RP1
MOVLW 00H
MOVWF TRISB
MOVLW 00H
MOVWF TRISA
MOVLW 0FFH
MOVWF TRISD
BCF STATUS, RP0
BCF STATUS, RP1
CLRF 21H
CLRF 22H
CLRF 23H
MOVLW 0FFH
MOVWF PORTA

A CALL DELAY
BTFSS PORTD,0
GOTO A1
MOVLW 0FFH
MOVWF PORTB
GOTO A2
A1 CLRF PORTB
A2 CALL DELAY
GOTO A


DELAY:
MOVLW 0FFH
MOVWF 22H
AAA MOVLW 0FFH
MOVWF 21H
AA DECFSZ 21H,F
GOTO AA
DECFSZ 22H,F
GOTO AAA
RETURN


END
 

for 4MHz crytal capacitors can be used are from 15-68 pF
and
why ADCON1 and CMCON settings needed

plz help
 

Hi,

Thats a terrible example of assembler coding you have used, will post a more sensible example shortly.

As Jay said, 22-33pf is a much more typical value for the crystal caps though 15pf may work; proteus does not actually use them.
Have you got Pin1 Mlcre tied up to +5v ?

- - - Updated - - -

Hi,

Try this code, a bit easier to follow.

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 loo[
		CALL	DELAY4s
		MOVLW   0xFF
		MOVWF	PORTB		; Set  port HIGH

		CALL	DELAY4s

		MOVLW   0x00
		MOVWF	PORTB		; Set  port LOW
		GOTO	LOOP		

	
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
 

thanks alot
i have 13V DC supply i am using LM7805 for 5V output but the output i am getting is 4.2V even when controller is connected or disconnected i have also used a transformer to convert 220V to 12V AC then i used bridge rectifier and then capacitor in then i used LM7805 even then the output is not excedding 4.2V even i have replaced 3 7805 ICs but results are same
what could be the possible reason for this
plz help
 

Hi,

Unless you have the unlikely event of a faulty batch of 7805 regulators, then you must have wired them up incorrectly or have a faulty multimeter.

Can you post your actual diagram and photo of how you have done it.

Do you have a battery that you can test you meter against on that low voltage DC range ?

Your pic chip will probably just work ok at 4.2v
 

thanks again
when i programmed the controller with pickit2 the error message displayed was
device requires a minimum VDD of 4.5V for bulk erase operation ...
I continued to program but when given 4.2V of supply from 7805 the pins of all ports have 1.3V and when connected led or resistor to any pin of port B the output falls to 0.5V
I also tried to program it with genius 540 the error msg was
configuration bits not set in the code ....
I also continued to program but same results
Plz help
 

Hi,

That program code I posted runs on my hardware without any problem, its .hex file attached.

I program with a Microchip Pickit2 without problems, are you using a Microchip or a clone ?

Have you programmed any chip with the Pk2 before ?

Are you programming in circuit with your 4.2v power or are you placing the 877a in a separate programming socket ?

You have not said anything about checking your 7805 regulator circuit or multimeter, does anything get warm or hot, have you measured the current going in to the 7805 ?

You can also use the PK2 VDD TARGET CHECK to read out your 4.2V
 

Attachments

  • ledflash.zip
    234 bytes · Views: 83
  • vdd.jpg
    vdd.jpg
    16.9 KB · Views: 98

the programmer is local made pickit2 programmer using PIC18f2550 controller I don’t know much about it but when I connect to PC it shows pickit2 connected and ….
I have not programmed any ic before with it ….
I am separately programming the IC by placing it in programming socket…..
I am unable to tick the box of CHECK option nor to change the voltages which are shown as 3.4V.....
For 7805 nothing is getting hot I have also used analog DC voltage meter and same 4V is shown where as multimeter is displaying 4.2V and these voltages are open circuit voltages and when controller is connected voltages remains constant, further the input voltages are dropping from 13V to 10V
plz help
 

Hi,

The PK2, how are you controlling it, from MPLAB or from the PK2 Stand Alone Program V2.61 ?

If you are not using V2.61 download and install it from the Microchip Pk2 page.

In V2.61 under the HELP menu there is the User Guide which shows the 5 pins which need to be connected to the 877a
Its important that you connect both sets of power rails pins 11,32 to VDD +5v and 12,31 to VSS 0v
The wires between the PK2 and the 877a should be no longer 150mm.

With the 877a in the socket and your Pk2 connected, start the V2.61 and it should open with a message like my pic shows - do you get that ?

As for your 7805 problem again you have not provided any digram of how you have wired it all up or a photo so its difficult to say where things have gone wrong, particularly as you say two different meters give 4.2v

Have you tried powering the 7805 with a 6v or 9v or 12v battery to see if it delivers 5v ?
 

Attachments

  • 2013-05-12 18_16_34-PICkit 2 Programmer - 2.jpg
    2013-05-12 18_16_34-PICkit 2 Programmer - 2.jpg
    28 KB · Views: 91

i really dont know the connections on the board ......iam using V2.6 downloaded from microchip website
the warning message is still appearing....but the board is programming the IC.

for 7805 the connections are simple as the left most pin is input pin and middle pin is ground and right most pin is 5v output ...i connected 100uf capacitor at the input to ground and output to ground this caused the output voltage to rise to 4.88 to 4.9V and at this voltage the controller started working though it has to work at 4.2V....
 

Something is very wrong with your power supply, you need to sort it out before worrying about software although Jayanth has done an excellent job of writing your code properly.

Lets go back to basics - your voltmeter and the Pickit seem to agree that the supply voltage is wrong. The only thing other than faulty regulators that can cause low supply is a current overload in which the regulator should be very hot, or, the voltage at the input of the regulator is too low. I am suspicious that adding those capacitors made a difference to the voltage. They should be there but should not make the voltage increase. Can you use your meter to measure the voltage at the input pin of the regulator and tell us what it is please.

Brian.
 

thanks for cooperation
7805 is normal and input voltage is 10V...both open circuit and with controller the o/p voltage remain at 4.9V
thanks
 

Then there is something wrong. If you are using a 13V DC supply the input pin should be at 13V and if you are using the 12V transformer and bridge rectifier it should be about 16V. Check your input circuitry and in particular the capacitor value after the bridge rectifier. I suggest it should be 1000uF or more.

Brian.
 

thanks alot
the circuit is working well in simulation (ofcourse) ...............but the problem is in real hardware .........the connection are simple left pin i/p higher voltages....mid one ground...and right one must give 5V ...
 

thanks alot the circuit worked well with little modification...... i.e. the resistor R11 is replaced by variable resistor to get 5V at output.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top