??? 01/20/11 18:31 Read: times |
#180728 - Help needed please for Polling a switch! |
Hi,
I am having some issues with polling a switch. At the moment my program is flashing 2 L.E.D's from port 3 (P3.5 & P3.7). What I am having trouble with is: Making port P3.6 turn on when a switch (P3.2) is pressed and once the switch is released the program should carry on flashing the 2 L.E.D's. My program for flashing the 2 L.E.D's with a WRONG polling method: [ main1() { #pragma asm Start: mov P3, #07Fh ACALL Delay mov P3, #0DFh ACALL Delay SETB P3.2 ;// Turn the switch port on. JNC, carry ;// If carry flag occurs jump to carry sub routine. Delay: mov R7, #0Fh outloop1: mov R6, #0Fh midloop1: mov R5, #0FFh inloop1: djnz R5, inloop1 djnz R6, midloop1 djnz R7, outloop1 carry: mov P3, #0bfh ;// turn on led 3.6 // SJMP, Start ;// Jump to start // #pragma endasm } ] Can anyone please help me with this, im not sure what is wrong? thanks, Rinty |
Topic | Author | Date |
Help needed please for Polling a switch! | 01/01/70 00:00 | |
It's the #pragma asm again | 01/01/70 00:00 | |
why use assembler for assembler? | 01/01/70 00:00 | |
Other than using a Compiler | 01/01/70 00:00 | |
Assembly program for blink and push button | 01/01/70 00:00 | |
I doubt he's (still) listening | 01/01/70 00:00 |