oIOLine Object

Back to top of pageDescription:
 A Hardware Object that consists of one of the ooPIC's I/O Lines.

The oIOLine Object provides access to a single I/O line and is essentially a pointer that allows the program to choose which I/O line to control at run time.  The program can also, at run-time, re-specify which I/O line to use at any time.

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

The difference between this object and the oDIO1 Object is that the oDIO14 Object arranges the properties in such a way that it can be used in a virtual circuit.  Another difference between the two 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 oIOLine Object.
 ObjectSizeDescriptionA1A2B1B2C1
oIOLine1 ByteControls a single I/O line.xxxxx
Back to top of pageOperation:
 An oIOLine Object provides access to an I/O Line by indexing the available I/O Lines via the value of the Group and Bit properties. 

The Line property specifies which I/O Line to use.  Once the Line property is set, the Direction and the State properties reference the actual hardware that controls the Direction and State of the specified PIC I/O Pin. 

The State property references the electrical state of the I/O Pin specified.  (Note that this property was added in Firmware C.1.  See history.)

The Direction property specifies if the I/O Pin is an input or an output.  (Note that this property was added in Firmware C.1.  See history.)

When the Direction property is set to 0 (cvOutput), then the specified Pin will output either 0 or 5 Volts depending on what the State property is set to.  When the Direction property is set to 1 (cvInput), then the specified Pin is set to be an input and the State property will report whether or not 5 Volts is being applied to the Pin by an external device.

Note that since the Direction and State properties reference the actual hardware of the specified PIC I/O Pin, then changing the Line property will also re-index the hardware that the Direction and State properties reference.   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.  For example, if Pin 1 is specified and it is an input, then the Direction property would read 1 and the State property would report the current electrical state of Pin 1.  Then if the Line property was changed to 2 and Pin 2 was an output, the Direction property will now read 0 and the State property would report the current electrical state of Pin 2.  See other examples below.

The Port property is used to specify which group of I/O lines to use.  The groups are defined by the physical PIC I/O Ports available in the PIC where 1 = Port B, 2 = Port C and 3 = Port D. Setting the Port property to 0 is a special case that concatenates Port A and Port E to form a single continuous group of I/O lines. (Note that this property was added in Firmware C.1.  See history.)

The Pin property is used to specify which pin within the Port to use.  Each bit within the PIC's I/O Port registers control a single Pin where Bit 0 is the first physical pin and Bit 7 is the eighth physical pin.  When the Port property is 0, which specifies Port A and E collectively, the pins span across Port A and Port E with the exception that Port 0, Pin 0 does not reference any pin. (Note that this property was added in Firmware C.1.  See history.)

When any of the three properties; Line, Port or Pin are set, all three are updated using the formula: Line = (Port * 8) + (Pin).  For example, if the eighth Pin in Port B is to be used, then the Line property needs to be set to 15 which works out to: Line = (1 * 8) + (7).  Likewise, the Port and Pin properties could be set to 1 and 7 respectively.  Collectively, there are Thirty-one addressable I/O Lines within the ooPIC.

Note that the Line property is the default property.  This means that if an instance of the oIOLine Object exists, then not only can the Line property be set to 8 by assigning it with the statement "IOLine.Line = 8", it can also be set with the statement: "IOLine = 8" as demonstrated in the oLED Object's help page.

Caution: the I/O lines in Group 2 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 oIOLine Object:

Property

Description

Line
A value that specifies the I/O Line to use.
Object Class: oVar5 Value Range: 0 - 31
Data Type: Numeric Default Value: 0
Used to set the Port and Pin properties collectively using the formula: Line = (Port * 8) + (Pin)
LineConstantDescription
0cvOffThe Direction and State properties reference a value of 0.
1 - 31 The Direction and State properties references the PIC hardware for the specified Pin.
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: 0
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
1The Electrical State is at a Logical Low (0 Volts).
0The Electrical State is at a Logical High (5 Volts).
Direction
A value that selects if the I/O line is a Input or an Output.
Object Class: oProperty Value Range: 0-1
Data Type: Numeric Default Value: 1 (cvInput)
Availability: This property was added if firmware version C.1.  See history
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.
State
A value that indicates the current electrical state on the I/O line.
Object Class: oProperty Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Availability: This property was added if firmware version C.1.  See history
ValueConstantDescription
0cvOffThe specified I/O line is at 0 Volts.
1cvOnThe specified I/O line is at +5 Volts.
Pin
Specifies which Pin of the port register to use.
Object Class: oSelect0to7 Value Range: 0 - 7
Data Type: Numeric Default Value: 0
Each Pin within the PIC's I/O Ports is controlled by an individual bit where bit 0 is the first physical pin and bit 7 is the eighth physical pin.
Availability: This property was added if firmware version C.1.  See history
Port
The PIC Hardware object used to control the I/O line.
Object Class: oPort Value Range: 0 - 3
Data Type: Numeric Default Value: 0
Internally select an individual PIC I/O Port registers.
Availability: This property was added if firmware version C.1.  See history
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 pageExamples:
 In the following examples, the oIOLineP Object is used.
Visual Basic SyntaxC and Java Syntax
'This program turns an 
'output on and then off at
'a rate of once a second.

Dim A As New oIOLine

Sub Main()
  A.Line = 31
  A.Direction = cvOutput
  Do
    A.State = Not A.State
    ooPIC.Delay = 1000
  Loop
End Sub
//This program turns an 
//output on and then off at
//a rate of once a second.

oIOLineP A = New oIOLine;

Void Main(Void){
  A.Line = 31;
  A.Direction = cvOutput;
  Do{
    A.State = Not A.State;
    ooPIC.Delay = 1000;
  }
}
Basic Syntax 
'This program turns an 
'output on and then off at
'a rate of once a second.

A As oIOLine(31,cvOutput)

Do
  A.State = Not A.State
  ooPIC.Delay = 1000
Loop
 

Back to top of page Related Items:

 The following table lists some of the objects that use the oIOLine Object.
 ObjectDescriptionA1A2B1B2C1
oDCMotorControls a DC motor that is driven by an LMD18200 H-Bridge driver.xxx
oIRPD1Reads a Lynxmotion IR Proximity Detector.xxxxx
oLCDSEControls a Scott Edwards Serial LCD Display.xxx
oLEDControls an LED light.xxx
oMotorMindControls a DC motor that is driven by a Motor Mind module.xxx
oSerialLProvides a low-speed asynchronous serial Input or Output on any I/O line.xxx
oServoControls an RC Servo-motor.xxxxx
oSoundginControls a Soundgin Sound Effects Engine / Voice Synthesizer chip.xxx
oSwitchReads the position of a switch.xxxxx
oUVTronHMReads a Hamamatsu UVTron Flame detector.xxx
 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oIOLineAProvides access to a single I/O Line accessible by the PIC's A2D Module.xxxxx
oIOLinePProvides access to a single I/O Line accessible by the PIC's PWM Module.xxxxx
oIOPackProvides access to four I/O lines.xxxxx
oIOGroupProvides access to eight I/O lines.xxxxx
Back to top of page Version History and Bug List:
 Firmware Ver A1: Introduced.
Firmware Ver C1: Expanded to include the Pin, Port, State and Direction properties.

Bugs: No known bugs.


 

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