Problem with Arrays of Longs
manolispotetsianakis
Posts: 3
Hello Everyone, (This is my first post)
I have a programming issue I was wandering if you could help me with.
I have connected a keyboard and a parallel LCD to my propeller. I have repeat loop running checking for key presses. Once they are found each character returned from .getkey is stored in an array of long numbers. The code looks more or less like this:
Any help would be of great value, and I would like to thank you all in advance.
I have a programming issue I was wandering if you could help me with.
I have connected a keyboard and a parallel LCD to my propeller. I have repeat loop running checking for key presses. Once they are found each character returned from .getkey is stored in an array of long numbers. The code looks more or less like this:
VAR long CommandLine [20] 'The array index := 0 repeat if KB.gotKey CommandLine[index] := KB.getKey LCD.pos(index+1,0) LCD.out(CommandLine[index] Index := index + 1The LCD displays these characters properly. The problem arises with the following function:
PUB Command (COM) | i result := true i := 0 repeat i from 0 to StrSize(COM) - 1 if (CommandLine[i] <>= COM[i]) result := falseI give it a string eg. Command(TEST) and I want it to test if the leters T E S T match those stored into the first positions of the array CommandLine[0] CommandLine[1] CommandLine[2] CommandLine[3] respectively. If all characters match I want it to return true and if not false. The code seems correct, but the if statement somehow doesnt work!
Any help would be of great value, and I would like to thank you all in advance.
Comments
But, we missed welcoming you, so welcome to this fabulous prop forum. As you can see, we are a friendly lot and it doesn't take long to get replies of assistance. SO don't hesitate to ask questions or comment.