Hello,
Im working on a project at the moment which involves four 4bit binary numbers to be recoginised.
Basically i have a process which can generate the binary equivalent of the 0-9.
Im using four inputs on an 18m2.
What I want to happen, is for an output to go high, if the numbers 6,0,1,3 (0110, 1010, 0001,0011 ) are entered in that exact sequence.
If for example if 0613 or 62013 is entered then go back to start, similiar to that of a pin code request on a moblie/cell phone.
So far I have been unsuccessfull in doing this correctly.
The code below shows the method I have been using, it has a flaw that once a number is recognised a loop occurs for a set period of time, meaning than the next number must recognised within about 2 seconds. Another fault is the output will activate as long as it received the reguired numbers within the loop, meaning that 6,0,4561,3 can be enter within the time limit and the output will go high.
My next plan is to load digits,A,B,C,D to the eeprom, and then create a progam which would scan and compare the actual input to that stored in memory.
If the numbers actually entered do not match A,B,C,D then go back to start.
Could this be done?
Would anybody have examples of code, where data is loaded to the eeprom and then read and a decision thereafter is made, as the PICAXE manual does not give much detail on an application like this.
Thanks for the help, and taking time to read.
Regards Nigel
Im working on a project at the moment which involves four 4bit binary numbers to be recoginised.
Basically i have a process which can generate the binary equivalent of the 0-9.
Im using four inputs on an 18m2.
What I want to happen, is for an output to go high, if the numbers 6,0,1,3 (0110, 1010, 0001,0011 ) are entered in that exact sequence.
If for example if 0613 or 62013 is entered then go back to start, similiar to that of a pin code request on a moblie/cell phone.
So far I have been unsuccessfull in doing this correctly.
The code below shows the method I have been using, it has a flaw that once a number is recognised a loop occurs for a set period of time, meaning than the next number must recognised within about 2 seconds. Another fault is the output will activate as long as it received the reguired numbers within the loop, meaning that 6,0,4561,3 can be enter within the time limit and the output will go high.
Code:
symbol digit_A = %10000001
symbol digit_B = %10000010
symbol digit_C = %01000000
symbol digit_D = %11000000
main:
add1:
for b0 = 1 to 500
if pins=digit_A then goto add2
next b0
goto main
add2:
for b1 = 1 to 500
if pins=digit_B then goto add3
next b1
goto main
add3:
for b2 = 1 to 500
if pins=digit_C then goto add4
next b2
goto main
add4:
for b3 = 1 to 500
if pins=digit_D then goto add5
next b3
goto main
add5:
for b4 = 1 to 5
high b.4
pause 1000
low b.4
pause 1000
next b4
goto main
My next plan is to load digits,A,B,C,D to the eeprom, and then create a progam which would scan and compare the actual input to that stored in memory.
If the numbers actually entered do not match A,B,C,D then go back to start.
Could this be done?
Would anybody have examples of code, where data is loaded to the eeprom and then read and a decision thereafter is made, as the PICAXE manual does not give much detail on an application like this.
Thanks for the help, and taking time to read.
Regards Nigel