StickOS
DI-159 PLC Hardware Manual
analog
Configure the maximum analog supply voltage millivolts with the following command:
analog
millivolts
This value defaults to 3300 mV and is stored in flash and affects all analog I/O pins.
Example
The DI-159 PLC can perform analog input as simply as digital I/O.
The following BASIC program takes a single measurement of an analog input at pin "an0" and
displays it:
>
new
>
10 dim potentiometer as pin an0 for analog input
>
20 print "potentiometer is", potentiometer
>
run
potentiometer is 2026
> _
Note that analog inputs and outputs are represented by integers in units of millivolts (mV).
Note that almost all statements that can be run in a program can also be run in "immediate"
mode, at the command prompt. For example, after having run the above program, the "poten-
tiometer" variable (and an0 pin) remain configured, so you can type:
>
print "potentiometer is now", potentiometer
potentiometer is now 2027
> _
This also demonstrates how you can examine variables (or pins!) at the command prompt dur-
ing program debug.
63
Summary of Contents for DI-159
Page 51: ...StickOS DI 159 PLC Hardware Manual 4 is even _ 51...
Page 76: ...DI 159 Block Diagram 76...
Page 77: ...Dimensional Drawing 77...