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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Jan Waclawek
03/09/06 11:04
Read: 463 times

#111775 - lobotomy? do you like the idea?
Responding to: Andy Peters's previous message
Andy Peters said:

Delving into his code, some things became apparent. First, whenever he got the timer-tick interrupt, he completely recalculated the loop variables. Then, as part of this, he was converting the 12-bit ADC values to some long fixed-point representation of temperature in degrees Celsius! His loop worked on this value, and the result was a heater power in watts, which then had to get converted to a 12-bit value for the DAC. All in the ISR! So, no wonder he was dropping characters at the serial port--he was spending too much time in the ISR!

So I asked what's with all the conversions, and he said, "well, it wouldn't work with doubles, it seemed to crash, so I had to create this fixed-point representation ..."

I just did something similar. My colleague worked out the model, C++ on PC and did a lot of work on it. It was awfully complicated, used heaps of memory and longint everywhere and I had to squeeze it into a few kB of RAM and make it fast (asm, I hate C). I made him simplify it slightly first, then I hand "translated" it into asm, without attempting to understand it. I did a couple of errors, but the model was so complex and involved so many feedback points that the outcome was close to the expected - under certain conditions. It turned out, that it failed under a field test set. I printed it, took it home, went for a long hot bath, holding the papers in hand and trying to figure out how does it work. After 2 hours, I had freezing water, but found all the typos (mostly result of copy/paste in the long arithmetics; I wrote that dam'd 16x16 bit multiply-and-add-and-compare for a set of registers then copied it for another set but forgot to change one symbolic name of the 12 or so... it was awfully LONG and boringly repeated, the worst thing you can have when programming in asm...)

Conclusion: human is very bad in compiling without understanding.

Jan Waclawek, PhD :-)

List of 22 messages in thread
i suggest you read      Erik Malund      03/08/06 10:45      
   Flawed article      Ian Bell      03/08/06 11:17      
      men only      Jan Waclawek      03/08/06 11:28      
         you don;'t know Jack      Erik Malund      03/08/06 12:04      
            you want a laugh?      Jez Smith      03/08/06 12:44      
               Tar with the same brush      Ian Bell      03/08/06 13:47      
                  i dont think so      Jez Smith      03/08/06 23:43      
                     grades???      Jan Waclawek      03/08/06 23:53      
                     Snobbery      Ian Bell      03/09/06 03:37      
                        re grades      Erik Malund      03/09/06 06:46      
                           Graduates      Ian Bell      03/09/06 10:08      
                              yes, but      Erik Malund      03/09/06 10:43      
                                 Value of Education      Ian Bell      03/09/06 13:16      
                                    It is sad, but      Erik Malund      03/09/06 14:27      
                                       Cost of Education      Ian Bell      03/09/06 16:23      
                           gonna get a PhD, or a lobotomy      Andy Peters      03/09/06 10:50      
                              lobotomy? do you like the idea?      Jan Waclawek      03/09/06 11:04      
                              just to clerify      Erik Malund      03/09/06 11:28      
                                 I'm glad you said that ...      Richard Erlacher      03/09/06 23:08      
                           Likewise ...      Richard Erlacher      03/09/06 22:57      
   Correct by construction      Oliver Sedlacek      03/09/06 08:15      
      i do, follow much of it      Erik Malund      03/09/06 09:24      

Back to Subject List