pullup Property

Top  Previous  Next

Gets or sets which input port pins have pull-up resistors.

Syntax

Cell.PortA.pullup

Cell.PortB.pullup

Property Value

A bit mask identifying the port pins that have input pull-up resistors.

Remarks

Setting a bit of the pullup property to 1 adds a pull-up resistor to the corresponding port pin if it is an input. This allows the input pin to be used with buttons and switches to ground without external pull-up resistors. This setting is ignored on pins that are outputs. The pull-up resistor is about 27k to the 3.3V supply voltage.

 

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

 

To enable pull-up resistors on specific pins, OR together their corresponding bit values and assign the result to pullup.

Examples

Cell.PortA.direction = 0xF0;// A0 - A3 are inputs
Cell.PortA.pullup = 0x03;// add pull-ups to A0 & A1

See Also

direction Property