28129 Parallax Inc, 28129 Datasheet - Page 106

TEXT BASIC ANALOG & DIGITAL

28129

Manufacturer Part Number
28129
Description
TEXT BASIC ANALOG & DIGITAL
Manufacturer
Parallax Inc
Type
Programmingr
Datasheet

Specifications of 28129

Style
Book
Title
Basic Analog and Digital
Contents
Basic Analog and Digital Text
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
This is the simplest form of DAC subroutine covered in Chapter #4.
The
location in the Debug Terminal corresponding to the magnitude of the measured voltage
at that instant. The higher the voltage measurement, the further to the right the cursor is
printed in the Debug Terminal.
The
and over again. In this case it's repeated
four) times. After all those spaces, an asterisk and carriage return are printed so that the
next asterisk for the next voltage measurement will appear on the next line.
How many spaces before the asterisk is printed? Let's say we are measuring 3 volts, the
highest voltage level the DAC is supposed to output. Remember that
number sent by the ADC0831, and it's between 0 and 255 on a 5-volt scale. Therefore
when 3-volts is measured:
The number of spaces is:
adcBits
The maximum voltage will place an asterisk 39 spaces across the Debug Terminal.
Try changing the value of
change both the amplitude and the period of the triangle wave. This is an example where
the limits of the
network D/A converter.
DEBUG
DEBUG
RETURN
DAC:
RETURN
Display:
RETURN
/4, which is 153/4 = 38.25 = 38 rounded to zero decimal places.
GOSUB Display
DIRB = 15
OUTB = n
PAUSE 50
DEBUG REP " "\adcBits/4,"*", CR
modifier
command in the
FOR…NEXT
adcBits = (3/5) X 255 = 153
REP
is what causes the " " (single space) character to be printed over
n
loop are set to the voltage output limits of the resistive ladder
in the
Display
FOR…NEXT
subroutine is what places the asterisks in the
adcBits/4
loop in the
(the value of
code block
adcBits
. In this case, it will
adcBits
divided by
is the

Related parts for 28129