# PIN

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 Picomite CMM2

Syntax:
PIN( pin )
PIN( function$)
PIN( pin ) = value

Description:

PIN( pin | function$)
Returns the value on the external I/O ‘pin’.
Zero means digital low, 1 means digital high and for analog inputs it will return the measured voltage as a floating point number.
Frequency inputs will return the frequency in Hz.
A period input will return the period in milliseconds while a count input will return the count since reset (counting is done on the positive rising edge).
The count input can be reset to zero by resetting the pin to counting input (even if it is already so configured).
This function will also return the state of a pin configured as an output.

PIN( function ) CMM2
Returns the value of a special function. 'function' is a string (ie, it can be a string variable or string constant). For example PRINT PIN("BAT").
It can be one of:
"BAT" The voltage of the backup battery.
"TEMP" The temperature of the STM32 processor's core.
"DAC1" The output voltage of DAC1 (on the audio output).
"DAC2" The output voltage of DAC2 (on the audio output).
"SREF" The stored calibrated value of the internal reference voltage measured with a supply of exactly 3.3V. This is programmed into the chip during production.
“IREF” The measured value of the internal reference voltage. The actual value of VREF+ can be calculated as:
3.3 * PIN(“SREF”) / PIN(“IREF”)
and this can be used to set OPTION VCC.

PIN( pin ) = value
For a ‘pin’ configured as digital output this will set the output to low (‘value’ is zero) or high (‘value’ non-zero).
You can set an output high or low before it is configured as an output and that setting will be the default output when the SETPIN command takes effect.
See the function PIN() for reading from a pin and the command SETPIN for configuring it.

Last edited: 30 September, 2020