28123 Parallax Inc, 28123 Datasheet - Page 286

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
P1. Use the digital potentiometer circuit from Figure 9-6, p. 269 and the
Vdd
UdPin
ClkPin
counter
LOW UdPin
FOR counter = 0 TO 128
NEXT
photoresistor circuit from Figure 7-2, p. 191.
This solution is based on TerminalControlledDigitalPot.bs2, except instead of
being controlled by typing in the Debug Terminal, it is controlled by reading the
photoresistor. A subroutine,
using
becomes the new tap setting, and the original program does the work to set the
tap. The parts of the original program that ask for input from the Debug
Terminal were deleted, including the
' What's a Microcontroller - Ch9Prj01_PhotoControlledDigitalPot.bs2
' Update digital pot's tap based on photoresistor reading
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
' -----[ Declarations and Initialization]------------------------------
UdPin
ClkPin
PhotoPin
DelayPulses
DelayReader
PULSOUT ClkPin,5
PAUSE 1
P6
P5
RCTIME
2
3
4
1
CLK
U/D
A1
GND
AD5220
as shown in Chapter 5. The reading from the photoresistor
CON
CON
VAR
CON
CON
CON
CON
CON
Vss
Vdd
W1
CS
B1
8
7
6
5
Vdd
5
6
Byte
5
6
2
10
2000
100
100
Read_Photoresistor
kΩ
kΩ
Vdd
Get_New_Tap_Setting
Vss
P2
' Set values of I/O pins
' connected to CLK and U/D.
' Set U/D pin for Down.
' Set tap to lowest position.
' Set values of I/O pins
' connected to CLK and U/D.
' Photoresistor on pin P2
' Delay to observe LED fade.
' Counter for FOR...NEXT.
220
, reads the photoresistor
Vss
subroutine.
0.01 µF

Related parts for 28123