PDA

View Full Version : PBP - are DEFINE command(s) mandatory?



flotulopex
- 15th September 2006, 16:20
Hello,

I just had a hard time to make some LCD displays work on my 16F88...

I was having a doubt about the use of DEFINE commands. I didn't put them originally in the code because I read this in the help file, under the LCDOUT command: "PICBasic asumes the LCD is connected to specific pins unless told otherwise."

Since my circuit was not working, someone told me to add all DEFINEs related to the LCDOUT command. So I did.

Once the display was functionning, I started to have a deeper look in my code and, as I do usually, I removed or modified one-by-one each command to evaluate and understand each command's action.

What a surprise when I finally deleted all DEFINEs. The circuit is still working fine.

Is it correct to say that DEFINE commands must only be used when our setting differ from the defaults?

Melanie
- 15th September 2006, 16:43
No, it's not mandatory... but without cross-referencing with the PICBasic manual you don't immediately know what signal is falling out of what pin.

You might know today, but in a years time after you've written a couple of dozen different programs, you then come back and look at this one to make some modifications, and it's not apparent what goes where.

Define everything. Comment everything. Document everything.