28129 Parallax Inc, 28129 Datasheet - Page 58

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
The next section is called the variable declarations section, and it begins with a comment
explaining that this is the declarations section. This program uses just the
variable at present. We'll add code that will make use of the other four variables
v2,
Following is a new type of declaration we haven't used before. Three constants are
defined using the
of the number
2
pin labels. The numbers were chosen based on BASIC Stamp I/O pin numbers.
Next there's the main routine section containing three
loop runs 3 different subroutines over and over again. The subroutines are named
ADC_Data, Calc_Volts,
So, how does a
GOSUB ADC_Data
finished. The program jumps to the
soon as it gets to the
after
GOSUB Calc_Volts
. The names for the pin identifications were chosen to correspond with the ADC0831's
and
GOSUB ADC_Data
' -----[ Declarations ]---------------------------------------
adcBits
v
r
v2
v3
' -----[ Initialization ]-------------------------------------
CS
CLK
DataOutput
' -----[ Main Routine ]---------------------------------------
DO
LOOP
v3.
Subroutine is a small program that does a specific task within a larger program.
GOSUB ADC_Data
GOSUB Calc_Volts
GOSUB Display
0
,
GOSUB
CLK
PIN
means go to the subroutine labeled
.
in place of the number
RETURN
directive. After we define these constants, we can use
. In this case, the next command is another
command work? As shown in the flow diagram in Figure 3-5,
VAR
VAR
VAR
VAR
VAR
PIN
PIN
PIN
and
command, the program jumps back to the command just
Display
Byte
Byte
Byte
Byte
Byte
0
1
2
ADC_Data
.
1
, and
label and starts executing commands. As
DataOutput
GOSUB
ADC_Data
commands. The
in place of the number
and come back when
GOSUB
CS
command,
adcBits
, v, R,
DO…LOOP
in place

Related parts for 28129