ToolGuyFred
Member
PeterW said:Funnily enough when I do use S/R, I have programmed multiple instances of the same address being switched, this is because, depending on the requirements of the code, I do jump around programs at times.
That's kind of making my point. Put yourself in the position of the control guy 10 years from now, trying to troubleshoot the equipment. The most elegant solution isn't usually the most maintainable. Your example would be much easier for someone else to understand if you had a different address for each instance of your S/R then ORed them all together before they were read.
When I started in this game I wanted other programmers to admire the ingenuity and concise-ness (is that a real word?) of my code. Now I just want anyone to be able to understand how it works so they can modify it or fix the equipment it controls. Perhaps its because I don't get paid extra if I get called out in the middle of the night...