28123 Parallax Inc, 28123 Datasheet - Page 302

TEXT WHAT'S A MICROCONTROLLER

28123

Manufacturer Part Number
28123
Description
TEXT WHAT'S A MICROCONTROLLER
Manufacturer
Parallax Inc
Type
Programmingr
Datasheet

Specifications of 28123

Style
Book
Title
What's a Microcontroller?
Contents
Whats a Microcontroller? Text
Product
Microcontroller Accessories
Core Processor
PIC16C57c
Flash
128 Bytes
Operating Supply Voltage
9 V
Board Size
31 mm x 16 mm
Lead Free Status / RoHS Status
Not applicable / Not applicable
' -----[ 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 28123