well i don't see any line that show you send any kind of signal to your motor... can you post your whole new and fresh code???
With fresh eyes... do you see your pull-down resistor attach to the UP, DOWN pins???
well i don't see any line that show you send any kind of signal to your motor... can you post your whole new and fresh code???
With fresh eyes... do you see your pull-down resistor attach to the UP, DOWN pins???
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
No resisters are attached to the UP and DOWN pins. Does that mean their value is just floating? What value should these resistors be?
YEAH the value is floating and your PIC is between two value, and he see some pink elephant around and he's afraid of.
Value should be bellow 10K.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
lol alright thanks. I really apreciate your help mister_e. I must have missed your post about the resistors when I was responding. I'll try it in the morning. Thanks again.
No problem. Good night !!!
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
In conventional design, you would never apply your +5v to your switch. The +5v should NEVER leave your PCB, or be connected to any unnescessary component. It's valuable, you don't want to corrupt it, or add noise to it, because it could affect the operation of your PIC.
A better connection would be to have the COMMON of your switch going to Vss (0v), with either side to your PIC pins as before. You then only need a SINGLE Pull-UP resistor on each pin going to +5v. 10K is a good value.
The control logic is then INVERTED... ie the pin goes LOW when there's a switch on it... eg...
TRISB.5=1
TRISB.7=1
Loop:
If PortB.5=0 then goto DriveForward
If PortB.7=0 then goto DriveReverse
Goto Loop
Since you're experimenting, why not dispsense with the external Resistors and invoke the INTERNAL WEAK PULL-UPS that exist on PortB?
TRISB.5=1
TRISB.7=1
OPTION_REG.7=0
Loop:
If PortB.5=0 then goto DriveForward
If PortB.7=0 then goto DriveReverse
Goto Loop
Look in the PICs Datasheet to find the OPTION Register to see what that instruction does.
A better connection would be to have the COMMON of your switch going to Vss (0v), with either side to your PIC pins as before. You then only need a SINGLE Pull-UP resistor on each pin going to +5v. 10K is a good value.
On the switch its three prong. The middle prong is going to ground. The one side of it is going to PORTB.5 and the other side is going towards PORTB.7. You said put a Pull-UP resisor on the ones going to PORTB.5 and PORTB.7. That makes sense, but you said going to +5v? I don't understand that... Can you please clairfy, thanks.
Bookmarks