avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Compiled code; output Bug or Not?


From: Panther Electronics
Subject: [avr-gcc-list] Compiled code; output Bug or Not?
Date: Sun, 12 Jan 2003 12:36:43 +0530

hi
 
void check_pa(void)
{
    p_ptr = (PINB);
    if (!debounce(zone_pa1, 250, 0))
        trg_pa1();
    if (!debounce(zone_pa2, 250, 0))
        trg_pa2();
    if (!debounce(zone_pa3, 250, 0))
        trg_pa3();
    if (!debounce(zone_tmpr, 250, 1))
        trg_tmpr();
}
 
debounce is a function;
 
unsigned char debounce( unsigned char pin, unsigned int db_time, unsigned char state);
 
the above code compiles with two "RET". out of my two cent memory this should not be the case. :-(
could the gurus comment on this? Ok, the code runs, no problems but if the thing must not be there, the question is why is it there? or is this bug when using function call?
 
*00000154:check_pa
   +00000154: B386      IN      R24,0x16
   +00000155: 2799      CLR     R25
   +00000156: 93900065  STS     0x0065,R25
   +00000158: 93800064  STS     0x0064,R24
   +0000015A: E040      LDI     R20,0x00          ; 0x00 = 0b00000000 = 0
   +0000015B: EF6A      LDI     R22,0xFA          ; 0xFA = 0b11111010 = 250
   +0000015C: E070      LDI     R23,0x00          ; 0x00 = 0b00000000 = 0
   +0000015D: E087      LDI     R24,0x07          ; 0x07 = 0b00000111 = 7
   +0000015E: D197      RCALL   debounce
   +0000015F: 2388      AND     R24,R24
   +00000160: F409      BRNE    +0x01             ; Destination: 0x000162
   +00000161: D01A      RCALL   trg_pa1
   +00000162: E040      LDI     R20,0x00          ; 0x00 = 0b00000000 = 0
   +00000163: EF6A      LDI     R22,0xFA          ; 0xFA = 0b11111010 = 250
   +00000164: E070      LDI     R23,0x00          ; 0x00 = 0b00000000 = 0
   +00000165: E086      LDI     R24,0x06          ; 0x06 = 0b00000110 = 6
   +00000166: D18F      RCALL   debounce
   +00000167: 2388      AND     R24,R24
   +00000168: F409      BRNE    +0x01             ; Destination: 0x00016A
   +00000169: D01A      RCALL   trg_pa2
   +0000016A: E040      LDI     R20,0x00          ; 0x00 = 0b00000000 = 0
   +0000016B: EF6A      LDI     R22,0xFA          ; 0xFA = 0b11111010 = 250
   +0000016C: E070      LDI     R23,0x00          ; 0x00 = 0b00000000 = 0
   +0000016D: E085      LDI     R24,0x05          ; 0x05 = 0b00000101 = 5
   +0000016E: D187      RCALL   debounce
   +0000016F: 2388      AND     R24,R24
   +00000170: F409      BRNE    +0x01             ; Destination: 0x000172
   +00000171: D01A      RCALL   trg_pa3
   +00000172: E041      LDI     R20,0x01          ; 0x01 = 0b00000001 = 1
   +00000173: EF6A      LDI     R22,0xFA          ; 0xFA = 0b11111010 = 250
   +00000174: E070      LDI     R23,0x00          ; 0x00 = 0b00000000 = 0
   +00000175: E082      LDI     R24,0x02          ; 0x02 = 0b00000010 = 2
   +00000176: D17F      RCALL   debounce
   +00000177: 2388      AND     R24,R24
   +00000178: F409      BRNE    +0x01             ; Destination: 0x00017A
   +00000179: D01A      RCALL   trg_tmpr
     +0000017A: 9508      RET   // There are two RET am not sure if this is a valid compile ?
   +0000017B: 9508      RET
avr-gcc-list at http://avr1.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]