oPort Object

Main Index
Object List
Back to top of pageDescription:
 

An Object that controls the PIC's I/O Port Hardware Module. 

The PIC's I/O Port Hardware Module controls all of the PIC's input and output lines.

The following table lists the size and availability of the oPort Object.
 ObjectSizeDescriptionA1A2B1B2C1
oPort1 ByteAn Object that controls the PIC's I/O Port Hardware Module.x
Back to top of pageOperation:
 An oPort Object provides access to the PIC's I/O Ports by indexing them via the value of the Port Property.  Once the Port property is set, the Direction and the State properties will reflect the Direction and State of the specified PIC I/O Port.

The Port property specifies 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 causes the oPort to be inactive.

When the State property is read, the value returned is the actual electrical state of the I/O lines within the port specified by the Port property.  If any I/O lines have been set to be outputs then typically the value returned is the output value.  However, if there is an excessive load on the outputs, then the electrical state may be read differently.

When the State property is written, the electrical state of the I/O lines are set only on the I/O lines that have been designated as an output.

Note that the two PIC I/O Ports A and E are not controllable with this object.

Back to top of pageProperties:
 

The following table lists the properties of the oPort Object:

Property

Description

Port
A value that selects the I/O Group to use.
Object Class: oSelect0to3 Value Range: 0 - 3
Data Type: Numeric Default Value: 0
The following table list the values of the Port Property.
ValueDescription
0

The oPort Object is inactive

1

Direction and State read/write from PIC Port B.

2

Direction and State read/write from PIC Port C.

3

Direction and State read/write from PIC Port D.

Direction
A value that specifies which pins in the port are inputs and which pins are outputs.
Object Class: oProperty Value Range: 0 - 255
Data Type: Numeric Default Value: N/A
State
A value that indicates the current electrical state on the pins of the port.
Object Class: oProperty Value Range: 0 - 255
Data Type: Numeric Default Value: N/A
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 pageExample:
 In the following example uses the oPort Object.
' This program sets the I/O lines
' on PIC Port B to outputs and 
' then sets them to output 5 Volts.

Dim A As oPort

Sub Main()
  A.Port = 1
  A.Direction = &B00000000
  A.State = &B11111111
End Sub
Back to top of page Related Items:
 The following table lists objects that use the oPort Object.
 ObjectDescriptionA1A2B1B2C1
oIOLineProvides access to a single I/O Line.xxxxx
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
oIOGroup16Provides access to sixteen I/O lines.xxxxx
Back to top of page Version History and Bug List:
 Firmware Ver C1: Introduced.

Bugs: No known bugs.


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