Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:software:devices:aninp [2016/09/30 15:31] – [7.4. Configurazione] qem103 | en:software:devices:aninp [2020/07/13 14:50] (current) – qem103 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== DEVICE ANINP ====== | ||
+ | |||
+ | |||
+ | ====== - Introduction ====== | ||
+ | |||
+ | * The device handles the reading and processing of an analog input. | ||
+ | * The read data is a word to 16-bit signed which you can add an offset, enter a scaling factor and activate a low-pass RC filter type software. | ||
+ | * Input resolution specifications are listed in the file adapter hardware.\\ Wiring and connections of the equipment described in this manual, must comply the European standard EN60204-1. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | ^: | ||
+ | |||
+ | ===== - Installation ===== | ||
+ | |||
+ | ==== - Device declaration in the configuration unit ==== | ||
+ | |||
+ | In the configuration unit, the BUS section must be declared must be declared so that they are | ||
+ | present the hardware resources required for the implementation of the ANINP device. Must be present | ||
+ | at least one analog input with a maximum resolution of 16 bits.\\ | ||
+ | In the INTDEVICE section of the configuration unit to add the following definition: | ||
+ | <code QCL> | ||
+ | ; | ||
+ | ; Devices declaration | ||
+ | ; | ||
+ | INTDEVICE | ||
+ | ... | ||
+ | <nome device> | ||
+ | </ | ||
+ | dove: | ||
+ | |<nome device> | ||
+ | |NINP|Keyword that identifies the device analog input| | ||
+ | |Tcamp|Time sampling device (1÷255 ms)| | ||
+ | |IChn|input address ADC| | ||
+ | |Type|ID number input type (refer to technical data sheet hardware)| | ||
+ | |||
+ | ^: | ||
+ | |||
+ | ==== - Example ==== | ||
+ | |||
+ | <code QCL> | ||
+ | ; | ||
+ | ; Device declaration | ||
+ | ; | ||
+ | INTDEVICE | ||
+ | AnSensor | ||
+ | </ | ||
+ | |||
+ | ===== - Operation ===== | ||
+ | |||
+ | When the system is powered, the device checks the correct input type declaration | ||
+ | use the configuration defined in the unit (Type). | ||
+ | If the channel diagnostics ends successfully, | ||
+ | on the basis of the time of sampling. NIf errors or inaccuracies are found, the | ||
+ | // | ||
+ | The conversion of the data output from the device (// | ||
+ | is activated by means of scale factors (// | ||
+ | formula: | ||
+ | |||
+ | //**outUm = (scaleA x outbit / scaleB) + scaleC**// | ||
+ | |||
+ | In addition to this updated release based on the sample time of the device, is available the | ||
+ | //outUmF// exit, filtered using a charging time //tfilter// programmable (expressed in ms). | ||
+ | |||
+ | ^: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ==== - Configuration ==== | ||
+ | |||
+ | A single input can be managed by multiple device ANINP simultaneously, | ||
+ | |||
+ | ===== - Commands and parameters ===== | ||
+ | |||
+ | ==== - Symbols used ==== | ||
+ | |||
+ | The parameter name, condition or command is taken back to the left side of the table. | ||
+ | |||
+ | **R**\\ | ||
+ | Indicates if its parameter or retentive state (upon initialization of the device | ||
+ | maintains state previously defined), or the State that bears upon | ||
+ | device initialization.\\ | ||
+ | If the device does not require initialization field ' R ' indicates the value that the parameter or State | ||
+ | accept to the card power ON.\\ | ||
+ | R = Retentive\\ | ||
+ | 0 = Upon initialization of the device the value is forced to zero.\\ | ||
+ | 1 = Upon initialization of the device the value is forced to one.\\ | ||
+ | - = Upon initialization of the device is presented significant value. | ||
+ | |||
+ | **D**\\ | ||
+ | Indicates the **parameter** size.\\ | ||
+ | F = Flag\\ | ||
+ | B = Byte\\ | ||
+ | W = Word\\ | ||
+ | L = Long\\ | ||
+ | S = Single Float | ||
+ | |||
+ | === - Conditions === | ||
+ | |||
+ | Describes all of the **conditions that is considered correct or because the command is accepted**.\\ | ||
+ | In some cases, limit values are specified for the acceptance of the parameter: If you | ||
+ | any values outside the limits set, the data will still be accepted; must | ||
+ | be provided appropriate controls of the application to ensure proper operation.\\ | ||
+ | To run a command, all the conditions must be | ||
+ | met; otherwise the command is not executed. | ||
+ | |||
+ | **A**\\ | ||
+ | Access mode.\\ | ||
+ | R = Read.\\ | ||
+ | W = Write.\\ | ||
+ | RW = Read / Write. | ||
+ | |||
+ | ===== - Parameters table ===== | ||
+ | |||
+ | ^NAME^D^R^A^Conditions^Description^ | ||
+ | |outbit|W|-|R|No|**Output measure in bits**\\ Value read by the input channel offset the Offset.\\ Valid range: 0 ÷ 32767| | ||
+ | |offset|W|R|RW|No|**Offset compensation**\\ Offset DAC output in bits. Defines the value in bits of the correction on the analog input in order to compensate for any drift in the system.\\ Valid range: -32768 ÷ 32767| | ||
+ | |scaleA|W|R|RW|No|**Scale A**\\ Integer A parameter to scaling formula.\\ Valid range: -32768 ÷ 32767| | ||
+ | |scaleB|W|R|RW|No|**Scale B**\\ B parameter value used in the formula of scaling. Must be nonzero.\\ Valid range: -32768 ÷ 32767| | ||
+ | |scaleC|W|R|RW|No|**Scale C**\\ C parameter value used in the formula of scaling.\\ Valid range: -32768 ÷ 32767| | ||
+ | |outUm|L|-|R|No|**Output measure in unity**\\ Exit derived from scaling formula.\\ Valid range: -32768 ÷ 32767| | ||
+ | |tfilter|W|R|RW|No|**Filter time**\\ Charging time of RC filter. If filter < = Tcamp device, the filter is disable. Value expressed in ms.\\ Valid range: 0 ÷ 32767| | ||
+ | |outUmF|L|-|R|No|**Filtered output in unity of measure**\\ Output filtered in units.\\ Valid range: -32768 ÷ 32767| | ||
+ | |||
+ | ===== - States table ===== | ||
+ | |||
+ | ^NAME^D^R^A^Conditions^Description | ||
+ | |st_errcfg|F|-|R|No|**Configuration error**\\ ignals that an error was detected in the input configuration.\\ **0** = There was no error.\\ **1** = An error was detected.| | ||
+ | |||
+ | ===== - Limitations ===== | ||
+ | |||
+ | ==== - Scaling ==== | ||
+ | |||
+ | //ScaleB// deve essere impostato diverso da zero, in caso contrario //OutUm// viene forzato a 0. | ||
+ | |||
+ | ==== - Filter ==== | ||
+ | |||
+ | The charging time of RC filter// | ||
+ | sampling (Tcamp) device, otherwise, it disables the filter and the //OutUmF// parameter is updated with the same value as //OutUm//. | ||
+ | |||
+ | ==== - Offset ==== | ||
+ | |||
+ | The //offset// parameter is added to the acquired analog input (// | ||
+ | |||
+ | ==== - Configuration ==== | ||
+ | |||
+ | ^:info:^In the case that a single channel is managed by multiple ANINP with different //Type// device, the compiler does not detect errors and the channel is set with the last //Type// declared.^ | ||
+ | |||
+ | A single hardware resource (each input) can be handled by multiple simultaneously ANINP devices, to the condition that the identification number of the entrance (Type), posted in device declaration (configuration file), is the same; otherwise the analog input is configured as the last device declared in the configuration file. | ||
+ | |||
+ | ===== - Application example ===== | ||
+ | |||
+ | ==== - Configuration Unit ==== | ||
+ | |||
+ | <code QCL> | ||
+ | ; | ||
+ | ; Module Name: Ex_Aninp.CNF | ||
+ | ; Autore: QEM srl Date : 01/05/99 | ||
+ | ; Sistem: QMove1 / QCL3 | ||
+ | ; Functionality: | ||
+ | ; | ||
+ | ; [1] - ANINP device application example | ||
+ | ; | ||
+ | ; | ||
+ | ; Constants Definition | ||
+ | ; | ||
+ | CONST | ||
+ | ; | ||
+ | ; SYSTEM Variables Definition | ||
+ | ; | ||
+ | SYSTEM | ||
+ | slSet1 | ||
+ | slSet2 | ||
+ | ; | ||
+ | ; GLOBAL Variables Definition | ||
+ | ; | ||
+ | GLOBAL | ||
+ | ; | ||
+ | ; TIMER Variables Definition | ||
+ | ; | ||
+ | TIMER | ||
+ | ; | ||
+ | ; DATAGROUP Definition | ||
+ | ; | ||
+ | DATAGROUP | ||
+ | |||
+ | ; | ||
+ | Bus Configuration | ||
+ | ; | ||
+ | BUS | ||
+ | 1 | ||
+ | 2 | ||
+ | 3 | ||
+ | 4 . | ||
+ | | ||
+ | ; | ||
+ | ; INPUT Variables Definition | ||
+ | ; | ||
+ | INPUT | ||
+ | |||
+ | ; | ||
+ | ; OUTPUT Variables Definition | ||
+ | ; | ||
+ | OUTPUT | ||
+ | ofGTSet1 | ||
+ | ofLTSet2 | ||
+ | |||
+ | ; | ||
+ | ; Internal Device Declaration | ||
+ | ; | ||
+ | INTDEVICE | ||
+ | ;Name | ||
+ | Asse ANINP 0004 2.AI01 2 | ||
+ | |||
+ | END | ||
+ | </ | ||
+ | |||
+ | ==== - ANINP Management ==== | ||
+ | |||
+ | <code QCL> | ||
+ | ; | ||
+ | ; File Name: TASK_00.MOD | ||
+ | ; Project: EX_ANINP | ||
+ | ; Description: | ||
+ | ; | ||
+ | |||
+ | ; | ||
+ | ; Initialization Work Axis | ||
+ | ; | ||
+ | Axis:offset = 0 ;Offset voltage | ||
+ | |||
+ | ; | ||
+ | ; Scale Factor: (scaleA * outbit / scaleB) + scaleC | ||
+ | ; outUm min. = (4 * 0 / 8 ) + 3 = 3 | ||
+ | ; outUm max. = (4 * 4095 / 8) + 3 = 2050 | ||
+ | ; | ||
+ | Axis:scaleA = 4 ;Scale A factor | ||
+ | Axis:scaleB = 8 ;Scale B factor | ||
+ | Axis:scaleC = 3 ;Scale C factor | ||
+ | Axis: | ||
+ | |||
+ | IF slSet1 EQ 0 | ||
+ | | ||
+ | ENDIF | ||
+ | IF slSet2 EQ 0 | ||
+ | | ||
+ | ENDIF | ||
+ | ; | ||
+ | ; Comparisons on analogue input | ||
+ | ; | ||
+ | ; Used Variables | ||
+ | ; slSet1 : Share of output comparison ofGTSet1 (setting with Qview) | ||
+ | ; slSet2 : Share of output comparison ofLTSet2 (setting with Qview) | ||
+ | ; | ||
+ | |||
+ | MAIN: | ||
+ | IF Asse:outUmF GT slSet1 | ||
+ | SETOUT ofGTSet1 | ||
+ | ELSE | ||
+ | RESOUT ofGTSet1 | ||
+ | ENDIF | ||
+ | | ||
+ | IF Asse:outUmF LT slSet2 | ||
+ | SETOUT ofLTSet2 | ||
+ | ELSE | ||
+ | RESOUT ofLTSet2 | ||
+ | ENDIF | ||
+ | |||
+ | WAIT 1 | ||
+ | JUMP MAIN | ||
+ | |||
+ | END | ||
+ | </ | ||
+ | |||