Keypad password Questions
Keypad password Questions
Hi there,
i was wondering if someone could explain me some of the things which are used in the following .fcf attached file.
I'll post what i think the most components are for, as flowcode newbie :
*The 50ms means for the LCD to 'warm up'
*The Component Macro below is used for the LCD to start up and erase all the previous.
*The 3rd component is something i don't know what it's used for, this is what it contains :
Current_Char = ' '
end = 0
valid = 0
*The 4th component i think is used to remember the the password that is entered in the next component macro, this component contains 'INPUT STRING'.
*The 5th Component is just to adjust the password, this contains, i think the Valid = compare also allows the user if the password is correct it is valid.
Input_string = Left$(Input_string, 3)
Password = "123"
valid = Compare$(Input_string, Password, 0)
*The 6th component is used to clear the LCD, but i don't really know why its placed there.
*Then we come to the Decision, this will control the both Relais used. if its correct it will active a certain relais, if its wrong it will activate another one. This will also give the Password correct or password incorrect to the LCD.
The component below are used to adjust the position of the correct/incorrect and compare the wrong/correct password given in, not sure about this.
And to be honest i don't really know what the next load of component is all about. i see an input variable for the Keypad but i really have no idea what all the rest is.
I thank everyone who takes the time to read all of this and would really appreacite it if someone could help me out here. i don't need to know everything WELL, i actually just need to know what it does but no further. i just need to explain it a bit to people who have no idea what flowcode is all about, so actually the basics of this file is fine enough
Thanks in Advance
Steve
i was wondering if someone could explain me some of the things which are used in the following .fcf attached file.
I'll post what i think the most components are for, as flowcode newbie :
*The 50ms means for the LCD to 'warm up'
*The Component Macro below is used for the LCD to start up and erase all the previous.
*The 3rd component is something i don't know what it's used for, this is what it contains :
Current_Char = ' '
end = 0
valid = 0
*The 4th component i think is used to remember the the password that is entered in the next component macro, this component contains 'INPUT STRING'.
*The 5th Component is just to adjust the password, this contains, i think the Valid = compare also allows the user if the password is correct it is valid.
Input_string = Left$(Input_string, 3)
Password = "123"
valid = Compare$(Input_string, Password, 0)
*The 6th component is used to clear the LCD, but i don't really know why its placed there.
*Then we come to the Decision, this will control the both Relais used. if its correct it will active a certain relais, if its wrong it will activate another one. This will also give the Password correct or password incorrect to the LCD.
The component below are used to adjust the position of the correct/incorrect and compare the wrong/correct password given in, not sure about this.
And to be honest i don't really know what the next load of component is all about. i see an input variable for the Keypad but i really have no idea what all the rest is.
I thank everyone who takes the time to read all of this and would really appreacite it if someone could help me out here. i don't need to know everything WELL, i actually just need to know what it does but no further. i just need to explain it a bit to people who have no idea what flowcode is all about, so actually the basics of this file is fine enough
Thanks in Advance
Steve
- Attachments
-
- Second Picture
- fcf2.JPG (26.51 KiB) Viewed 10948 times
-
- First picture
- fcf1.JPG (18.36 KiB) Viewed 10949 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 password Questions
Hello
Once the string is collected it is compared with the "Password" string and the result is placed into variable valid.
Depending on the state of the valid variable selects the outcome of the program which decides to accept or reject the password.
This is just to ensure that the chip has started ok. If you have a noisy reset switch then adding this delay can help with performance. However it is not essential to include this delay.*The 50ms means for the LCD to 'warm up'
This is simply ensuring that variables get reset to 0 or strings get set to null.*The 3rd component is something i don't know what it's used for, this is what it contains :
This calls a flowcode software macro that is essentially another flowchart window similar to the main. In this macro is a routine to create a string based on keypad presses.*The 4th component i think is used to remember the the password that is entered in the next component macro, this component contains 'INPUT STRING'.
Once the string is collected it is compared with the "Password" string and the result is placed into variable valid.
Depending on the state of the valid variable selects the outcome of the program which decides to accept or reject the password.
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
Re: Keypad password Questions
Hey Benj,
Thanks already for the info u've giving about the previous post, i'm starting to understand the chart alot better now.
I still have a few questions. i've said this about the decision : *Then we come to the Decision, this will control the both Relais used. if its correct it will active a certain relais, if its wrong it will activate another one. This will also give the Password correct or password incorrect to the LCD.
is this correct said ?
And if u can, could u please explain the other flowchart, but it doesn't need to be discussed all to the point, just the basics if you want.
Thanks in advance,
Thanks already for the info u've giving about the previous post, i'm starting to understand the chart alot better now.
I still have a few questions. i've said this about the decision : *Then we come to the Decision, this will control the both Relais used. if its correct it will active a certain relais, if its wrong it will activate another one. This will also give the Password correct or password incorrect to the LCD.
is this correct said ?
And if u can, could u please explain the other flowchart, but it doesn't need to be discussed all to the point, just the basics if you want.
Thanks in advance,
- Attachments
-
- Keypad Password.fcf
- (9.5 KiB) Downloaded 428 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 password Questions
Hello
Basically C0 and C1 could be connected directly to a red and green LED. The green LED would only come on when the password was correct. C1 could also be connected to a relay to allow for a electronic latch or similar to be opened.
The input string macro is a simple loop that repeats until the end variable is not equal to 0.
We then simply check the keypad and based on the keypad button press we decide what to do.
If the press is * then clear our input string to start over.
If the press is # then assign the end variable a value to exit the loop and perform the comparison.
If the press is under 255 and not * or # then we have a numeric keypress. Add the ASCII data to our comparison string.
At the bottom there is another small loop that forces the program to wait until the key has been released,. This means we only enter one character rather then a few thousand when pressing the keypad button for any length of time.
Hope this helps.
Basically C0 and C1 could be connected directly to a red and green LED. The green LED would only come on when the password was correct. C1 could also be connected to a relay to allow for a electronic latch or similar to be opened.
The input string macro is a simple loop that repeats until the end variable is not equal to 0.
We then simply check the keypad and based on the keypad button press we decide what to do.
If the press is * then clear our input string to start over.
If the press is # then assign the end variable a value to exit the loop and perform the comparison.
If the press is under 255 and not * or # then we have a numeric keypress. Add the ASCII data to our comparison string.
At the bottom there is another small loop that forces the program to wait until the key has been released,. This means we only enter one character rather then a few thousand when pressing the keypad button for any length of time.
Hope this helps.
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
Re: Keypad password Questions
Hey,
Yes thanks i'm learning alot thanks to you now
i still have a few questions though. u mentioned about the INIT first char, but what does it actually do? u said ''This is simply ensuring that variables get reset to 0 or strings get set to null.'', but what is the actuall meaning of this?
And could u maybe also discribe what actually a 'string' is. i thought this was with the LCD that gives you the chance to write letters.
thanks in advance!
Yes thanks i'm learning alot thanks to you now
i still have a few questions though. u mentioned about the INIT first char, but what does it actually do? u said ''This is simply ensuring that variables get reset to 0 or strings get set to null.'', but what is the actuall meaning of this?
And could u maybe also discribe what actually a 'string' is. i thought this was with the LCD that gives you the chance to write letters.
thanks in advance!
- 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 password Questions
Hello
The variables you define in flowcode end up as mapped memory locations inside the microcontroller.
When the microcontroller starts up these memory locations can have any value present in them, do not count on it always being 0.
Initialising the variables to null or 0 ensures that we always have a definite starting point where the variables are equal to 0 or in the case of strings, empty.
A string is simply an array of bytes normally containing ASCII data. Flowcode sees arrays of bytes and strings differently to allow for the string manipulation functions to be easier to understand.
The variables you define in flowcode end up as mapped memory locations inside the microcontroller.
When the microcontroller starts up these memory locations can have any value present in them, do not count on it always being 0.
Initialising the variables to null or 0 ensures that we always have a definite starting point where the variables are equal to 0 or in the case of strings, empty.
A string is simply an array of bytes normally containing ASCII data. Flowcode sees arrays of bytes and strings differently to allow for the string manipulation functions to be easier to understand.
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
Re: Keypad password Questions
Hello,
thanks Benj for the information it really helped me alot so far!
I was wondering on how to program the following : its like a 'silent alarm'. if u adjust the password at the component 'Compare input string and Password'. and u change it for example to 456, is it possible if i typ 654 ( so the code you enter at the macro ) the relais would go on aswell? so for example if i change it back to 123 -> relais goes on, and if i type 123 or 321 the relay would be activated aswell?
Regards!
thanks Benj for the information it really helped me alot so far!
I was wondering on how to program the following : its like a 'silent alarm'. if u adjust the password at the component 'Compare input string and Password'. and u change it for example to 456, is it possible if i typ 654 ( so the code you enter at the macro ) the relais would go on aswell? so for example if i change it back to 123 -> relais goes on, and if i type 123 or 321 the relay would be activated aswell?
Regards!
- Attachments
-
- Keypad Password.fcf
- (9.5 KiB) Downloaded 394 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 password Questions
Hello
Yes this is possible to do. Just repeat the string comparison code using different preset key strings.
You could even use my auto string reversal example (TUT29 in the "Flowcode V3/Examples" folder) to automatically reverse the comparison string and then repeat the comparison process.
Instead of having code in both the yes and no you now want to catch a single valid password. So if any of the comparisons are correct you could set a variable with say a value of 1. At the top of your loop set this to 0 so the comparison will fail if no string is matched. Then at the bottom of the loop test the variable to see if it is equal to 1. If it is then switch on the relay if not then switch on a red LED etc.
Hope this helps.
Yes this is possible to do. Just repeat the string comparison code using different preset key strings.
You could even use my auto string reversal example (TUT29 in the "Flowcode V3/Examples" folder) to automatically reverse the comparison string and then repeat the comparison process.
Instead of having code in both the yes and no you now want to catch a single valid password. So if any of the comparisons are correct you could set a variable with say a value of 1. At the top of your loop set this to 0 so the comparison will fail if no string is matched. Then at the bottom of the loop test the variable to see if it is equal to 1. If it is then switch on the relay if not then switch on a red LED etc.
Hope this helps.
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
Re: Keypad password Questions
Hey,
OkΓ© i'll try to complete it, i'm starting to see u as a flowcode god, u know an answer on every question i ask
about the chart again,
Could u maybe give a bit information about these 4 components. that's the only thing i don't understand yet from the MAIN chart.
Thank joe again
Steve
OkΓ© i'll try to complete it, i'm starting to see u as a flowcode god, u know an answer on every question i ask
about the chart again,
Could u maybe give a bit information about these 4 components. that's the only thing i don't understand yet from the MAIN chart.
Thank joe again
Steve
- Attachments
-
- last.JPG (12.02 KiB) Viewed 10883 times
Re: Keypad password Questions
I think the LCD cursor is just for the x,y position of the number you've typed and the correct code next to it.
the LCD printstring is used so u can see what u have typed on the LCD
the Printspace is just a macro used to have a space between what you have typed and the correct number of the input string.
the Print stored is used so it remembers the password what is give at the input string.
Input_string = Left$(Input_string, 3)
Password = "123"
valid = Compare$(Input_string, Password, 0)
is this correct or near correct?
1 more question, i've removed String Manipulation, both of them in the Input String Chart, this is what it contains Input_string = ""
but this doesnt give any change to the chart because i can just type the password wrong/correct or adjust it and try again and it works.. so could u maybe say what those 2 components are for?
Kind regards
the LCD printstring is used so u can see what u have typed on the LCD
the Printspace is just a macro used to have a space between what you have typed and the correct number of the input string.
the Print stored is used so it remembers the password what is give at the input string.
Input_string = Left$(Input_string, 3)
Password = "123"
valid = Compare$(Input_string, Password, 0)
is this correct or near correct?
1 more question, i've removed String Manipulation, both of them in the Input String Chart, this is what it contains Input_string = ""
but this doesnt give any change to the chart because i can just type the password wrong/correct or adjust it and try again and it works.. so could u maybe say what those 2 components are for?
Kind regards
- 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 password Questions
Hello Azii
Yes your explaination of the program looks correct.
Regarding the string manipulations they are simply initialising or clearing the string variable.
Variables on a microcontroller always start in a unknown state so it is best to initialise them before use. Eg if we were to create a count variable we would have to assign 0 to it before we started counting otherwise there would be no guarentee that actually started from 0.
Yes your explaination of the program looks correct.
Regarding the string manipulations they are simply initialising or clearing the string variable.
Variables on a microcontroller always start in a unknown state so it is best to initialise them before use. Eg if we were to create a count variable we would have to assign 0 to it before we started counting otherwise there would be no guarentee that actually started from 0.
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
Re: Keypad password Questions
Hello,
OkΓ© thanks alot for all the answers on my questions Benj, they really helped me alot further.
Thanks!
OkΓ© thanks alot for all the answers on my questions Benj, they really helped me alot further.
Thanks!
Re: Keypad password Questions
Hi there,
i have a question regarding the * button on they keypad, could u maybe program it if i for example type 456 but i want to change it to 457, that if i click on the * it resets the whole LCD, because now if i want to reset it, I need to click the Reset Switch on the PICmicro controller hardware manually.
Kind Regards,
Steve
i have a question regarding the * button on they keypad, could u maybe program it if i for example type 456 but i want to change it to 457, that if i click on the * it resets the whole LCD, because now if i want to reset it, I need to click the Reset Switch on the PICmicro controller hardware manually.
Kind Regards,
Steve
- 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 password Questions
Hello Steve
Yes this is possible. You would simply do something similar to the following.
Comp Macro: Keypad: ReadAsAscii -> keypad_in
Decision: keypad_in = '*'
Yes: String Manip: String_Var = ""
This program basically reads the ascii value from the keypad. If the value is equal to the * character then clear the contents of the comparison string variable.
Yes this is possible. You would simply do something similar to the following.
Comp Macro: Keypad: ReadAsAscii -> keypad_in
Decision: keypad_in = '*'
Yes: String Manip: String_Var = ""
This program basically reads the ascii value from the keypad. If the value is equal to the * character then clear the contents of the comparison string variable.
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
Re: Keypad password Questions
Hey Benj,
Yes i've manage program it so the " * " works.
but instead of the Yes: String Manip: String_Var = "". i've just put LCD macro with clear and a 50ms delay in front of it.
Kind Regards
Steve
Yes i've manage program it so the " * " works.
but instead of the Yes: String Manip: String_Var = "". i've just put LCD macro with clear and a 50ms delay in front of it.
Kind Regards
Steve