Code shortening

Puuhaaja

Senior Member
I have a program where I have far too many similar commands which I'm using to control lcd. My problem is that after 450 lines of code it's frustrating to write any serout commands more.

So...would it be possible to shorten command:
Code:
serout c.7, n2400, (254, 128, "Something")
to a form like
Code:
lcd (254, 128, "Something")
Any advices or ideas are wellcome
 

0rphu

New Member
If you can afford losing some time during the program execution, you could use GOSUB command, but you have to figure out the variable passing between the main program and the gosub routine. In the main program you would store your variables somewhere and then call the lcd routine. Just an idea, it's a bit too early for me to think seriously.
 

hippy

Ex-Staff (retired)
symbol lcd = serout c.7, n2400,
The Programming Editor will reject that as a syntax error.

You could write the code using "LCD" and then use Find-Replace to change all occurrences of LCD to "serout c.7, n2400".
 

womai

Senior Member
hippy, tried it and you are correct as usual :=) I was under the impression that "symbol" works similar to #define in C, i.e. does a simple "search and replace", but apparently it is more restricted (or more intelligent?).
 
Top