How to limit the characters ?
Francis160791
Posts: 28
i want to display only 6 characters on to my LCD. more then 6, then number cannot be display . how can i do it ? please help !
Comments
As Mike says, you need to clearly decribe exactly which LCD you have, what type of data you want to display and how you are sending it.
cause i try a lot , but still cannot work .
You sure make it hard for us to help you.
You haven't even posted your code to this thread. The code you have posted is hard to read since you didn't use code tags.
The code doesn't really make sense IMO. You use the same subroutine with every "IF" or "ELSEIF" condition when it doesn't make any sense to do so.
The code you posted has lots of problems.
I attempted to write some code based on my guess of what you're trying to do. Hopefully you can see how each "IF" or "ELSEIF" statement calls a subroutine to narrow the search of which button is pressed.
If you haven't done so yet, you really ought to work through some of the Basic Stamp tutorials. A lot of your code looks like you're taking wild guesses at how to accomplish some tasks.
It's not a complete program. You'll need to complete the various subroutines.
Use the subroutine "check6701" as a guide on how to write the other subroutines.
Each subroutine which checks for a button press should include the following code:
If no button press is detected then the counter needs to be set back to its original value.
No you can't limit the display to six characters with a custom character. A custom character is one you define yourself. Custom character #1 comes programmed with a tilde "~" but this or any other custom character could be changed. If you wanted a smiley face character you could program one of the custom characters to display a smiley face.
You'll need to keep track of how many characters have been entered into the keypad. Your original code included a counter but the code monitored the count in the wrong places in the code.
What code?
Did you write additional subroutines like "check6701" and complete the program? If so post it. Tell us what it does and what you want it to do.
I'm not sure what your question is. I see your original code as a constant for clearing the screen. I assume you use SEROUT to send the clear screen message.
The partial program I posted in post #14 was an attempt to show you a possible strategy for finding which key was pressed. The original code used the same subroutine no matter which pin was detected to be low. I thought it would be better to use separate subroutines in order to limit the number of pins to check.
I'm not sure how your key pad works. The original code seems very inefficient for finding which key was pressed. I thought it would be better to try to identify which group of keys were possibly pressed and then use a subroutine to identify which key in the group was pressed. Much of what I wrote as based on assumptions (not necessarily correct ones) of how your keypad works. Than "main" section of the code leads me to think you're using a keypad which uses some sort of matrix. But the code in "Top" looks like you're only checking individual pins. It's not clear to me how your keypad works. If your keypad uses a matrix then the code I posted may be useful however is it's not a matrix then you'll want to use a different strategy for finding which key was pressed.
The key press counter should to be monitored from the main loop.