| Once the Line property is, which specifies which Analog I/O line to use, 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. The Direction property specifies if the I/O Pin is an input or an output. 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 Line 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. Note that the oIOLineA Object does not control the analog conversion module. That job is reserved for the oA2D Object which uses the oIOLineA Object to designate which I/O Line it is going to use. Also note that the Line property is the default property. This means that if an instance of the oIOLineP Object exists, then not only can the Line property be set to 1 by assigning it with the statement "IOLine.Line = 1", it can also be set with the statement: "IOLine = 1" as demonstrated in the oA2D Object. |