Try to set portA and B to zero before TrisCode:'declare inputs and outputs appropriately PortA = 0 PortB = 0 TRISA = %00111100 ' a.5 is INPUT only TRISB = %11100100
What value is your pulldown resistor?
Al.
Try to set portA and B to zero before TrisCode:'declare inputs and outputs appropriately PortA = 0 PortB = 0 TRISA = %00111100 ' a.5 is INPUT only TRISB = %11100100
What value is your pulldown resistor?
Al.
All progress began with an idea
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
The following may correct any R-W-M mismatch condition, but it is a little risky to write to the output latch (even if not an output) when it maybe directly connected to +5V (through the SW):Would an initial read to the port, before the actual loop, do the same?Code:PortA = 0 PortB = 0
The RBPU should be disabled by default (unless PBP assigns it behind the scenes).
For these reasons I would have the port connected to +5V through a 10k resistor; and the switch would connect the port to GND (may be through 1k for protection).
The following post may give some ideas (not identical, but helps illustrate): http://www.picbasic.co.uk/forum/show...t=weak+pull-up
Last edited by languer; - 26th August 2009 at 10:00. Reason: update with link to post
Forgot to say that should you do this:You would change your code to read, "if startbutton = 0".For these reasons I would have the port connected to +5V through a 10k resistor; and the switch would connect the port to GND (may be through 1k for protection).
Bookmarks