mask - is a variable/constant specifying a bit mask of the target port.


Enable or disable the internal weak pull-up resistors on the target device.

The pullup command can enable/disable the internal pull-up resistors on some input pins. Not all pins have internal pull-up resistors. When a pin is configured as an output the pull-up is automatically disconnected. An internal pull-up allows the hardware to reliably use, for instance, a switch between the pin and ground without an external resistor. 'Mask' function varies with the PICAXE chip in use. It can contain up to 16 individual bits, bit0 to bit15. Not all pins have pullup functionality due to the internal construction of the microcontroller.

08M2 bit1-bit4 = C.1 to C.4  
14M2 bit1-bit5 = B.1 to B.5 bit8-bit12 = C.0 to C.4
18M2 bit0-bit7 = B.0 to B.7  
20M2 bit0-bit7 = B.0 to B.7 bit8-bit15 = C.0 to C.7
20X2 bit0-bit7 = C.0, C.6, C.7, B.0, B.1 B.5, B.6, B.7  
28X2/40X2 bit0-bit7 = B.0 to B.7
28X2-5V/40X2-5V On = all PORTB  
28X2-3V/40X2-3V bit0-bit7 = B.0 to B.7

On the 08M2 the C.0 pin is output only and cannot have its pull-up set; bit0 must be 0.

On the 14M2 the B.0 pin is output only and cannot have its pull-up set; bit0 must be 0.

On older 28X2-5V and 40X2-5V parts the pull-ups are on portB only, and cannot be individually masked. Therefore just use 'on' or 'off' to enable/disable all 8 pullups at the same time.

Applies To:
08M2, 14M2, 18M2, 20M2, 20X2, 28X2, 40X2
See Also:
Related Create:

Enable pull-ups

Demonstrates how to use the pullup command on various PICAXE chips

Code Example:
	pullup on 			; enable pullups on 28X2-5V
	pullup %11110000		; enable pullups on portB4-7 on 28X2
	pullup %00000111		; enable pullups on portC on 20X2
	pullup %0000001100000000	; enable pullups on C.0,C.1 on 14M2
Copy Code Submit an Example

Submit Your Own Code!

You must be logged in to submit code examples. Login now.