28123 Parallax Inc, 28123 Datasheet - Page 200

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
Example Program: TestPhotoresistor.bs2
Instead of twisting the potentiometer’s knob, the circuit is tested by exposing the light
collecting surface of the photoresistor to different light levels. When the example
program is running, the Debug Terminal should display small values for bright light
conditions and large values for low light conditions.
' What's a Microcontroller - TestPhotoresistor.bs2
' Read photoresistor in RC-time circuit using RCTIME command.
' {$STAMP BS2}
' {$PBASIC 2.5}
time
DO
LOOP
Your Turn – Using a Different Capacitor for Different Light Conditions
Replacing the 0.01 µF capacitor with a 0.1 µF capacitor can be useful for more brightly
lit rooms or outdoors. The time measurements with the 0.1 µF capacitor will take ten
times as long, which means the value of the
Terminal should be ten times as large.
HIGH 2
PAUSE 100
RCTIME 2, 1, time
DEBUG HOME, "time =
Enter and run TestPhotoresistor.bs2.
While watching the value of the
value under normal lighting conditions.
Turn the lights in the room off or cast a shadow over the circuit with your hand
and check the
If you face the photoresistor’s light collecting surface toward direct sunlight,
the
Modify the circuit by replacing the 0.01 µF capacitor with a 0.1 µF capacitor.
Re-run TestPhotoresistor.bs2 and verify that the RC-time measurements are
roughly ten times their former values.
time
VAR
variable should be fairly small.
time
Word
", DEC5 time
variable again. It should be a significantly larger number.
time
time
variable on the Debug Terminal note the
variable displayed by the Debug

Related parts for 28123