Keypad to LCD
Keypad to LCD
hello,
I m working on a Flowcode(attached), in which a three digit number is to be inputed from the keypad and displayed on the LCD display.
I am using key '#' as ENTER and key '*' (asterix) as RESET.
Now the problem is that when i enter the number and press reset the number 10 appears on the LCD. How can I avoid that?
Can anyone help me please
thank you in advance
Manuel.m
Credit to G4PMY for the number input section (thank you)
I m working on a Flowcode(attached), in which a three digit number is to be inputed from the keypad and displayed on the LCD display.
I am using key '#' as ENTER and key '*' (asterix) as RESET.
Now the problem is that when i enter the number and press reset the number 10 appears on the LCD. How can I avoid that?
Can anyone help me please
thank you in advance
Manuel.m
Credit to G4PMY for the number input section (thank you)
- Attachments
-
- Keypad_to_LCD_display.fcf
- Keypad with reset and enter buttons
- (10 KiB) Downloaded 613 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Keypad to LCD
Hello
Ok I have had a bit of a play around with the code. At the moment the code is a little messy and you may be able to use a loop so that you can receive any number of characters. However for now I have put the functionality you require into practise.
If you enter 3 numbers or # then the loop at the bottom of the program is triggered.
Otherwise if you press the * key at any time then you return to the start of the program.
Ok I have had a bit of a play around with the code. At the moment the code is a little messy and you may be able to use a loop so that you can receive any number of characters. However for now I have put the functionality you require into practise.
If you enter 3 numbers or # then the loop at the bottom of the program is triggered.
Otherwise if you press the * key at any time then you return to the start of the program.
- Attachments
-
- Keypad_to_LCD_display.fcf
- (14.66 KiB) Downloaded 506 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Keypad to LCD
Sorry the last file was a v4 file. I have reloaded your file into v3 and made the changes.
- Attachments
-
- Keypad_to_LCD_display.fcf
- (11.5 KiB) Downloaded 464 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Keypad to LCD
This is a routine I developed for such a purpose.
If you want code on Flowcode V3 or V4 I can post for you. This version takes it a bit further As you can see, you can enter either a digit. (Display shows you which digit you are going to enter (1, 2 or 3).
Also at any time you can enter * if you have entered an incorrect digit (e.g Dispaly will change from Enter Digit3 to Enter Digit2), Or you can enter #. Note if you enter # before entering all 3 digits, then all digits after last correct number will assign with a zero. This is for when I have to enter 100, 200 etc. Makes it a tad quicker.
I have coded it this way to reduce code size, and make it look a bit neater by using loops instead of jumps. Posted image of full code, so if you have a different version, then you just follow image.
The individual numbers are stored in an array called Digit. E.g Digit[0]=1st number,Digit[1]=2nd number and Digit[2]=3rd number
Doing it this way not only reduces code size, but with some small alterations, can also allow you to use more than three lots of numbers without increasing code size too much.
Hope this is helps.
If you want code on Flowcode V3 or V4 I can post for you. This version takes it a bit further As you can see, you can enter either a digit. (Display shows you which digit you are going to enter (1, 2 or 3).
Also at any time you can enter * if you have entered an incorrect digit (e.g Dispaly will change from Enter Digit3 to Enter Digit2), Or you can enter #. Note if you enter # before entering all 3 digits, then all digits after last correct number will assign with a zero. This is for when I have to enter 100, 200 etc. Makes it a tad quicker.
I have coded it this way to reduce code size, and make it look a bit neater by using loops instead of jumps. Posted image of full code, so if you have a different version, then you just follow image.
The individual numbers are stored in an array called Digit. E.g Digit[0]=1st number,Digit[1]=2nd number and Digit[2]=3rd number
Doing it this way not only reduces code size, but with some small alterations, can also allow you to use more than three lots of numbers without increasing code size too much.
Hope this is helps.
Martin
Re: Keypad to LCD
hello Benj
thank you for your help. I think that with some more work I would be able to achieve my goal.
regards
Manuel.m
thank you for your help. I think that with some more work I would be able to achieve my goal.
regards
Manuel.m
Re: Keypad to LCD
Hi medelec35
Thank you for your reply, I followed your reply and built the flowcode on V3, however it didn't functioned
I would greatly appreciate if you attach V3 file of this flowcode.
thank you in advance
regards
Manuel. M
Thank you for your reply, I followed your reply and built the flowcode on V3, however it didn't functioned
I would greatly appreciate if you attach V3 file of this flowcode.
thank you in advance
regards
Manuel. M
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Keypad to LCD
No problem, I appreciate its difficult if just looking at a picture of a flowchart. Originally it was created on V4 And tested on real hardware working 100%, and some functions are not available on V3. So just created V3 for you.
Here are versions for both V3 and V4.
This should be what you are after. As previously stated you will have variable Digit[0] for your 1st digit so that will work your 1st motor etc
Any problems I will see if I can help you further.
Here are versions for both V3 and V4.
This should be what you are after. As previously stated you will have variable Digit[0] for your 1st digit so that will work your 1st motor etc
Any problems I will see if I can help you further.
- Attachments
-
- Keypad_to_LCD_display for V3.fcf
- (10 KiB) Downloaded 458 times
-
- Keypad_to_LCD_display for V4.fcf
- (15.5 KiB) Downloaded 478 times
Martin
Re: Keypad to LCD
hello
Thank you medelec35 for your reply and work on converting to V3, i really appreciate. I agree with you about the fact that it is difficult,
in fact it is quite advanced flowcoding. I would see how I can modify and include statements to achieve a solution for my situation.
Meanwhile I was working on the previous flowcode (attached) to which I added the stepper motor outputs and two opto isolators which give feedback
from the mechanical system to the pic.
In the attached flowcode I used comments to describe the use of some statements and what I actually want from the flowcode.
I believe that this problem is not a difficult one, yet I couldn't figure out what could be the solution.
thank you all in advance
regards
Manuel. M
Thank you medelec35 for your reply and work on converting to V3, i really appreciate. I agree with you about the fact that it is difficult,
in fact it is quite advanced flowcoding. I would see how I can modify and include statements to achieve a solution for my situation.
Meanwhile I was working on the previous flowcode (attached) to which I added the stepper motor outputs and two opto isolators which give feedback
from the mechanical system to the pic.
In the attached flowcode I used comments to describe the use of some statements and what I actually want from the flowcode.
I believe that this problem is not a difficult one, yet I couldn't figure out what could be the solution.
thank you all in advance
regards
Manuel. M
- Attachments
-
- Number input with enter and reset.fcf
- (17.63 KiB) Downloaded 480 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Keypad to LCD
Need a bit more information. Do you want to enter 1 digit, than press a number = reverse or a different number for forwards for each individual digits, or do you want to enter 3 digits e.g 2,4,7, then press another 3 (1= forwards, 0=reverse) numbers e.g 101 which will make stepper go forwards 2 rotations, reverse 4 rotations then forwards 7 rotations.
In the sample you posted, motor will go in reverse if you press the clear '*' key.
I know you want current rotations displayed on LCD.
The more detail you can give. i.e sequence of events, when to reverse motor etc, The better.
In the sample you posted, motor will go in reverse if you press the clear '*' key.
I know you want current rotations displayed on LCD.
The more detail you can give. i.e sequence of events, when to reverse motor etc, The better.
Martin
Re: Keypad to LCD
Hi medelec35
Sorry for the Flowcode which I posted, it is misleading as I mixed the decisions for the β€ENTERβ€ and the β€RESETβ€. I attached a proper one now.
This project consists of a bus route display system. The keypad and the lcd display are to be fitted on the dashboard so the bus driver could enter the route number. Then three stepper motors drive three individual identical mechanical systems (one to represent each digit inputted on the lcd). I am going to build only one mechanical system at the moment to display Digit_one.
I uploaded a diagram as well which illustrated the control system.
When a number is inputted, e.g. 456 and the β€ENTERβ€ (# Key on the keypad) is pressed the Flowcode enters the forward loop and start turning the rolls, thus the numbers start showing up one after the other. For the motor to stop on the required number opto isolator B counts each notch that passes by. In this case it should count four notches.
When the Count is equal to Digit_one the Flowcode exits the loop and thus the motor stops. The Flowcode keep looping in that area until the β€RESETβ€ (* key on the keypad) is pressed by the driver. When the β€RESETβ€ is pressed the Flowcode enters the reverse loop to reverse the numbers back to 0. The Flowcode keep on looping until opto isolator a sense the notch which indicates that number 0 ad arrived.
When Opto_A senses the notch the Flowcode exits the loop and go back to the top where the lcd is refreshed and ready again to entered a new number.
It is quite a long explanation. Thank you for your help and time
Regards
Manuel. M
Sorry for the Flowcode which I posted, it is misleading as I mixed the decisions for the β€ENTERβ€ and the β€RESETβ€. I attached a proper one now.
This project consists of a bus route display system. The keypad and the lcd display are to be fitted on the dashboard so the bus driver could enter the route number. Then three stepper motors drive three individual identical mechanical systems (one to represent each digit inputted on the lcd). I am going to build only one mechanical system at the moment to display Digit_one.
I uploaded a diagram as well which illustrated the control system.
When a number is inputted, e.g. 456 and the β€ENTERβ€ (# Key on the keypad) is pressed the Flowcode enters the forward loop and start turning the rolls, thus the numbers start showing up one after the other. For the motor to stop on the required number opto isolator B counts each notch that passes by. In this case it should count four notches.
When the Count is equal to Digit_one the Flowcode exits the loop and thus the motor stops. The Flowcode keep looping in that area until the β€RESETβ€ (* key on the keypad) is pressed by the driver. When the β€RESETβ€ is pressed the Flowcode enters the reverse loop to reverse the numbers back to 0. The Flowcode keep on looping until opto isolator a sense the notch which indicates that number 0 ad arrived.
When Opto_A senses the notch the Flowcode exits the loop and go back to the top where the lcd is refreshed and ready again to entered a new number.
It is quite a long explanation. Thank you for your help and time
Regards
Manuel. M
- Attachments
-
- System diagram1.JPG
- Corrected flowcode
- (80.2 KiB) Downloaded 3614 times
-
- Number input with enter and reset.fcf
- Diagram illustrating the system
- (17.96 KiB) Downloaded 443 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Keypad to LCD
What you have typed made it much clearer.
Here is possibly what you want. It is nearly finished, doing odd bits when get the chance.
My thoughts are diagram is to detailed just for explanation, therefore are you working on a School, college or university project?
If so, it is in your best interest to carry on with project, and learn how it (and other functions of Flowcode) works.
That way you would be able to debug, if any problems are found.
There should be enough on here to enable you to finish.
I have added macros for all three digits. Now all three motors are set up, and independently running.
The reset currently allows you to reset (well, re-enter a digit you entered incorrectly). Before enter # key is pressed, Every time you press * , the next digit to the left can be changed.
On the LCD the bus driver will see what the bus display is current showing, as display changes.
I have not yet done the reset/reverse part, but have indicated on the flowcode where that should go. The display is automatically incremented when the opto detects next digit.
Also the motors do automatically stop when correct number is reached.
Whats happening, is the digit 2 motor is running so i/p A0 will no longer respond, instead A1 is active etc.
I have changed chip for my one, so you will need to reconfigure for your chip.
You will also need to change stepper motor driving ports.
I would also recommend the EEPROM storage. The last thing you want is loss position of numbers due to power failure. E.g if numbers are on 540 then power is lost, It would then be assumed all numbers are on 000, so would be out of sync.
Hope so far is what you are after.
Here is possibly what you want. It is nearly finished, doing odd bits when get the chance.
My thoughts are diagram is to detailed just for explanation, therefore are you working on a School, college or university project?
If so, it is in your best interest to carry on with project, and learn how it (and other functions of Flowcode) works.
That way you would be able to debug, if any problems are found.
There should be enough on here to enable you to finish.
I have added macros for all three digits. Now all three motors are set up, and independently running.
The reset currently allows you to reset (well, re-enter a digit you entered incorrectly). Before enter # key is pressed, Every time you press * , the next digit to the left can be changed.
On the LCD the bus driver will see what the bus display is current showing, as display changes.
I have not yet done the reset/reverse part, but have indicated on the flowcode where that should go. The display is automatically incremented when the opto detects next digit.
Also the motors do automatically stop when correct number is reached.
Whats happening, is the digit 2 motor is running so i/p A0 will no longer respond, instead A1 is active etc.
I have changed chip for my one, so you will need to reconfigure for your chip.
You will also need to change stepper motor driving ports.
I would also recommend the EEPROM storage. The last thing you want is loss position of numbers due to power failure. E.g if numbers are on 540 then power is lost, It would then be assumed all numbers are on 000, so would be out of sync.
Hope so far is what you are after.
- Attachments
-
- Keypad_to_LCD_display for V3R1.fcf
- (22.72 KiB) Downloaded 449 times
Martin
Re: Keypad to LCD
Hi
Thanks medelec35. Yes this is a project which I am carrying out as part of my Design and Technology course at university. Yes you are right, we are asked to give as much as possible details of the flowcode, the electronics and the mechanical control system.
Is it possible that we solve the reset problem on the previous Flowcode? The one which I uploaded (attached again here). Because it was already proposed and discussed with my lecturer and apart from that I am also capable of explaining it in detail and step by step in my report.
I greatly appreciate your Flowcode and I am sure I can learn from it, however there are some areas which I have not understood their function yet. Unfortunately about the PIC, we have a very limited choice, only PIC 16F84 and PIC 16F877A available... and I chose the PIC 16F877A because of the number of pins. I am planning to go into more detail in Part 3 of this project next year (the three displays, more system feedback and safety solutions for troubleshooting).
The problem in (β€Number input with enter and reset.fcf’) is the count up of Opto B which when it is equal to Digit_one the Flowcode exits that loop, It works for the first time(i.e Switch A1 is pressed as many times as the number in digit 1) and then after the first refresh the motor stops when Switch A1 is pressed only once.
Thank you for you help
Manuel.M
Thanks medelec35. Yes this is a project which I am carrying out as part of my Design and Technology course at university. Yes you are right, we are asked to give as much as possible details of the flowcode, the electronics and the mechanical control system.
Is it possible that we solve the reset problem on the previous Flowcode? The one which I uploaded (attached again here). Because it was already proposed and discussed with my lecturer and apart from that I am also capable of explaining it in detail and step by step in my report.
I greatly appreciate your Flowcode and I am sure I can learn from it, however there are some areas which I have not understood their function yet. Unfortunately about the PIC, we have a very limited choice, only PIC 16F84 and PIC 16F877A available... and I chose the PIC 16F877A because of the number of pins. I am planning to go into more detail in Part 3 of this project next year (the three displays, more system feedback and safety solutions for troubleshooting).
The problem in (β€Number input with enter and reset.fcf’) is the count up of Opto B which when it is equal to Digit_one the Flowcode exits that loop, It works for the first time(i.e Switch A1 is pressed as many times as the number in digit 1) and then after the first refresh the motor stops when Switch A1 is pressed only once.
Thank you for you help
Manuel.M
- Attachments
-
- Number input with enter and reset.fcf
- (18.76 KiB) Downloaded 338 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Keypad to LCD
Only made slight changes to your code. You did not reset count to 0. That reset can be placed in one of a few choice locations.
If I were you I would use the macro function when adding more outputs, just like the previous version I posted.
Another thing to think about. If numbers are moving slower than opto triggering detection times then you could have more than one count per digit.
If I were you I would use the macro function when adding more outputs, just like the previous version I posted.
Another thing to think about. If numbers are moving slower than opto triggering detection times then you could have more than one count per digit.
- Attachments
-
- Number input with enter and reset.fcf
- (18.9 KiB) Downloaded 419 times
Martin
Re: Keypad to LCD
hi medelec35
wow thats finally working as i had in mind
. so that calculation was the missing statement in my flowcode. i m also glad that you placed that clear ports after the loops, that led was annoying me however i failed to think of something like what you did. yes i will use the macros to help me keep the flowcode to a reasonable size.
thanks about the tip of the opto sensor. it is the first time which i am going to use an opto sensor. now i can proceed and build the circuit on the breadboard and test the opto sensor. i will keep you updated with work also for the benefit of other forum users.
thank you very much, i truly appreciate your help
regards
Manuel.m
wow thats finally working as i had in mind

thanks about the tip of the opto sensor. it is the first time which i am going to use an opto sensor. now i can proceed and build the circuit on the breadboard and test the opto sensor. i will keep you updated with work also for the benefit of other forum users.
thank you very much, i truly appreciate your help
regards
Manuel.m
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Keypad to LCD
Your welcome. Glad its what you had in mind. Reason I made LED go out is because you do not want a permanently magnetised coil on stepper motor, so power is cut as soon as digits are correctly located.
Martin