Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/22/02 05:51
Read: times


 
#24754 - LED+Switch trouble
I'm trying to make a simple test program in which pushing a button reverses the states of an LED, turning it on our off. The IO ping I am using for the switch is 2.6, pulled high through a 10K resistor, and set to VCC when the switch is pushed. The LED is on pin 2.0. I realize pushing the button will cause the LED to switch at a very high rate of speed rather than just switching on or off, but once the button is released, it should be at one or the other states.

Right now, it always remains on. I think this is a programming problem as I'm new to ASM. Here is the code, any suggestions?

$mod51

org 00H
jmp start

org 40H
start:

CLR A
CLR P2.6
SETB P2.0


restart:

CPL P2.0

Loop:

mov P2, A
ORL A, 20h
JZ restart

jmp loop


end



List of 9 messages in thread
TopicAuthorDate
LED+Switch trouble            01/01/70 00:00      
RE: LED+Switch trouble            01/01/70 00:00      
RE: LED+Switch trouble            01/01/70 00:00      
RE: LED+Switch trouble            01/01/70 00:00      
RE: LED+Switch trouble            01/01/70 00:00      
RE: LED+Switch trouble            01/01/70 00:00      
RE: LED+Switch trouble            01/01/70 00:00      
RE: LED+Switch trouble - thanks rob!            01/01/70 00:00      
RE: LED+Switch trouble - thanks rob!            01/01/70 00:00      

Back to Subject List