Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/20/08 17:16
Read: times


 
#157582 - Keil C51 Compiler Bug
Hi -- I spent about 4 weeks trying to get Code Architect's I2C routines to work. Once I found out how to do this I kept getting the wrong data back from a 32K EEPROM. I got back correct data for a BCD switch through a PCF8574N but not from the EEPROM. I finally used disassembler D52 to get the real assembler code from my HEX file and used the linkage editor output to find where in the assembler listing the code that set the variable to its value was. The code was located in an ISR and I was using register bank 2. What I found was the code used to put my byte of data back into the variable was:

<quote>

        mov   @r0,rb0r5  


</quote>
Which was a a605 (mov direct) which moved the data from absolute register location 05. ie it assumed that I was using register 5 from bank zero instead of from bank 2 where the psw was pointing.


The correct code should have been:
<quote>

       mov a,r5         
       mov @r0,a        


</quote>
Keil is suppose to be looking at this this week but the work around is to set:
<quote>

OPTIONS FOR TARGET>C51 .. <CHECK THE BOX> "DON'T USE ABSOLUTE REGISTER ACCESS"

</QUOTE>
which when checked produced the correct code and the program then worked. It looks like this problem came up before and they kludged the compiler instead of fixing it. Alvin...





List of 18 messages in thread
TopicAuthorDate
Keil C51 Compiler Bug            01/01/70 00:00      
   version?            01/01/70 00:00      
      Version            01/01/70 00:00      
   This is what Keil does            01/01/70 00:00      
      not if you follow thw rules            01/01/70 00:00      
         And also call from elsewhere?            01/01/70 00:00      
            Revision...            01/01/70 00:00      
         Using 2            01/01/70 00:00      
            did you have using 2 in the function header ?            01/01/70 00:00      
               Using 2            01/01/70 00:00      
                  correct cde ----            01/01/70 00:00      
                     Using 2            01/01/70 00:00      
                        people like it working            01/01/70 00:00      
                           Eee PC?            01/01/70 00:00      
                           HiTech vs Keil            01/01/70 00:00      
                              yes            01/01/70 00:00      
                           OCG C compiler for 8051            01/01/70 00:00      
                     incorrect code in a different place?            01/01/70 00:00      

Back to Subject List