| ??? 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 |
| Topic | Author | Date |
| 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 |



