 |
 |
| View previous topic :: View next topic |
| Author |
Message |
temtronic
Joined: 01 Jul 2010 Posts: 9634 Location: Greensville,Ontario
|
|
Posted: Wed Mar 18, 2015 6:10 am |
|
|
to 'clean up' your code I would
1) put all the fuses into a separate file , then '#include <pictype.fuz>.
Similar to the pic type header, this remove a lot of distracting code from your program.AS this is a set of working fuse you can use them in future projects.Saves a LOT of typing and possible mistyping!!
2) put the LCD driver back as a file to 'include' as well. If you've modified it, save with a different name than the original. I prefer to use filename.DVR for all drivers, not the filename.H that seems to be the 'standard'. Headers to me mean a small amount of 'configuration' data not a collection of code.
3) delete any 'test' code instead of just 'commenting' them out. Again this simplifies 'main', making it easier to see what you're really doing.
4)shorten comments to remove 'wraparound' if possible. Again easier to read and understand.
5) in main() , I'd put setup_oscillator() as the first line before enabling the interrupts. While it probably doesn't matter but then I'm old school.
6) add comments to every line of code.Just a short note to say what it does or why. 3 weeks or 3 hours from now you'll wonder WHY did I do this or that ? IE delay_ms(500); I know it's to allow the LCD module to 'get organized' before the PIC accesses it but one day you'll see it, say 'bot that's a waste of time, delete it, then the program will fail, sometimes work,and you'll spend a day figuring out what you did 'wrong'.
just some things to think about
Jay |
|
 |
Sam_40
Joined: 07 Jan 2015 Posts: 127
|
|
Posted: Sat Mar 21, 2015 12:09 pm |
|
|
Jay,
Duly noted. I appreciate your input.
Thanks, |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|