Help with PIC16f877a. not doing my program

Thread Starter

glenn_pangfb@yahoo.com

Joined Feb 3, 2012
7
guys , i have a deadline on a project dealing with pic16f877a making it work as a motor and compressor driver. it has a easy logic and requires a basic programming but it doesnt function as i wanted when i put it on board. can someone help or assist me regarding these.. very thankful to those can help :(
 

bertus

Joined Apr 5, 2008
19,951
Hello,

Without the schematic and program we can not help you.
Please post both and we can have a look at it.

Bertus
 

Thread Starter

glenn_pangfb@yahoo.com

Joined Feb 3, 2012
7
Rich (BB code):
Device = 16F877A
XTAL = 20
ALL_DIGITAL 1


Symbol F1 = PORTA.0
Symbol F2 = PORTA.1
Symbol R1 = PORTA.2
Symbol R2 = PORTA.3
Symbol P = PORTC.3

TRISD = %1111
TRISA = %0000
Output PORTC.3

DelayMS 1000
Start:
If PORTD = %1111 Then
F1 = 1
F2 = 1
R1 = 0
R2 = 0
P = 1     

ElseIf PORTD = %1110 Then
F1 = 0
F2 = 1
R1 = 0
R2 = 0
P = 0

ElseIf PORTD = %1101 Then
F1 = 1
F2 = 1
R1 = 0
R2 = 0
P = 1

ElseIf PORTD = %1100 Then
F1 = 0
F2 = 1
R1 = 1
R2 = 0
P = 0

ElseIf PORTD = %1011 Then
F1 = 1
F2 = 1
R1 = 0
R2 = 0
P = 1

ElseIf PORTD = %1010 Then
F1 = 0
F2 = 1
R1 = 0
R2 = 0
P = 0

ElseIf PORTD = %1001 Then
F1 = 1
F2 = 1
R1 = 0
R2 = 0
P = 1

ElseIf PORTD = %1000 Then
F1 = 0
F2 = 1
R1 = 1
R2 = 0
P = 0

ElseIf PORTD = %0111 Then
F1 = 1
F2 = 0
R1 = 0
R2 = 0
P = 0

ElseIf PORTD = %0110 Then
F1 = 1
F2 = 1
R1 = 0
R2 = 0
P = 1

ElseIf PORTD = %0101 Then
F1 = 1
F2 = 0
R1 = 0
R2 = 0
P = 0

ElseIf PORTD = %0100 Then
F1 = 0
F2 = 1
R1 = 1
R2 = 0
P = 0

ElseIf PORTD = %0011 Then
F1 = 1
F2 = 0
R1 = 0
R2 = 1
P = 0

ElseIf PORTD = %0010 Then
F1 = 1
F2 = 0
R1 = 0
R2 = 1
P = 0

ElseIf PORTD = %0001 Then
F1 = 1
F2 = 0
R1 = 0
R2 = 1
P = 0

Else
F1 = 0
F2 = 0
R1 = 0
R2 = 0
P = 0

EndIf
GoTo Start


End
 

Attachments

Last edited by a moderator:

spinnaker

Joined Oct 29, 2009
7,815
And it might help if you tell us what "doesnt function"

That is a really broad category.

What have you done to troubleshoot and narrow it down to a specific area?
 

Thread Starter

glenn_pangfb@yahoo.com

Joined Feb 3, 2012
7
And it might help if you tell us what "doesnt function"

That is a really broad category.

What have you done to troubleshoot and narrow it down to a specific area?

i am sorry i am new in posting here,,

after i had my things placed on a pcb, before i made a start of the program i always have to slide a wire with 5v to pic pins back and fort before it start, after that it goes right then malfunctioning again, unless i do that method again. but when it functions it really does my program. soory:(
 

spinnaker

Joined Oct 29, 2009
7,815
i am sorry i am new in posting here,,

after i had my things placed on a pcb, before i made a start of the program i always have to slide a wire with 5v to pic pins back and fort before it start, after that it goes right then malfunctioning again, unless i do that method again. but when it functions it really does my program. soory:(

What "pic pins" are you sliding this wire to 5V to get it to work? How do you know it is working when you do this?

Just because something works in a simulator does not mean it will work in the real world.
 

Thread Starter

glenn_pangfb@yahoo.com

Joined Feb 3, 2012
7
i got a wire with 5v from the source and slide it on all the pins of the pic sometimes just touching the 5v wire to pin 31 then it works.. i know it works when my leds light up and do what is programmed.
 

spinnaker

Joined Oct 29, 2009
7,815
i got a wire with 5v from the source and slide it on all the pins of the pic sometimes just touching the 5v wire to pin 31 then it works.. i know it works when my leds light up and do what is programmed.
STOP DOING THAT!!!!!! You are shorting VSS to VDD!

You are going to have to give a lot more details if you want people to help like explain what is connected to PORTD (your input I assume).


What have you done to troubleshoot your code? Have you stepped through the code with your debugger?
 
Top