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.

circuitry problem for 16f877a

Status
Not open for further replies.
as what i search is using 3 - 4 voltage, and the resistor connected b4 Led is 180Ohms.
my Circuit do not run the function other than led program

If your code works fine in proteus, then try connecting normal LED with a 220 ohm or 330 ohm resistance in series with the outputs, so that you can rectify the circuit. If problem is with the circuit this will works fine, try it on a breadboard if possible. First of all burn the program to PIC once again, then use a breadboard if u have one, then your circuit works fine.

Please check the MCLR pin where did you connected it? its not clear in circuit. Connect it separately to VCC by a 10K res, dont use this resistor to pull up an input pin , if you do it so when low input is applied it will reset.
 

dear all,
i ald done my circuits, the LED light is light up, but i am trying to make the light running around, but unfortunately, the light is stationary on the same LED without moving, no idea what is happening, since the coding i posted before ald been programmed into it
 

Hi,

If you post, as a .rar or .zip file, your assembler code AND the .hex code you have programmed into the chip then we can try it out.

Which Port / LED is staying on ?

Are you still using the multi led circuit you showed earlier ?
 

hi WP100

below attachment are my file included the .hex file
and it only
PORT D, 5 with 2.50V
PORTB, 3 with 2.73 V
PORTB, 7 with 2.50V
PORTC, 0
other 0 volt

from main circuit all got around 2.72 voltage, while BC369 PNP transistor only collector for portC, 0 got voltage
 

Attachments

  • test.rar
    17.2 KB · Views: 61
  • led.JPG
    led.JPG
    77 KB · Views: 71

Hi,

Have simulated your code as best as possible, cannot see the exact values from that diagram.

It is turning RC0-3 on in sequence, with PortB and D all ON.

As you can see from the screenshot it led will only illuminate in that circuit when the two connecting port pins are Low.

- - - Updated - - -

Hi,

Have simulated your code as best as possible, cannot see the exact values from that diagram.

It is turning RC0-3 on in sequence, with PortB and D all ON.

As you can see from the screenshot it led will only illuminate in that circuit when the two connecting port pins are Low.
 

Attachments

  • ScreenShot001.jpg
    ScreenShot001.jpg
    21 KB · Views: 65

I've got to say "looking at it", I think the crystal is a long way from the PIC, and lots of wire connecting the ground (but I may be misinterpeting the bottom face of the board), and that'd worry me... From the size of the crystal it looks "fairly slow", but but bits of stray capacitance can affect the oscilator...

Can you connect to it using a debugger? If not the oscilator might not be running... I prefer the 16F887 just because it has the internal oscilator, one less step to think of... Of course the PIC18f fits the same pin-setup and I'm running mine at 64Mhz (a 16Mhz crystal x 4!) happily, but lets get what in front of you going 1st...

One "trick" I sometimes use.... Take out the delay so the ports are just flashing continuously, and "flick and tickle" the oscilator pins, so the 50/60hz from the air "runs" it and at least then there's a flicker.... It just helps show the chip's ok....

Cool mate, all fun I hope
NEAL
 

Hi,

Attached is a .hex file to do a basic test on your hardware.

Just program it in and this should happen, RC0 transistor is used to turn on in sequence, RB7 Led down to RB0 Led.
Only one led should light at any one time, it will then loop around the same sequence.

Let me know if you see anything happening.
 

Attachments

  • flash8.rar
    260 bytes · Views: 63
all check, 5v is connected to 16f877a and configuration no idea whether correct or not

this is my coding
Code:
list p=16f877a
include p16f877a.inc
__CONFIG _CP_OFF & _WDT_OFF & _HS_OSC & _PWRTE_ON

cblock 0X30
	d1
	d2
	d3
	COUNT
	endc



		org 00
;		goto START

		CLRF PORTB
		CLRF PORTD
		CLRF PORTC
		BANKSEL TRISA
		MOVLW B'1111000'
		MOVLW TRISA
		CLRF TRISB
		CLRF TRISD
		CLRF TRISC
		BSF TRISC, 7
		BANKSEL PORTA
		

		MOVLW D'4'
		MOVWF COUNT
STYLE1	MOVLW B'11111111'
		MOVWF PORTB
		MOVWF PORTD
		BSF PORTC,0
CALL DELAY1
		BCF PORTC,0
		BSF PORTC,1
CALL DELAY1
		BCF PORTC,1
		BSF PORTC,2
CALL DELAY1
		BCF PORTC,2
		BSF PORTC,3
CALL DELAY1
		BSF PORTC,2
CALL DELAY1
		BSF PORTC,1
CALL DELAY1
		BSF PORTC,0
CALL DELAY1
		BCF PORTC,3
CALL DELAY1
		BCF PORTC,2
CALL DELAY1
		BCF PORTC,1
CALL DELAY1
		BCF PORTC,0
CALL DELAY1
		BSF PORTC,0
CALL DELAY1
		BSF PORTC,1
CALL DELAY1
		BSF PORTC,2
CALL DELAY1
		BSF PORTC,3
CALL DELAY1
		BCF PORTC,3
CALL DELAY1
		BCF PORTC,2
CALL DELAY1
		BCF PORTC,1
CALL DELAY1
		BCF PORTC,0
CALL DELAY1
		DECFSZ COUNT
		LGOTO STYLE1

		MOVLW D'4'
		MOVWF COUNT
			
STYLE2	MOVLW B'11111111'
		MOVWF PORTC
		MOVLW B'10001000'
		MOVWF PORTB
		MOVWF PORTD
CALL DELAY1
		MOVLW B'01000100'
		MOVWF PORTB
		MOVWF PORTD
CALL DELAY1
		MOVLW B'00100010'
		MOVWF PORTB
		MOVWF PORTD
CALL DELAY1
		MOVLW B'00010001'
		MOVWF PORTB
		MOVWF PORTD
CALL DELAY1
		CLRF PORTB
		CLRF PORTD
		CLRF PORTC
CALL DELAY1
		DECFSZ COUNT
		LGOTO STYLE2

		MOVLW D'4'
		MOVWF COUNT
			
STYLE3	MOVLW B'11111111'
		MOVWF PORTC
		MOVLW B'11110000'
		MOVWF PORTB
CALL DELAY1
		MOVLW B'00001111'
		MOVWF PORTB
CALL DELAY1
		CLRF PORTB
		MOVLW B'11110000'
		MOVWF PORTD
CALL DELAY1
		MOVLW B'00001111'
		MOVWF PORTD
CALL DELAY1
		CLRF PORTD
		CLRF PORTC
		DECFSZ COUNT
		GOTO STYLE3

		MOVLW D'4'
		MOVWF COUNT

STYLE4	MOVLW B'00001001'
		MOVWF PORTD
		MOVLW B'10010000'
		MOVWF PORTB
		BSF PORTC, 0
CALL DELAY1
		BSF PORTC, 1
CALL DELAY1
		BSF PORTC, 2
CALL DELAY1
		BSF PORTC, 3
CALL DELAY1
		BCF PORTC, 3
CALL DELAY1
		BCF PORTC, 2
CALL DELAY1
		BCF PORTC, 1
CALL DELAY1
		BCF PORTC, 0
CALL DELAY1
		BSF PORTC, 0
CALL DELAY1
		BSF PORTC, 1
CALL DELAY1
		BSF PORTC, 2
CALL DELAY1
		BSF PORTC, 3
CALL DELAY1
		BCF PORTC, 3
CALL DELAY1
		BCF PORTC, 2
CALL DELAY1
		BCF PORTC, 1
CALL DELAY1
		BCF PORTC, 0
CALL DELAY1
		DECFSZ COUNT
		LGOTO STYLE4

		MOVLW D'4'
		MOVWF COUNT

STYLE5	MOVLW B'11111111'
		MOVWF PORTC
		BSF PORTD, 7
CALL DELAY1
		BCF PORTD, 7
		BSF PORTD, 6
CALL DELAY1
		BCF PORTD, 6
		BSF PORTD, 5
CALL DELAY1
		BCF PORTD, 5
		BSF PORTD, 4
CALL DELAY1
		BCF PORTD, 4
		BSF PORTD, 0
CALL DELAY1
		BCF PORTD, 0
		BSF PORTB, 4
CALL DELAY1
		BCF PORTB, 4
		BSF PORTB, 0
CALL DELAY1
		BCF PORTB, 0
		BSF PORTB, 1
CALL DELAY1
		BCF PORTB, 1
		BSF PORTB, 2
CALL DELAY1
		BCF PORTB, 2
		BSF PORTB, 3
CALL DELAY1
		BCF PORTB, 3
		BSF PORTB, 7
CALL DELAY1
		BCF PORTB, 7
		BSF PORTD, 3
CALL DELAY1
		BCF PORTD, 3
		BSF PORTD, 2
CALL DELAY1
		BCF PORTD, 2
		BSF PORTD, 1
CALL DELAY1
		BCF PORTD, 1
		BSF PORTB, 5
CALL DELAY1
		BCF PORTB, 5
		BSF PORTB, 6
CALL DELAY1
		BSF PORTB, 5
CALL DELAY1
		BSF PORTD, 1
CALL DELAY1
		BSF PORTD, 2
CALL DELAY1
		BSF PORTD, 3
CALL DELAY1
		BSF PORTB, 7
CALL DELAY1
		BSF PORTB, 3
CALL DELAY1
		BSF PORTB, 2
CALL DELAY1
		BSF PORTB, 1
CALL DELAY1
		BSF PORTB, 0
CALL DELAY1
		BSF PORTB, 4
CALL DELAY1
		BSF PORTD, 0
CALL DELAY1
		BSF PORTD, 4
CALL DELAY1
		BSF PORTD, 5
CALL DELAY1
		BSF PORTD, 6
CALL DELAY1
		BSF PORTD, 7
CALL DELAY1
		BCF PORTB, 6
CALL DELAY1
		BCF PORTB, 5
CALL DELAY1
		BCF PORTD, 1
CALL DELAY1
		BCF PORTD, 2
CALL DELAY1
		BCF PORTD, 3
CALL DELAY1
		BCF PORTB, 7
CALL DELAY1
		BCF PORTB, 3
CALL DELAY1
		BCF PORTB, 2
CALL DELAY1
		BCF PORTB, 1
CALL DELAY1
		BCF PORTB, 0
CALL DELAY1
		BCF PORTB, 4
CALL DELAY1
		BCF PORTD, 0
CALL DELAY1
		BCF PORTD, 4
CALL DELAY1
		BCF PORTD, 5
CALL DELAY1
		BCF PORTD, 6
CALL DELAY1
		BCF PORTD, 7
CALL DELAY1
		CLRF PORTC
CALL DELAY1
		DECFSZ COUNT
		LGOTO STYLE5

		MOVLW D'4'
		MOVWF COUNT



		GOTO STYLE1

DELAY1
	movlw	0x23
	movwf	d1
	movlw	0xB9
	movwf	d2
	movlw	0x09
	movwf	d3
Delay_0
	decfsz	d1, f
	goto	$+2
	decfsz	d2, f
	goto	$+2
	decfsz	d3, f
	goto	Delay_0

			;6 cycles
	goto	$+1
	goto	$+1
	goto	$+1
		END

Code:
list p=16f877a
include p16f877a.inc
__CONFIG _CP_OFF & _WDT_OFF & _HS_OSC & _PWRTE_ON

Can you try this
Code:
list p=16f877a
include p16f877a.inc
__CONFIG _CP_OFF & _WDT_OFF & _XT_OSC & _PWRTE_ON

And i once had a problem like you mencioned also.
Do you use MPLAB ICD2 to download the program to the PIC?
If you do please try to run the PIC from there (Apply voltage and connect the MCLR pin as it should to the ICD2).
It solved my problem.

But i can't run that particular code from a usual power supply of 5V it must be the ICD2... i dunno why still, i guess i will found it out eventually ^^
 

i am using pickits to down the software, but only portc coding work for me, but portb and portd result is not i expected
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top