Table of Contents

pin_configure

WMPRO FW >= 1.0 WMMEGA FW >= 2.0

Configure an I/O pin as a digital input, output, or analog input

Description

pin_configure ( int $pin_index, int $pin_type [, int $counter_type ] )

This function will change settings for certain pins on WattmonPRO and MEGA. This is actually not to be used unless you know what you are doing, because it may cause certain parts of the device to not function properly.

Parameters

$pin_index: The internal pin number. These are the configurable pins:

Pin IndexExternal Label (Physical)DefaultSettable asDescription
0 VIN/A1 (PIN 2) ANALOGANALOG/INPUT/OUTPUTVoltage of primary input
1 A2 (PIN 3) ANALOGANALOG/INPUT/OUTPUTVoltage of A2 input
2 A3 (PIN 4 ) ANALOGANALOG/INPUT/OUTPUTVoltage of A3 input
3 Internally availableANALOGANALOG/INPUT/OUTPUTNo physical connection
6 DI1 (PIN 16) INPUT INPUT/COUNTER Digital input (opto-isolated) or counter
7 DI2 (PIN 17) INPUT INPUT/COUNTER Digital input (opto-isolated) or counter
8 DI3 (PIN 18) INPUT INPUT/COUNTER Digital input (opto-isolated) or counter
9 DI4 (PIN 19) INPUT INPUT/COUNTER Digital input (opto-isolated) or counter
10DO1 (PIN 21) OUTPUTINPUT/OUTPUT Digital output
11DO2 (PIN 22) OUTPUTINPUT/OUTPUT Digital output
12DO3 (PIN 23) OUTPUTINPUT/OUTPUT Digital output
13DO4 (PIN 24) OUTPUTINPUT/OUTPUT Digital output
14RL1 (PIN 13) OUTPUTINPUT/OUTPUT Latches the relay on (should never be kept on for long, just pulse to switch)
15RL2 (PIN 14) OUTPUTINPUT/OUTPUT Latches the relay off (should never be kept on for long, just pulse to switch)

$pin_type: Any of the following (if settable for that pin), allowed values:

Pin TypeDescription
1 Digital Output
2 Digital Input
4 Analog Input
16Counter

$counter_type: Optional if configuring a COUNTER (pin index 6-9), choose from the following:

Counter TypeDescription
0Trigger on High
1Trigger on Low
2Trigger on any change

Return Values

None

See Also

pin_get() - Return the value of an I/O pin

pin_set() - Set a digital output to value 1 or 0

adc_read() - Read an onboard ADC channel