| ??? 12/10/01 10:05 Read: times |
#17482 - RE: Help!! Do I need a latch? |
Hi Carlos,
Where you would want to place the latch ? What simulator did you use ? Few remarks: 1. Avoid using assembler reserved word like "EA" is. 2. You don't have to waste precious internal RAM with variable which are useless like your "EA" is. You use EA in your program only to test the EP variable if it's 00H or 01H. Remove all instructions which modify EA and use CJNE A,#00,label and CJNE A,#01H,label 3. In "UNO" routine you check if EP variable is 01H. Even if it is or not, you load EP variable with 01H and jump to CICLO. Thus all the instruction bellow UNO label, are useless. 4. At CJNE A,EA,CAMBIO you test if EP is 0. If it is you jump to CAMBIO. Thus why MOV EP,#00H before jumping. It's useless. This I saw at first view. I didn't get too much deep inside the code. If you don't like external interrupts on falling edge and like more polling, why don't you try this: And all these without a variable like yours EP (I know its purpose is to keep trace of leading edge on P3.0) CNT EQU 70H ORG 0000H JMP INICIO ORG 0030H INICIO: MOV CNT,#00H MOV P3,#01H MOV P1,#00H CICLO: JB P3.0, CICLO ;wait a falling edge on P3.0 NOP ;you can use a real debounce cycle if the input belongs to a mechanical switch NOP NOP INC CNT MOV P1, CNT JNB P3.0, $ ; wait leading edge on P3.0 NOP ;see above 3 NOP comment NOP NOP AJMP CICLO Regards, Silviu |
| Topic | Author | Date |
| Help!! Do I need a latch? | 01/01/70 00:00 | |
| RE: Help!! Do I need a latch? | 01/01/70 00:00 | |
| RE: Help!! Do I need a latch? | 01/01/70 00:00 | |
| RE: Help!! Do I need a latch? | 01/01/70 00:00 | |
| RE: Help!! Do I need a latch? | 01/01/70 00:00 | |
| RE: Help!! Do I need a latch? | 01/01/70 00:00 | |
RE: Help!! Do I need a latch? | 01/01/70 00:00 |



