198 of 286
184 PutPin Type Subroutine Invocation PutPin(pin, mode) Parameter Method Type Description pin ByVal Byte The pin to configure. mode ByVal Byte The configuration mode (see below). Discussion This routine is used to configure a pin to be an input or an output or to effect a change in the output logic level. If the pin is configured as an input, it may be configured to be in “tri-state” mode or “pull-up” mode. If the pin is configured to be an output, the output level may be set to zero or 1. The table below gives the values for each of the possible modes. If an invalid mode is specified or an invalid pin is specified, the routine has no effect. Values for the mode Parameter Value Built-in Constant Description 0 zxOutputLow The pin is an output at logic zero. 1 zxOutputHigh The pin is an output at logic one. 2 zxInputTriState The pin is an input with the pull-up resistor disabled. 3 zxInputPullUp The pin is an input with the pull-up resistor enabled. 4 zxOutputToggle Change the logic level of the output. 5 zxOutputPulse Pulse the output. Note that for modes 4 and 5 to be useful, the pin must have been previously set to be an output. Mode 4 (zxOutputToggle) will change the output to the opposite logic level. Mode 5 (zxOutputPulse) will change the output to the opposite level for a short period of time and then change it back to the original level. The duration of the pulse will be about 8 CPU cycles (approximately 0.5uS at 14.7456MHz). Example Call PutPin(12, zxOutputLow) ' pin 12 will be at logic zero Compatibility Modes 4 and 5 are not available in BasicX. See Also GetPin