28123 Parallax Inc, 28123 Datasheet - Page 281

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
Imagine that Pos. 126 is closed. If you want to set the tap to 125, (open pos. 126 and
close pos. 125), set U/D low, then apply a pulse to CLK. If you want to set the tap to Pos
127, set U/D high, and apply 2 pulses. If you want to bring the tap down to 1, set U/D
low, and apply 126 pulses.
This next example program uses the Debug Terminal to ask you which tap setting you
want. Then it decides whether to set the U/D pin high or low, and applies the correct
number of pulses to move the tap from its old setting to the new setting.
With the exception of EEPROM Data, the next example program also has all the sections
you could normally expect to find in an application program:
Example Program: TerminalControlledDigtialPot.bs2
You can use this example program and the Debug Terminal to set the digital pot’s tap.
By changing the tap setting on the digital pot, you change the brightness of the LED
connected to the transistor that the digital pot controls. Figure 9-9 shows an example of
entering the value 120 into the Debug Terminal’s Transmit Windowpane while the
program is running. Since the old tap setting was 65, the LED becomes nearly twice as
bright when it is adjusted to 120.
Title – comments that include the filename of a program, its description, and the
Stamp and PBASIC directives.
EEPROM Data – The
I/O Definitions – constant declarations that define I/O pin numbers.
Constants – constant declarations that define other values used in the program.
Variables – variable declarations.
Initialization – a routine that gets the program started on the right foot. In this
next program, the potentiometer’s tap needs to be brought down to zero.
Main – the routine that handles the primary jobs the program has to do.
Subroutines – the segments of code that do specific jobs, either for each other, or
in this case, for the main routine.
DATA
declarations used by the program.

Related parts for 28123