pins Property

Top  Previous  Next

Gets or sets the logic levels on the port pins.

Syntax

Cell.PortA.pins

Cell.PortB.pins

Property Value

The logic levels on the port pins.

Remarks

When setting the pins property, only pins set as outputs are affected. When getting the pins property, pins set as inputs return the current logic level on the pin, while pins set as outputs reflect the last value written to the pin.

 

Each port pin has a corresponding bit value, as shown in the table:

 

Port Pin

Bit Value

A0/B0

0x01

A1/B1

0x02

A2/B2

0x04

A3/B3

0x08

A4/B4

0x10

A5/B5

0x20

A6/B6

0x40

A7/B7

0x80

 

Bitwise logical operations can be used to create the desired value to assign to the pins property, and to isolate input pins when getting the pins property.

Examples

Cell.PortA.direction = 0xF0;// A0 - A3 inputs, A4 - A7 outputs
Cell.PortA.pins = 0x30;// A4 & A5 high, A6 & A7 low
Cell.PortA.pins |= 0x40;// A6 now high
Cell.PortA.pins &= ~0x50;// A4 & A6 now low
Cell.PortA.pins ^= 0x10;// toggle A4
Cell.PortA.pins ^= 0x50;// toggle A4 & A6
val = Cell.PortA.pins;// read all pins
val = Cell.PortA.pins & 0x2;// only check A1
val = Cell.PortA.pins & 0x5;// look at A0 & A2

See Also

direction Property