??? 04/07/07 14:33 Read: times Msg Score: -1 -1 Answer is Wrong |
#136790 - I was rying to help !! Responding to: ???'s previous message |
Andy Neil said: David Prentice said:
It would be easiest to re-write it in C. False. The code relies upon timing loops - you do not want to be writing timing loops in 'C'!! Then you can get your structure correct. non-sequitur - it is perfectly feasible to write well-structured code in assembler! Conversely, it is all too common to see poorly structured code in 'C'! I2C coding does not require strict timing. You only have to make sure that your pulses are long enough for the chip spec. With a standard 8051 at 12MHz you are ALWAYS going to >= 1 uS. You have two choices for EEPROM writing: either exceed max write time in spec or poll the device until it says it is ready. The latter approach is far more efficient. You can create strict timing code in C or assembler. You can create poor structures in any language. My point is that with C you can place an algorithm on one page and it is easier to limit spaghetti. You can leave the compiler to look after register usage etc. Having said that, I do enjoy neat and structured assembly code. David |