PinPullup
Syntax
PinPullup {Mode}, Port.Pin or Pin Number
Overview
Enables or disables the specified Port or Pin internal pull-up resistor or resistors.
Parameters
Mode is an optional parameter and can be the texts On or Enable or Off or Disable. The texts On or Enable will enable the pull-up resistor/s, while the texts Off or Disable will disable the pull-up resistor/s. If the Mode parameter is not used, the default is to enable the pull-up resistor or resistors. Port.Pin can be a Port.Pin alias. If a Port name is given without an associated Pin, all the pullup resistors will be managed for the specified Port. Pin Number can be any variable or constant or expression holding 0 to the amount of I/O pins on the device. A value of 0 will be PORTA.0, if present, 1 will be PORTA.1, 8 will be PORTB.0 etc…
Example
Symbol MyPin = PORTA.0
PinPullup PORTB.0 ' Enable the pull-up resistor for pin-0 of PORTB
PinPullup Enable, PORTB ' Enable all the pull-up resistors of PORTB
PinPullup Enable, MyPin ' Enable the pull-up resistor for pin-0 of PORTA
PinPullup Enable, PORTB.0 ' Enable the pull-up resistor for pin-0 of PORTB
PinPullup Enable, Pin_A0 ' Enable the pull-up resistor for pin-0 of PORTA.0
PinPullup Disable, MyPin ' Enable the pull-up resistor for pin-0 of PORTA
PinPullup Disable, PORTB.0 ' Disable the pull-up resistor for pin-0 of PORTB
PinPullup Disable, Pin_B0 ' Disable the pull-up resistor for pin-0 of PORTB
Notes
Each pin number has a designated name. These are Pin_A0…Pin_A7, Pin_B0…Pin_B7, Pin_C0…Pin_C7, Pin_D0…Pin_D7 to Pin_L7 etc… Each of the names has a relevant constant value, for example, Pin_A0 has the value 0, Pin_B0 has the value 8, up to Pin_L7, which has the value 87. For 8-pin devices, the pins can be referenced as Pin_IO0...Pin_IO5. The pin names can be found within the device’s .def file, within the compiler’s directory.
Not all devices have the ability to have individual pull-up resistors set or cleared on their pins. Most of the newer microcontroller’s have this ability, but if the microcontroller does not have the ability, the compiler will give a warning message. To see if the microcontroller has the ability of enabling or disabling individual pull-up resistors, look in its datasheet for the WPUx SFRs (Special Function Registers). For example WPUA or WPUB or WPUC etc…
See also : Output, Input, PinMode, PinClear, PinSet, High, Low.
