| ??? 12/30/04 01:58 Read: times |
#84081 - No Magic Wand Responding to: ???'s previous message |
Dear all members,
I found the problem that makes my code works slower than his. It's just only few instructions that I added in (these instructions have nothing related to any loops, it just checks the port bit for the configuration). Here is a part of my code that works:
MAIN: ACALL PRESET ; Call Preset routine
CONFIG: JNB P4.6,REVDUAL ; Detect WOCT config bit
CLR IEN1.5 ; Disable Timer2 CM1 interrupt
ACALL WOCT ; Call WOCT routine
REVDUAL:JNB P1.1,DUAL ; Detect DUAL config bit
FA: JNB P1.3,FB ; Detect FWD_A enable cmd
JB P0.4,AON ; If A firing cmd on, jump to AON
JB P3.5,REG ; If Voltage still high, jump to REG
CLR P0.5 ; Turn B firing cmd off
CLR P1.2 ; Turn Regen signal off
MOV CMH0,#18H ; Load CMH0 with 18H
MOV CML0,#00H ; Load CML0 with 00H
ACALL DELAY ; 50ms
SETB TCON.4 ; Start TM0
ADUAL: SETB P0.4 ; Turn A firing cmd on
AON: JBC 20H.0,CTRLA ; Test CT0 done bit flag
AJMP CHECK1 ; /
CTRLA: AJMP FWD_C ; FWD_C control routine
FB: JNB P1.4,REG ; Detect REV_B enable cmd
JB P0.5,BON ; If B firing cmd on, jump to
JB P3.7,REG ; If voltage still high, jump to REG
CLR P0.4 ; Turn A firing cmd off
CLR P1.2 ; Turn Regen signal off
MOV CMH1,#18H ; Reload CMH1 with 18H
MOV CML1,#00H ; Reload CML1 with 00H
ACALL DELAY ; 50ms
SETB TCON.4 ; Start TM0
BDUAL: SETB P0.5 ; Turn B firing cmd on
BON: JBC 20H.0,CTRLB ; Test CT0 done bit flag
AJMP CHECK3 ; /
CTRLB: AJMP REV_C ; REV_C control routine
This is the segment of code which caused problem: Please notice those lines in bold <pre> MAIN: ACALL PRESET ; Call Preset routine CONFIG: JNB P4.6,REVDUAL ; Detect WOCT config bit CLR IEN1.5 ; Disable Timer2 CM1 interrupt ACALL WOCT ; Call WOCT routine REVDUAL:JNB P1.1,DUAL ; Detect DUAL config bit FA: JNB P1.3,FB ; Detect FWD_A enable cmd JB P0.4,AON ; If A firing cmd on, jump to AON JB P3.5,REG ; If Voltage still high, jump to REG JNB P4.6,NOCT ; Test the WOCT config bit CLR P0.5 ; Turn B firing cmd off NOCT: CLR P1.2 ; Turn Regen signal off MOV CMH0,#18H ; Load CMH0 with 18H MOV CML0,#00H ; Load CML0 with 00H ACALL DELAY ; 50ms SETB TCON.4 ; Start TM0 ADUAL: SETB P0.4 ; Turn A firing cmd on AON: JBC 20H.0,CTRLA ; Test CT0 done bit flag AJMP CHECK1 ; / CTRLA: AJMP FWD_C ; FWD_C control routine FB: JNB P1.4,REG ; Detect REV_B enable cmd JB P0.5,BON ; If B firing cmd on, jump to JB P3.7,REG ; If voltage still high, jump to REG CLR P0.4 ; Turn A firing cmd off CLR P1.2 ; Turn Regen signal off MOV CMH1,#18H ; Reload CMH1 with 18H MOV CML1,#00H ; Reload CML1 with 00H ACALL DELAY ; 50ms SETB TCON.4 ; Start TM0 BDUAL: SETB P0.5 ; Turn B firing cmd on BON: JNB P1.3,AOFF ; Detect FWD_A enable cmd BCON: JBC 20H.0,CTRLB ; Test CT0 done bit flag AJMP CHECK3 ; / AOFF: CLR P0.4 ; Turn A firing cmd off JMP BCON ; Jump back to BCON CTRLB: AJMP REV_C ; REV_C control routine It's so insignificant but somehow it affects the perfomance of the unit which causes something that I couldn't understand. Right now I can't upload the waveforms of my Tektronic 720PA scope here, but I will try later. It bothers me for a while but I don't know what it is. Hope you will shed me some light to this matter. Thank you all for your attention. Regard, T.L |
| Topic | Author | Date |
| Code efficiency/performance | 01/01/70 00:00 | |
| The human optimization | 01/01/70 00:00 | |
| No Magic Wand | 01/01/70 00:00 | |
| Optimizing | 01/01/70 00:00 | |
| A non-generalizable task... | 01/01/70 00:00 | |
| Code efficiency | 01/01/70 00:00 | |
| Single step with index finger | 01/01/70 00:00 | |
| Efficiency | 01/01/70 00:00 | |
| No Magic Wand | 01/01/70 00:00 | |
| No Magic Wand | 01/01/70 00:00 | |
Outstanding Effort ! | 01/01/70 00:00 |



