Hi All..
Am using this code as a simple password check on a serial link :-
Code:
hserout [":- "]
hserin 65535,bed, [pass (0)]: hserout [pass (0)]
hserin 65535,bed, [pass (1)]: hserout [pass (1)]
hserin 65535,bed, [pass (2)]: hserout [pass (2)]
hserin 65535,bed, [pass (3)]: hserout [pass (3)]
hserin 65535,bed, [pass (4)]: hserout [pass (4)]
hserin 65535,bed, [pass (5)]: hserout [pass (5)]
hserin 65535,bed, [pass (6)]: hserout [pass (6)]
hserin 65535,bed, [pass (7)]: hserout [pass (7)]
hserin 65535,bed, [pass (8)]: hserout [pass (8),10,13]
IF ("2" = pass(0))and ("9" = pass(1))and ("9" = pass(2))and ("7" = pass(3))and ("9" = pass(4))and ("2" = pass(5))and ("4" = pass(6))and ("5" = pass(7))and ("8" = pass(8)) THEN correct
There are nine decimal digits which have to be correct.... but some times it fails on the last digit, but not always ?? If I cut the pass word to 4 digits it fails also on the last digit ????
My question is... is there a more elegant way of doing the above? I still want to see each char as typed...wich rules out a string of words.
But more I need it to be reliable..I am using a 4 Meg Xtal my defines are :-
Code:
DEFINE OSC 4 'Set oscillator in MHz
'OSCCON = $60 '4 Megs
DEFINE HSER_RCSTA 90H 'Set receive status and control
DEFINE HSER_TXSTA 24H 'Set transmit status and control
DEFINE HSER_BAUD 9615 'Baud Rate
ADCON1 = 7 ' Turns Analogs off
CMCON0 = 7 'Disable both comparators
ANSEL = 0 ' Set all analog pins to digital
thank you for looking....
Bookmarks