User Tools

Site Tools


uphp:functions:pin_configure

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
uphp:functions:pin_configure [2017/05/13 11:32]
admin
uphp:functions:pin_configure [2021/09/13 05:57] (current)
Line 1: Line 1:
-pin_configure lets you change settings for certain pins on the WattmonPRO and MEGA.+======pin_configure======
  
-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.+<badge>WMPRO FW >= 1.0</badge> <badge>WMMEGA FW >= 2.0</badge>
  
-For the WattmonPRO:+Configure an <tooltip title="Input/Output">I/O</tooltip> pin as a digital input, output, or analog input
  
-pin_configure(int $pin_number, int $pin_type, optional int $cntype) +====Description====
  
-$pin_number the internal pin number for mappingsee below+<well size="sm"><html> 
 +<span style="font-size:125%">pin_configure ( 
 +<span style="color:green">int 
 +<span style="color:blue">$pin_index<span style="color:black">, 
 +<span style="color:green">int 
 +<span style="color:blue">$pin_type 
 +<span style="color:black">[, 
 +<span style="color:green">int 
 +<span style="color:blue">$counter_type 
 +<span style="color:black">] ) 
 +</html></well>
  
-$pin_type - any of the following: +This function will change settings for certain pins on [[hardware:wattmons:WattmonPRO]] and [[hardware:wattmons:WattmonMEGA|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.
-| pin_type | description | +
-| 1 | OUTPUT (digital) | +
-| 2 | INPUT (digital) | +
-| 4 | ANALOG input | +
-| 16 | COUNTER (digital input) |+
  
-$cn_type For change notification (counter) you can choose from the following +====Parameters==== 
-|value|description+ 
-|0|Trigger on High| +<html><b><span style="color:blue">$pin_index<span style="color:black"></b></html>:  The internal pin number.  These are the configurable pins: 
-|1|Trigger on Low|+^<html><b><span style="color:blue">Pin Index</html>^External Label (Physical)^Default^Settable as^Description^ 
 +|0 |VIN/A1 (PIN 2)      |ANALOG|ANALOG/INPUT/OUTPUT|Voltage of primary input                                                      | 
 +|1 |A2 (PIN 3)          |ANALOG|ANALOG/INPUT/OUTPUT|Voltage of A2 input                                                           | 
 +|2 |A3 (PIN 4 )         |ANALOG|ANALOG/INPUT/OUTPUT|Voltage of A3 input                                                           | 
 +|3 |Internally available|ANALOG|ANALOG/INPUT/OUTPUT|No 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                                      | 
 +|10|DO1 (PIN 21)        |OUTPUT|INPUT/OUTPUT       |Digital output                                                                | 
 +|11|DO2 (PIN 22)        |OUTPUT|INPUT/OUTPUT       |Digital output                                                                | 
 +|12|DO3 (PIN 23)        |OUTPUT|INPUT/OUTPUT       |Digital output                                                                | 
 +|13|DO4 (PIN 24)        |OUTPUT|INPUT/OUTPUT       |Digital output                                                                | 
 +|14|RL1 (PIN 13)        |OUTPUT|INPUT/OUTPUT       |Latches the relay on (should never be kept on for long, just pulse to switch) | 
 +|15|RL2 (PIN 14)        |OUTPUT|INPUT/OUTPUT       |Latches the relay off (should never be kept on for long, just pulse to switch)| 
 + 
 +<html><b><span style="color:blue">$pin_type<span style="color:black"></b></html>:  Any of the following (if settable for that pin), allowed values: 
 + 
 +^<html><b><span style="color:blue">Pin Type</html>^Description^ 
 +||Digital Output| 
 +|2 |Digital Input| 
 +|4 |Analog Input| 
 +|16|Counter| 
 + 
 +<html><b><span style="color:blue">$counter_type<span style="color:black"></b></html>:  Optional if configuring a COUNTER (pin index 6-9), choose from the following: 
 + 
 +^<html><b><span style="color:blue">Counter Type</html>^Description^ 
 +|0|Trigger on High      
 +|1|Trigger on Low       |
 |2|Trigger on any change| |2|Trigger on any change|
  
-The wattmonpro has 16 configurable pins: +====Return Values==== 
-|Pin Index|Default|Pin (Physical)|Settable as|Description| + 
-|0|A1 (PIN 1)| ANALOG | ANALOG/INPUT/OUTPUT | Voltage of primary input| +None 
-|1|A2 (PIN 2)| ANALOG | ANALOG/INPUT/OUTPUT | Voltage of A2 input| + 
-|2|A3 (PIN 3 )| ANALOG | ANALOG/INPUT/OUTPUT | Voltage of A3 input| +====See Also==== 
-|3|internally available| ANALOG | ANALOG/INPUT/OUTPUT | No physical connection | + 
-|6|DI1 (PIN 16)| INPUT | INPUT/COUNTER|Digital input (opto-isolated) or counter | +[[pin_get()]] Return the value of an <tooltip title="Input/Output">I/O</tooltip> pin 
-|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 | +[[pin_set()]] - Set a digital output to value 1 or 0
-|9|DI4 (PIN 19)| INPUT | INPUT/COUNTER|Digital input (opto-isolated) or counter | +
-|10|DO1 (PIN 21)| OUTPUT | INPUT/OUTPUT|Digital output | +
-|11|DO2 (PIN 22)| OUTPUT | INPUT/OUTPUT|Digital output +
-|12|DO3 (PIN 23)| OUTPUT | INPUT/OUTPUT|Digital output | +
-|13|DO4 (PIN 24)| OUTPUT | INPUT/OUTPUT|Digital output | +
-|14|RL Latch On| OUTPUT | INPUT/OUTPUT|Latches the relay on (should never be kept on for long, just pulse to switch) | +
-|15|RL Latch Off| OUTPUT | INPUT/OUTPUT|Latches the relay off (should never be kept on for long, just pulse to switch) |+
  
 +[[adc_read()]] - Read an onboard <tooltip title="Analog to Digital Converter">ADC</tooltip> channel
  
uphp/functions/pin_configure.1494675123.txt.gz · Last modified: 2021/09/13 05:56 (external edit)