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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Andy Peters
03/09/06 10:50
Read: 460 times
Tucson, Az

#111772 - gonna get a PhD, or a lobotomy
Responding to: Erik Malund's previous message
Erik Malund said:
I have had the "pleasure" of inyetviewing/working with recent Phd graduates, and, in all cases, I would rather work with a techical school graduate with 25 years of experience.

I had the misfortune of having to fix an 8051-based temperature-control board designed and programmed by a guy with a Ph.D. in controls. Very simple PID loop with a 9600 bps RS-232 connection to a host computer. The host could send ASCII commands (like temperature setpoint, enable/disable) and get status back (current temperature, loop error, etc). Basically, a timer set the interval at which temperature samples were taken (12-bit ADC), the loop was updated and a new heater value was written to a 12-bit DAC.

The first problem was the communication seemed to fail. Characters would get dropped, etc. The PhD said, "it must be line noise or something." Yeah, right: the serial cable was about two feet long.

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 ..."

Yep, you guessed it. He'd tried to take his Matlab/Simulink model, which of course used floating-point values and worked in the natural units of temperature and power, and spit out a C program that probably ran fine on a PC, and execute it on the micro. He ran into the issue with floating-point libraries being non-reentrant but didn't realize what that meant. Then he ran into execution-time issues because he was an idiot. Too much theory, no practical experience, and worse, an arrogant attitude.

Needless to say, I re-wrote the whole thing. The loop itself was model in integer ADUs instead of degrees, no ridiculous conversions necessary. The timer-tick ISR read the ADC and set a "got new temperature reading" flag which the main program recognized, and then updated the loop and wrote a new heater value to the DAC. Ran fine.

(The whole thing should have never been built in the first place .. just buy a Lakeshore box and be done with it.)


PS: one former colleague got his PhD. We did a bunch of projects, where he did the theoretical stuff and I actually built the hardware. He wasn't allowed to touch a soldering iron. This arrangement worked well.

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