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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/09/06 18:04
Read: times


 
#111775 - lobotomy? do you like the idea?
Responding to: ???'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
TopicAuthorDate
i suggest you read            01/01/70 00:00      
   Flawed article            01/01/70 00:00      
      men only            01/01/70 00:00      
         you don;'t know Jack            01/01/70 00:00      
            you want a laugh?            01/01/70 00:00      
               Tar with the same brush            01/01/70 00:00      
                  i dont think so            01/01/70 00:00      
                     grades???            01/01/70 00:00      
                     Snobbery            01/01/70 00:00      
                        re grades            01/01/70 00:00      
                           Graduates            01/01/70 00:00      
                              yes, but            01/01/70 00:00      
                                 Value of Education            01/01/70 00:00      
                                    It is sad, but            01/01/70 00:00      
                                       Cost of Education            01/01/70 00:00      
                           gonna get a PhD, or a lobotomy            01/01/70 00:00      
                              lobotomy? do you like the idea?            01/01/70 00:00      
                              just to clerify            01/01/70 00:00      
                                 I'm glad you said that ...            01/01/70 00:00      
                           Likewise ...            01/01/70 00:00      
   Correct by construction            01/01/70 00:00      
      i do, follow much of it            01/01/70 00:00      

Back to Subject List