All, My opinion is if you want to build an application for yourself, or for sale for that matter, and you have an idea for the software/firmware in mind, and you can get it to work, then there is no reason to not use it. With that said, obviously there are ways of optomizing some routines. But that doesn't mean that one way is more correct than another. Only that it is different. My point is this. If you want to write your software to make calculations of numbers that you may or may not use at some later time, and the unit functions as you'd like it to, then write your software that way. If you want to try to optomize your code somewhat, and you have few ideas about how to go about doing that, and you want advice from the PICLIST, then by all means ask for such advice. However, you're not wrong if you get advice and decide not to use it, but instead go with your original idea. As long as the final outcome of the device you build meets the specifications you want it to, then all is well. If anyone is angered by this, flame me off line, not on the list. Jim ----- Original Message ----- From: "Marechiare" To: "Microcontroller discussion list - Public." Sent: Monday, August 17, 2009 12:44 PM Subject: Re: [EE] How to generate a 1000 Hz pulse? (and PIC timers) >>> The foreground code grabs the current period value >>> maybe twice a second, inverts it to make speed, and >>> displays the result. >> >> There should be middle level (I'd say Business Level) code to deal >> with the persisted state. Its output should be meaningful values, like >> speed, distance etc. >> >> And there should be UI (User Interface) level code to display the BL >> level output. > > I agree that what I called "foreground code" would actually be several > modules. However, there is no point computing speed from period except > when > it's needed, which is whenever you want to display a new speed value. I agree that there is no such point for the app at this stage of the development. But later the calculated values will be needed for other functionality. So to make the app consistent snd to avoid unneeded recalculations it would make sense to provide complex calcs at some reasonable period. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist