I'm working on a bit of code to update a serial LCD display. The display is
4 lines by 40 characters, and each character can be addressed individually.

First, the pseudocode I have is:

compare each element of the new string and the old string
# each string is 160 characters, and represents what is on the
# display or what is going on the display

(if the characters differ) {
        (if the state flag is not set) {
                 set it and concatenate the direct-positioning characters
                to a temp string, along with the new character
        } else {
                just concatenate the current element of the new string to
                the temp string
        };
} else {
        (if the state flag is not set) {
                go to next element
        } else {
                (if one of the next three characters has changed) {
                keep state flag set, add character to temp string
                # idea here is it's cheaper to just print a character
                # that hasn't changed than a new set of positioning
                # characters if another character right after it has changed
                        } else {
                unset flag
                }
        }
}

If anyone can offer general improvements to that approach, that'd be
great--but what I'm really interested in is finding the first element that
differs, and maybe the last as well. If there were any easy way to find
that, say, the first character that differs is at position 120, and the last
character that differs is at position 135, then I only have to loop through
15 characters, not 160.

TIA,

paul


---------------------------------------------------------------------
On the side of the software box, in the "System Requirements" section,
it said "Requires Windows 95 or better".  So I installed Linux.
---------------------------------------------------------------------

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to