Wiki source code of Входы и выходы
Last modified by writer on 2023/09/08 18:35
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | ===== bool PinGetState(number periphId) ===== | ||
| 2 | |||
| 3 | Getting the current state of an input or output. | ||
| 4 | |||
| 5 | Options: | ||
| 6 | |||
| 7 | * number periphId – input or output identifier (one of the constants defined in the **[[Inputs>>path:#id-Входыивыходы-Inputs(идентификаторывходов)||shape="rect"]]** or **[[Outputs>>path:#id-Входыивыходы-Outputs(идентификаторывыходов)||shape="rect"]] **list should be passed as this parameter). | ||
| 8 | |||
| 9 | Return value: | ||
| 10 | |||
| 11 | * the current state of the input (output): true - active, false - inactive (if the "Invert" checkbox is selected in the output settings, the physical output corresponds to the physical signal level 0, and vice versa). | ||
| 12 | |||
| 13 | ===== bool MotorPinGetState(number motorId, number motorPeriphId) ===== | ||
| 14 | |||
| 15 | Getting the current state of the input or output assigned to the motor. | ||
| 16 | |||
| 17 | Options: | ||
| 18 | |||
| 19 | * number motorId – motor number, starting from 0, in the order of the motors in the list of //[["Motor Parameters">>doc:Руководство пользователя.Настройка ПО.Настройка двигателей.WebHome]]//; | ||
| 20 | * number motorPeriphId – input or output identifier for the specified motor (one of the constants defined in the **[[MotorInputs>>path:#id-Входыивыходы-MotorInputs(идентификаторывходовдвигателей)||shape="rect"]]** or **[[MotorOutputs>>path:#id-Входыивыходы-MotorOutputs(идентификаторывыходовдвигателей)||shape="rect"]] **list should be passed as this parameter). | ||
| 21 | |||
| 22 | Return value: | ||
| 23 | |||
| 24 | * current state of the motor input (output): true – active, false – inactive (if the “Invert” checkbox is selected in the output settings, the physical output corresponds to the physical signal level 0, and vice versa). | ||
| 25 | |||
| 26 | ===== void PinSetState(number periphId, bool state) ===== | ||
| 27 | |||
| 28 | Set output status. | ||
| 29 | |||
| 30 | Options: | ||
| 31 | |||
| 32 | * number periphId – output identifier (one of the constants defined in the **[[Outputs>>path:#id-Входыивыходы-Outputs(идентификаторывыходов)||shape="rect"]] **list should be passed as this parameter); | ||
| 33 | * bool state –the state of the output that needs to be set: true – active, false – inactive (if the "Invert" checkbox is selected in the output settings, the physical output corresponds to a physical signal level of 0, and vice versa). | ||
| 34 | |||
| 35 | ===== void PushPinState(number periphId) ===== | ||
| 36 | |||
| 37 | Saves the state of the current output. The output state will automatically be restored when exiting a macro for any reason. | ||
| 38 | |||
| 39 | Options: | ||
| 40 | |||
| 41 | * number periphId – output id (must be passed one of the constants defined in the **[[Outputs>>path:#id-Входыивыходы-Outputs(идентификаторывыходов)||shape="rect"]]** list). | ||
| 42 | |||
| 43 | ===== void PushSpecificPinState(number periphId, bool state) ===== | ||
| 44 | |||
| 45 | Saves the current state of the current output. The output state will be automatically restored to the saved value when exiting a macro for any reason. | ||
| 46 | |||
| 47 | Options: | ||
| 48 | |||
| 49 | * number periphId – output id (must be passed one of the constants defined in the **[[Outputs>>path:#id-Входыивыходы-Outputs(идентификаторывыходов)||shape="rect"]]** list). | ||
| 50 | * bool state – output state that will be restored when exiting the macro. | ||
| 51 | |||
| 52 | ===== bool IsProbingPinConfigured() ===== | ||
| 53 | |||
| 54 | Allows you to check whether the input for probing is assigned in the input signal parameters. | ||
| 55 | |||
| 56 | Return value: | ||
| 57 | |||
| 58 | * true – if the input for probing is assigned; | ||
| 59 | * false – if the input is not assigned. | ||
| 60 | |||
| 61 | ===== bool IsSpecificProbingPinConfigured(number index) ===== | ||
| 62 | |||
| 63 | Allows you to check if a specific probe is assigned in the parameters of the input signals. | ||
| 64 | |||
| 65 | Options: | ||
| 66 | |||
| 67 | * number index – probing input number (from 1 to 3). | ||
| 68 | |||
| 69 | Return valut: | ||
| 70 | |||
| 71 | * true – if the specified probing input is assigned; | ||
| 72 | * false – if the specified probing input is not assigned. | ||
| 73 | |||
| 74 | ===== Inputs ===== | ||
| 75 | |||
| 76 | The binding of a specific device input to the input identifier is carried out in the settings in the //[["Input Signals Parameters">>doc:Руководство пользователя.Настройка ПО.Настройка сигналов.WebHome]]//. | ||
| 77 | |||
| 78 | * Estop; | ||
| 79 | * Probing; | ||
| 80 | * Collision; | ||
| 81 | * OxyExternalZLimitHigh; | ||
| 82 | * UserInput_0; | ||
| 83 | * UserInput_1; | ||
| 84 | * UserInput_2; | ||
| 85 | * UserInput_3; | ||
| 86 | * UserInput_4; | ||
| 87 | * UserInput_5; | ||
| 88 | * UserInput_6; | ||
| 89 | * UserInput_7; | ||
| 90 | * UserInput_8; | ||
| 91 | * UserInput_9; | ||
| 92 | * UserInput_10; | ||
| 93 | * UserInput_11; | ||
| 94 | * UserInput_12; | ||
| 95 | * ((( | ||
| 96 | (% class="auto-cursor-target" %) | ||
| 97 | UserInput_13; | ||
| 98 | ))) | ||
| 99 | * UserInput_14. | ||
| 100 | |||
| 101 | ===== Outputs ===== | ||
| 102 | |||
| 103 | The binding of a specific output of the device to the output identifier is carried out in the settings in the //[["Output Signal Parameters">>doc:Руководство пользователя.Настройка ПО.Настройка сигналов.WebHome]]//. | ||
| 104 | |||
| 105 | * Mist; | ||
| 106 | * Flood; | ||
| 107 | * OxyRegUp; | ||
| 108 | * OxyRegDown; | ||
| 109 | * OxyActive; | ||
| 110 | * UserOutput_0; | ||
| 111 | * UserOutput_1; | ||
| 112 | * UserOutput_2; | ||
| 113 | * UserOutput_3; | ||
| 114 | * UserOutput_4; | ||
| 115 | * UserOutput_5; | ||
| 116 | * UserOutput_6; | ||
| 117 | * UserOutput_7; | ||
| 118 | * UserOutput_8; | ||
| 119 | * UserOutput_9; | ||
| 120 | * UserOutput_10; | ||
| 121 | * UserOutput_11; | ||
| 122 | * UserOutput_12; | ||
| 123 | * UserOutput_13; | ||
| 124 | * UserOutput_14. | ||
| 125 | |||
| 126 | ===== MotorInputs (motor input identifiers) ===== | ||
| 127 | |||
| 128 | * Home; | ||
| 129 | * LimitLow; | ||
| 130 | * LimitHigh. | ||
| 131 | |||
| 132 | ===== MotorOutputs (motor output identifiers) ===== | ||
| 133 | |||
| 134 | * Step; | ||
| 135 | * Dir; | ||
| 136 | * Enable. | ||
| 137 | |||
| 138 | {{code language="lua" title="**Usage example**"}} | ||
| 139 | if (PinGetState(Inputs.UserInput_0)) then | ||
| 140 | PinSetState(Outputs.UserOutput_5, true) | ||
| 141 | Sleep(1000) | ||
| 142 | PinSetState(Outputs.UserOutput_5, false) | ||
| 143 | end4. | ||
| 144 | {{/code}} |