1
\$\begingroup\$

I've made codes of different sequences of lights but somehow this one does not work when I remove the PICkit 3, as long as the PICkit is on the circuit works.

I am supplying my circuit with a 5V-3A power supply and I am using a PIC16F877A

When I press a button situated in RC0, the following sequence of lights happens:

DEFINE OSC 4

TRISC=%00000001
TRISD=%00000000

START:

PORTC=0
PORTD=0

IF PORTC.0=1 THEN

PORTD=%11111111
PAUSE 4000
PORTD=%00000000
PAUSE 500

PORTD=%11111111
PAUSE 500
PORTD=%00000000
PAUSE 500 

PORTD=%11111111
PAUSE 500
PORTD=%00000000
PAUSE 500 

PORTD=%11111111
PAUSE 500
PORTD=%00000000
PAUSE 500 

PORTD=%11111111
PAUSE 500
PORTD=%00000000
PAUSE 500 

PORTD=%00000011
PAUSE 500
PORTD=%00000000
PAUSE 500

PORTD=%00001100
PAUSE 500
PORTD=%00000000
PAUSE 500

PORTD=%00110000
PAUSE 500
PORTD=%00000000
PAUSE 500

PORTD=%11000000
PAUSE 500
PORTD=%00000000
PAUSE 500

PORTD=%01010101
PAUSE 500
PORTD=%00000000
PAUSE 500

PORTD=%01010101
PAUSE 500
PORTD=%00000000
PAUSE 500

PORTD=%00110011
PAUSE 500
PORTD=%00000000
PAUSE 500

PORTD=%00110011
PAUSE 500
PORTD=%00000000
PAUSE 500

PORTD=%00110011
PAUSE 500
PORTD=%00000000
PAUSE 500

PORTD=%11000111
PAUSE 500
PORTD=%00000000
PAUSE 500

PORTD=%01010101
PAUSE 100
PORTD=%00000000
PAUSE 100

PORTD=%01010101
PAUSE 100
PORTD=%00000000
PAUSE 100

PORTD=%01010101
PAUSE 100
PORTD=%00000000
PAUSE 100

PORTD=%01010101
PAUSE 100
PORTD=%00000000
PAUSE 100

PORTD=%01010101
PAUSE 100
PORTD=%00000000
PAUSE 100

PORTD=%01010101
PAUSE 100
PORTD=%00000000
PAUSE 100

PORTD=%01010101 
PAUSE 100
PORTD=%00000000
PAUSE 100

PORTD=%01010101
PAUSE 100
PORTD=%00000000
PAUSE 100

ENDIF 
GOTO START
END

Here is the schematic of the circuit:

enter image description here

I have already uploaded other sequences into the PIC and they work just fine with the external power supply, I am not really sure why this one does not work without the PICkit 3

\$\endgroup\$
3
  • \$\begingroup\$ Are you 100% sure that R2 is pulling MCLR high? That has bitten me several times. \$\endgroup\$
    – AndersG
    Sep 28 '19 at 19:02
  • \$\begingroup\$ Yes, it is, I already even checked with my multimeter the resistor and it is definitely connected to +5V and it resets the program whenever I press the PB1 \$\endgroup\$
    – Victor
    Sep 28 '19 at 19:07
  • \$\begingroup\$ I didn't see any power supply in your circuit. \$\endgroup\$
    – Mike
    Oct 1 '19 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.