CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Low power lcd with flex driver
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
temtronic



Joined: 01 Jul 2010
Posts: 9634
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Mar 18, 2015 6:10 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Mar 21, 2015 12:09 pm     Reply with quote

Jay,
Duly noted. I appreciate your input.
Thanks,
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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