oDIO1 Object

Main Index
Object List
Back to top of pageDescription:
 The oDIO1 Object manages an I/O Line in such a way that it can be used in a virtual circuit. 

The I/O line can be set to read the electrical state presented on them or set to output a specified electrical state.

The difference between this object and the oIOLine Object is that oIOLine will use 1 byte of variable memory while the oDIO1 uses 1 byte of object memory.  This can be an important difference when creating large programs. 

 The following table lists the size and availability of the oDIO1 Object.
 ObjectSizeDescriptionA1A2B1B2C1
oDIO11 ByteProvides a 1 line digital I/O.xxxxx
Back to top of pageOperation:
 

An oDio1 Object's State property represents the electrical state of the I/O line specified by the IOLine property. The Direction property specifies if the I/O Line is an input or an output.

The State property can be pointed to by a Virtual Circuit.  This allows a Virtual Circuit to output a calculated value on the I/O Line once each Object List Loop.

When the Direction property is 1 (an input), the electrical state of the specified I/O Line is copied to the State property once each Object List Loop.

When the Direction property is 0 (an output), the electrical state of the specified I/O Line is set to the state of the State property once each Object List Loop.

When the IOLine property is set, the Direction property is updated to reflect the current state of the specified I/O Line.
Note that this means that you MUST set the IOLine property before you set the Direction property for the Direction property to affect the I/O line you want to use.

The IOLine property is an instance of the oIOLine object which is created when the oDIO1 object is.  The oDIO1 object uses the oIOLine Object to do the actual I/O to the I/O line.  Since the default property of the oIOLine specifies which I/O line to work with, then the IOLine property can be directly specified.  Example: IOLine = 1. (see oIOLine object for more detail)

Thirty-one physical 1-bit I/O Lines are implemented within the ooPIC. 

Caution: the I/O lines in I/O lines 16 - 23 are used for special purposes such as PWM, serial input/output and DDELink.  Be sure that you are not attempting to reuse them if the special functions are in use.

Back to top of pageProperties:
 

The following table lists the properties of the oDIO1 Object:

Property

Description

State
A value that indicates the electrical state to the I/O Line.
Object Class: oBit Value Range: 0 - 1
Data Type: Numeric Default Value: 0
StateConstantDescription
0cvOffThe specified I/O line is at 0 Volts.
0 (Logic)cvLowThe specified I/O line is at 0 Volts.
0 (Voltage)cvPressedA Switch connected to theoDio1 Object instance is pressed connecting the I/O line to ground.
1cvOnThe specified I/O line is at +5 Volts.
1 (Logic)cvHighThe specified I/O line is at +5 Volts.
1 (Voltage)cvUnpressedA Switch connected to theoDio1 Object instance is not pressed leaving the I/O line at +5 Volts.
IOLine
A value that specifies the I/O line to use.
Object Class: oIOLine Value Range: 0 - 31
Data Type: Numeric Default Value: 0
IOLineConstantDescription
0cvOffThe instance of the oDio1 Object is inactive and the processing time is freed for other Objects.
1 - 31 The oDio1 Object uses the pin specified for its I/O
Some I/O Lines have special purposes.  Be sure to see oIOLine help file for details.
Direction
A value that specifies if the I/O line is used as an input or an output.
Object Class: oProperty Value Range: 0 - 1
Data Type: Numeric Default Value: 0
DirectionConstantDescription
0cvOutputThe specified I/O Line is an output and the State property is written to it.
1cvInputThe specified I/O Line is High-Z and the State property is read from it.
IsLow
A value that indicates if the current state is Low.
Object Class: oProperty Value Range: 0 - 1
Data Type: Numeric (Read-Only) Default Value: (Not State)
The IsLow property reports the reverse value of the State property.  It is worded to be understood in an evaluation such as: if X.IsLow then...
IsHighDescription
0The Electrical State is at a Logical High (5 Volts).
1The Electrical State is at a Logical Low (0 Volts).
IsHigh
A value that indicates if the current state is High.
Object Class: oProperty Value Range: 0 - 1
Data Type: Numeric (Read-Only) Default Value: (State)
The IsHigh property reports the same value as the State property.  It is worded to be understood in an evaluation such as: if X.IsHigh then...
IsHighDescription
0The Electrical State is at a Logical Low (0 Volts).
1The Electrical State is at a Logical High (1 Volts).
Address
Returns a pointer to the address of the oCounter Object instance.
Object Class: oAddress Value Range: 0 - 127
Data Type:Pointer (Read Only) Default Value: Address of Object

Back to top of pageMethods:
 The following table lists the Methods of the oDIO1 Object:
Methods

Description

ClearClears the State property to 0.
InvertInverts the bits in the State property
SetSets the State property to 1.
Back to top of pageExamples:
 In the following example, the oDio1 Object is used.
'This program turns an output on and 
'then off at a rate of once a second.

Dim A As New oDio1

Sub Main()
  A.IOLine = 31
  A.Direction = cvOutput
  Do
    A.Invert
    ooPIC.Delay = 100
  Loop
End Sub
Back to top of page Related Items:
 The following table lists some objects that use the oDIO1 Object.
 ObjectDescriptionA1A2B1B2C1
o7Seg2An Object that displays a number on a Dual 7-Segment LED display.x
oIRPD1Reads a Lynxmotion IR Proximity Detector.xxxxx
oSoundginControls a Soundgin Sound Effects Engine / Voice Synthesizer chip.xxx
oSwitchReads the position of a switch.xxxxx
 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oDIO4Provides a 4-bit digital I/O.xxxxx
oDIO8Provides an 8-bit digital I/O.xxxxx
oDIO16Provides a 16-bit digital I/O.xxxxx
Back to top of page Version History and Bug List:
 Firmware Ver A1: Introduced.

Bugs: No known bugs.


ooPIC Compiler Ver 6.0 (c) Copyright 1997 - 2007 Savage Innovations, LLC.