28122 Parallax Inc, 28122 Datasheet - Page 302

KIT WHAT'S A MICRO:PARTS ONLY

28122

Manufacturer Part Number
28122
Description
KIT WHAT'S A MICRO:PARTS ONLY
Manufacturer
Parallax Inc
Datasheet

Specifications of 28122

Accessory Type
Parts Kit
Product
Microcontroller Accessories
Core Processor
PIC16C57c
Flash
128 Bytes
Operating Supply Voltage
9 V
Board Size
31 mm x 16 mm
For Use With/related Products
Board of Education Full Kit
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
' -----[ Title ]-----------------------------------------------------------
' What's a Microcontroller - ReusablePasswordChecker.bs2
' Check password entered in Debug Terminal's Transmit Windowpane.
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ DATA Directives ]-------------------------------------------------
Password
' -----[ Variable Declarations ]-------------------------------------------
index
temp
userEntry
' -----[ Initialization Routine ]------------------------------------------
GOSUB Check_Password
' -----[ Main Routine ]----------------------------------------------------
' There is no main routine in this program.
DEBUG CR, "All Done"
END
' -----[ Subroutine – Check for Correct Password ]-------------------------
Check_Password:
DO
LOOP UNTIL index = 5
DEBUG "Enter password: "
DEBUGIN STR userEntry \5
FOR index = 0 TO 4
NEXT
IF index <> 5 THEN
ENDIF
READ Password + index, temp
IF temp <> userEntry(index) THEN EXIT
DEBUG CR,"Password not correct.", CR
DATA
VAR
VAR
VAR
"pass!"
Nib
Byte
Byte(5)
' Store "secret" password here.
' Index variable.
' Stores single char.
' Store user entered password.
' User instructions.
' Get user input password.
' Check array against DATA
' Get next password char
' Compare to user input,
' exit if not equal.
' If exit, then index not equal
' to 5 and pass is not correct.
' Only get out of loop when
' index = 5.

Related parts for 28122