Both sides previous revision Previous revision Next revision | Previous revision |
en:software:devices:counter2 [2016/11/03 17:37] – [1. Introduzione] qem103 | en:software:devices:counter2 [2020/07/13 14:52] (current) – qem103 |
---|
====== DEVICE COUNTER2 ====== | ====== DEVICE COUNTER2 ====== |
| |
===== - Introduction ===== | ====== - Introduction ====== |
| |
* The internal device COUNTER2 is one tool that resides in the CPU that allows to manage the acquisition of count of a bidirectional incremental transducer. | * The internal device COUNTER2 is one tool that resides in the CPU that allows to manage the acquisition of count of a bidirectional incremental transducer. |
* Il valore acquisito viene convertito internamente in spazio e proposto nell'unità di misura scelta dall'utilizzatore. | * The value is converted internally into space and proposed in the unit of your choice to the user. |
* Sono incluse le funzioni di delta conteggio DELCNT per posizionamenti incrementali e cattura del conteggio su interrupt hardware.\\ I cablaggi e collegamenti dellapparecchiatura descritta nel presente manuale, devono rispettare la Normativa Europea EN60204-1. | * Includes the functions of delta DELCNT incremental placements count and capture of the count on hardware interrupts.\\ Wiring and connections of the equipment described in this manual, shall comply with the European standard EN 60204-1. |
| |
{{ :software:devices:counter2:counter2_01.png?nolink650 |}} | {{ :software:devices:counter2:counter2_01.png?nolink650 |}} |
| |
| |
===== - Installazione ===== | ===== - Installation ===== |
| |
==== - Dichiarazione device nel file di configurazione (.CNF) ==== | ==== - Device declaration in the configuration file (.CNF) ==== |
| |
Nel file di configurazione (.CNF), la sezione BUS deve essere dichiarata in modo tale che siano | In the configuration file (.CNF), the BUS section must be declared so that you have the hardware resources required for the implementation of the COUNTER2 device. There must be at least one bidirectional meter. The device can also use an interrupt line for the snap functions count on interrupt (such as uploading preset quota).\\ |
presenti le risorse hardware necessarie allimplementazione del device COUNTER2. Deve essere | In the INTDEVICE section of the .CNF file must be added the following definition: |
presente almeno un contatore bidirezionale. Il device può utilizzare anche una linea di interrupt | |
per le funzioni di cattura conteggio su interrupt ad esempio caricamento quota di preset).\\ | |
Nella sezione INTDEVICE del file .CNF deve essere aggiunta la seguente definizione: | |
<code QCL> | <code QCL> |
;--------------------------------- | ;--------------------------------- |
; Dichiarazione devices interni | ; Internal device declaration |
;--------------------------------- | ;--------------------------------- |
INTDEVICE | INTDEVICE |
.. | .. |
<nome_device> COUNTER2 TCamp QCTL IntL | <device_name> COUNTER2 TCamp QCTL IntL |
</code> | </code> |
<WRAP center round info 60%> | |
È necessario che tutte le | |
voci di definizione siano | |
presenti sulla stessa linea. | |
Nel caso in cui non si desideri | |
associare una risorsa, | |
ad esempio IntL, si deve comunque | |
inserire nel relativo | |
campo la stringa X. | |
</WRAP> | |
| |
dove: | ^:info:^It is necessary that each definition are present on the same line. In case you do not want to assign a resource such as IntL, you still must enter in the appropriate field the string X.^ |
|<nome device>|Nome assegnato al device.| | |
|COUNTER2|Parola chiave che identifica il device contatore bidirezionale.| | where: |
|TCamp|Tempo di campionamento device (1÷255 ms).| | |<device name>|Name assigned to the device.| |
|QCTL|Indirizzo contatore presente nella scheda.| | |COUNTER2|Keyword that identifies the device bi-directional meter.| |
|IntL|Numero della linea di interrupt hardware dedicata per limpulso di zero del trasduttore durante la fase di cattura del conteggio (per evitare che il device utilizzi questa risorsa inserire il carattere X).| | |TCamp|Sample time device (1÷255 ms).| |
| |QCTL|Address tab counter.| |
| |IntL|Hardware interrupt line number dedicated for transducer zero pulse during the capture phase of the count (to prevent the device uses this resource to put the X character).| |
| |
| === - Example === |
| |
=== - Esempio === | |
<code QCL> | <code QCL> |
;--------------------------------- | ;--------------------------------- |
; Dichiarazione devices interni | ; Internal device declaration |
;--------------------------------- | ;--------------------------------- |
INTDEVICE | INTDEVICE |
| |
| |
===== - Funzionamento ===== | ===== - Operation ===== |
| |
==== - Risoluzione trasduttore ==== | ==== - Transducer resolution ==== |
| |
Per lutilizzo del device è necessario definire la risoluzione del trasduttore.\\ | To use the device you must define the transducer resolution.\\ //cntratio// = (space covered in units of measure / pulses turn encoder) x 100000\\ This allows conversion constant to transduce the pulses read in space covered by the axis. The relationship space/pulse can assume values between 0,00374 eand 4,00000 but, having to be introduced in an integer parameter, must be multiplied by 100000.\\ Once set correctly the resolution it will be possible to read the instantaneous position of the axis (in unit of measure) on the //posit// parameter. |
//cntratio// = (spazio percorso in unità di misura / impulsi giro encoder) x 100000\\ | |
Questa costante di conversione permette di trasdurre gli impulsi letti in spazio percorso dallasse. | |
Il rapporto spazio/impulsi può assumere valori tra 0,00374 e 4,00000 ma, dovendo essere | |
introdotto nel parametro in valore intero, deve essere moltiplicato per 100000.\\ | |
Una volta impostata correttamente la risoluzione sarà possibile leggere la posizione istantanea | |
dellasse (in unità di misura) nel parametro //posit//. | |
| |
==== - Operazioni con il conteggio ==== | ==== - Operations with counting ==== |
| |
È possibile bloccare e sbloccare laggiornamento del conteggio con i comandi //CNTLOCK// e //CNTUNLOCK//.\\ | You can lock and unlock the updating with //CNTLOCK// and//CNTUNLOCK// commands.\\ You can reverse and restore the counter direction with //CNTREV// and //CNTDIR// commands. |
E possibile invertire e ripristinare la direzione del conteggio con //CNTREV// e //CNTDIR//. | |
| |
==== - Acquisizione veloce del conteggio su interrupt hardware ==== | ==== - Fast acquisition of counting on hardware interrupts ==== |
| |
I comandi //INTENBL// e //INTDSBL// abilitano e disabilitano la linea di interrupt collegata allimpulso | The //INTENBL// and //INTDSBL// commands enable and disable the interrupt line connected to the transducer's zero pulse. The value of the //capture// parameter defines on which this impulse will be frozen on instantaneous count; the count caught is placed in the //delta// parameter. |
di zero del trasduttore . Il valore del parametro //capture// definisce su quale fronte di tale impulso | |
verrà congelato il conteggio istantaneo; il conteggio catturato viene posto nel parametro //delta//. | |
| |
==== - Delta conteggio ==== | ==== - Delta count ==== |
| |
<WRAP center round info 60%> | ^:info:^The modify of the resolution value (//cntratio//) or the writing of the //posit// variable, causes the reset of the remnants of the conversion.^ |
La modifica del valore di risoluzione | |
(//cntratio//) o la | |
scrittura della variabile | |
//posit//, provoca | |
lazzeramento dei resti della | |
conversione. | |
</WRAP> | |
| |
Il device visualizza sempre la posizione assoluta dellasse; il cambio di conteggio può essere | The device always shows the absolute position of the axis; the counter change can be executed alsowith the direct writing in the new value on the //posit// paramenter.\\ |
eseguito anche con una scrittura diretta nel nuovo valore nel parametro //posit//.\\ | Wanting to steal 100 units of measure to the count you can:\\ |
Volendo sottrarre 100 unità di misura al conteggio è possibile:\\ | //Axis:posit = Axis:posit - 100//\\ |
//Asse:posit = Asse:posit - 100// | This introduces an error because it imposes the location "//posit// = -100", when the axis could have an intermediate position between a unit of measurement and subsequent (esxample 100.3). This fraction (0.3) is lost and the repetition of these steps will the accumulation of a considerable error.\\ |
Questa operazione introduce un errore perché impone la posizione //posit// = -100, quando lasse | The //DELCNT// command sum at the count an amount equal to the//delta// parameter without losing the fraction part of the position:\\ |
poteva avere una posizione intermedia tra una unità di misura e la successiva (es. 100.3). Questa | //Axis:delta = -100//\\ |
frazione (0.3) viene persa ed il ripetersi di queste operazioni provocano laccumularsi di un | //DELCNT Axis// |
errore non trascurabile.\\ | |
Il comando //DELCNT// somma al conteggio una quantità pari al parametro //delta// senza perdere la | |
parte frazionaria della posizione:\\ | |
//Asse:delta = -100// | |
//DELCNT Asse// | |
| |
=== - Esempio === | === - Example === |
La lettura della posizione dellasse risulta essere di 2 unità e si trova nel punto A. Si vuole | |
sommare al conteggio //posit// tre unità di misura.\\ | The reading of the axis is of 2 units and is located at point A. You want to add to the count //posit// three units of measure.\\ |
Con le istruzioni:\\ | With the instructions:\\ |
//Asse:posit = Asse:posit + 2//\\ | //Axis:posit = Axis:posit + 2//\\ |
lasse assume la nuova posizione B.\\ | the axis takes the new B position.\\ |
Con le istruzioni:\\ | With the instructions:\\ |
//Asse:delta = 2//\\ | //Axis:delta = 2//\\ |
//DELCNT Asse//\\ | //DELCNT Axis//\\ |
viene raggiunta la posizione C. | the axis takes the C position C. |
| |
{{:software:devices:counter2:counter2_02.png?nolink450|}} | {{:software:devices:counter2:counter2_02.png?nolink450|}} |
| |
Si noti che con le prime istruzioni lasse ha compiuto un delta inferiore a 3 unità e quindi è stato | Note that with the first instructions the axis took a delta less than 3 units and then introduced an error.\\ |
introdotto un errore.\\ | If you need to send //DELCNT// commands in succession, It is convenient to calculate the greatness to be summed and send once the command; otherwise Beware not to send subsequent commands without a read statement on device parameter. |
Se si devono inviare comandi //DELCNT// in successione, é conveniente calcolare la grandezza da | |
sommare ed inviare una sola volta il comando; in caso contrario prestare attenzione a non | |
inviare comandi successivi senza interporre una istruzione di lettura su parametro device. | |
| |
=== - Esempio === | === - Example === |
//Asse:delta = 3//\\ | |
//DELCNT Asse//\\ | |
//WAIT Asse:st_init//\\ | |
//Asse:delta = 40//\\ | |
//DELCNT Asse// | |
| |
| //Axis:delta = 3//\\ |
| //DELCNT Axis//\\ |
| //WAIT Axis:st_init//\\ |
| //Axis:delta = 40//\\ |
| //DELCNT Axis// |
| |
===== - Tabella comandi e parametri ===== | |
| |
==== - Simbologia adottata ==== | ===== - Commands and parameters table ===== |
| |
Il **nome** del parametro, stato o comando viene riportato alla sinistra della tabella. | ==== - Symbols used ==== |
| |
| The **name** of the parameter, state oo command comando is shown to the left side of the table. |
| |
**R**\\ | **R**\\ |
Indica se il relativo parametro o stato è ritentivo (al momento dellinizializzazione del device | Indicates whether its parameter or state is retentive (upon initialization of the device maintains the previously state defined), or the state assumes upon initialization of the device.\\ |
mantiene lo stato precedentemente definito), oppure lo stato che assume al momento | If the device does not need to initialize the field "R" indicates the value that the parameter or state presenting to power up of the card.\\ |
dellinizializzazione del device.\\ | R = Retentive\\ |
Se il device non necessita di inizializzazione il campo R indica il valore che il parametro o | 0 = Upon initialization of the device the value is forced to zero.\\ |
stato assume allaccensione della scheda.\\ | 1 = Upon initialization of the device the value is forced to one.\\ |
R = Ritentivo\\ | - = Upon initialization of the device is presented significant value. |
0 = Al momento dellinizializzazione del device il valore viene forzato a zero.\\ | |
1 = Al momento dellinizializzazione del device il valore viene forzato a uno.\\ | |
- = Al momento dellinizializzazione del device viene presentato il valore significativo. | |
| |
**D**\\ | **D**\\ |
Indica la dimensione del parametro.\\ | Indicates the size of the parameter.\\ |
F = Flag\\ | F = Flag\\ |
B = Byte\\ | B = Byte\\ |
S = Single Float\\ | S = Single Float\\ |
| |
=== - Condizioni === | === - Conditions === |
Vengono descritte tutte le **condizioni necessarie affinché il parametro sia considerato corretto o perché il comando venga accettato**.\\ | |
In alcuni casi vengono specificati dei valori limite per laccettazione del parametro: se vengono | Describes all of the **conditions that is considered correct or because the command is accepted**.\\ |
introdotti dei valori esterni ai limiti impostati, il dato viene comunque accettato; pertanto | In some cases, limit values are specified for the acceptance of the parameter: if introduce any values outside the limits set, the data is still accepted; therefore appropriate controls of the application must be provided to ensure the proper functioning.\\ |
devono essere previsti opportuni controlli dellapplicativo tali da garantire il corretto funzionamento.\\ | To run a command, all conditions must be met; otherwise, the command is not sent. |
Per lesecuzione di un comando, tutte le relative condizioni devono necessariamente essere | |
soddisfatte; in caso contrario il comando non viene inviato. | |
| |
**A**\\ | **A**\\ |
Indica la **modalità di accesso**.\\ | Indicates the **access mode**.\\ |
R = Read (lettura).\\ | R = Read.\\ |
W = Write (scrittura).\\ | W = Write.\\ |
RW = Read / Write. | RW = Read / Write. |
| |
==== - Comandi ==== | ==== - Commands ==== |
| |
I comandi sono stati ordinati con priorità decrescente. Ad esempio, in caso di contemporaneità dei comandi //CNTLOCK// ed //CNTUNLOCK//, viene acquisito per primo il comando //CNTLOCK//. | The commands were ranked by decreasing priority. For example, in the case of contemporary of //CNTLOCK// and//CNTUNLOCK// commands, is acquired first the //CNTLOCK// command. |
| |
^Nome^Condizioni^Descrizione^ | ^Name^Conditions^Description^ |
|CNTLOCK|st_init = 1|**Counter lock**\\ Blocca l'acquisizione del conteggio asse anche se il trasduttore continua ad inviare i segnali. In questa fase l'eventuale spostamento dell'asse non viene rilevato.\\ Attiva lo stato //st_cntlock//.| | |CNTLOCK|st_init = 1|**Counter lock**\\ Blocks the acquisition of axis count even if the transducer continues to send signals. At this stage the possible displacement of the axis is not detected.\\ Activates the //st_cntlock// state.| |
|CNTUNLOCK|st_init = 1|**Counter unlock**\\ Sblocca il conteggio dell'asse. Viene riabilitato l'aggiornamento del conteggio.\\ Disattiva lo stato //st_cntlock//.| | |CNTUNLOCK|st_init = 1|**Counter unlock**\\ Unlock the axis count. Is rehabilitated the updating of the count.\\ Disable the //st_cntlock// state.| |
|CNTREV|st_init = 1|**Counter reverse**\\ Consente di invertire le fasi del trasduttore all'interno della scheda. Viene quindi invertito il senso del conteggio (incremento/decremento).\\ Attiva lo stato //st_cntrev//.| | |CNTREV|st_init = 1|**Counter reverse**\\ Invert the phases of the transducer inside the card. Is then reversed the direction of the count (increase/decrease).\\ Activates the //st_cntrev// state.| |
|CNTDIR|st_init = 1|**Counter direct**\\ Il conteggio dell'asse non viene invertito Disattiva lo stato //st_cntrev//.| | |CNTDIR|st_init = 1|**Counter direct**\\ The axis counting is not reversed. Disable the //st_cntrev// state.| |
|INTENBL|st_init = 1\\ capture>0\\ 1£ IntL £ 8|**Interrupt enable**\\ Abilita cattura del conteggio che verrà memorizzato in delta.\\ Attiva lo stato //st_intenbl//.| | |INTENBL|st_init = 1\\ capture>0\\ 1£ IntL £ 8|**Interrupt enable**\\ Enable capture of the count that will be stored in delta.\\ Activates the //st_intenbl// state.| |
|INTDSBL|st_init = 1|**Interrupt disable**\\ Disabilita la cattura del conteggio.\\ Disattiva lo stato //st_intenbl//.| | |INTDSBL|st_init = 1|**Interrupt disable**\\ Disable the count capture.\\ Disable the //st_intenbl// state.| |
|RSCAPTURE|st_init = 1|**Reset capture**\\ Disattiva lo stato di //st_capture//| | |RSCAPTURE|st_init = 1|**Reset capture**\\ Disable the //st_capture// state.| |
|DELCNT|st_init = 1\\ st_intenbl = 0|**Delta counter**\\ Il conteggio (posizione dell'asse) viene modificato sommandogli algebricamente il valore specificato nel parametro delta (//posit = posit + delta//).| | |DELCNT|st_init = 1\\ st_intenbl = 0|**Delta counter**\\ The count (axis position) is changed by adding algebraically the value specified in the delta parameter (//posit = posit + delta//).| |
| |
==== - Parametri ==== | ==== - Parameters ==== |
| |
^Nome^D^R^A^Condizioni^Descrizione^ | ^Name^D^R^A^Conditions^Description^ |
|cntratio|L|R|R-W|Nessuna|**Counter ratio**\\ Definisce per quanto vanno moltiplicati gli impulsi del trasduttore in modo che l'acquisizione degli spostamenti venga espressa nell'unità di misura desiderata. Impostando 100000 la variazione del conteggio è di 1 bit per impulso trasduttore.\\ Range valido: 374 ÷ 400000| | |cntratio|L|R|R-W|No|**Counter ratio**\\ Defines how the transducer pulses must be multiplied so that the acquisition of movements is expressed in the unit of measure desired. By setting 100000 the count variation is 1 bit per pulse transducer.\\ Valid range: 374 ÷ 400000| |
|posit|L|R|R-W|Nessuna|**Actual position**\\ È il valore della posizione istantanea dell'asse.\\ Valore espresso in unità di misura (Um).\\ Range valido: -999999 ÷ 999999| | |posit|L|R|R-W|No|**Actual position**\\ Is the value of the instantaneous position of the axis.\\ Value expressed in units of measurement (Um).\\ Valid range: -999999 ÷ 999999| |
|delta|L|R|R-W|Nessuna|**Delta counter**\\ È il valore che viene sommato al conteggio quando viene inviato un comando DELCNT.\\ Valore espresso in unità di misura(Um).\\ Range valido: -999999 ÷ 999999.| | |delta|L|R|R-W|No|**Delta counter**\\ Is the value that is added to the count when sending a DELCNT command.\\ Value expressed in units of measurement (Um).\\ Valid range: -999999 ÷ 999999.| |
|capture|B|R|R-W|Nessuna|**Capture mode**\\ Definisce il modo di cattura del conteggio su interrupt hardware.\\ **0** = Disabilitato.\\ **1** = Singola cattura sul fronte di discesa.\\ **2** = Singola cattura sul fronte di salita.\\ **N.B.** La cattura del conteggio è abilitata se lo stato st_intenbl = 1.| | |capture|B|R|R-W|No|**Capture mode**\\ Defines how to count is captured on hardware interrupts.\\ **0** = Disable.\\ **1** = Single capture on falling edge.\\ **2** = Single capture on the rising edge.\\ **N.B.** The capture of the counting is enabled if the state st_intenbl = 1.| |
| |
==== - Stati ==== | ==== - Status ==== |
| |
^Nome^D^R^A^Condizioni^Descrizione^ | ^Name^D^R^A^Conditions^Description^ |
|st_cntlock|F|R|R|Nessuna|**Counter locked**\\ Segnalazione di conteggio asse bloccato.\\ **0** = Conteggio asse sbloccato.\\ **1** = Conteggio asse bloccato.| | |st_cntlock|F|R|R|No|**Counter locked**\\ Counting signaling axis is blocked.\\ **0** = Axis count unlocked.\\ **1** = Axis count blocked.| |
|st_cntrev|F|R|R|Nessuna|**Counter reversed**\\ Segnalazione di conteggio asse invertito.\\ **0** = Conteggio asse non invertito.\\ **1** = Conteggio asse invertito.| | |st_cntrev|F|R|R|No|**Counter reversed**\\ Inverted axis count report.\\ **0** = Axis count not inverted.\\ **1** = Inverted axis count.| |
|st_intenbl|F|0|R|Nessuna|**Interrupt enabled**\\ Segnala l'abilitazione alla cattura del conteggio da linea di interrupt hardware. Viene attivato dal comando INTENBL e disattivato dal comando INTDSBL. viene disattivato automaticamente a cattura avvenuta.\\ **0** = Cattura del conteggio non è abilitata.\\ **1** = Cattura del conteggio abilitata.| | |st_intenbl|F|0|R|No|**Interrupt enabled**\\ Reports enabling the capture of the count from hardware interrupt line. Is activated by the INTENBL command and disabled from INTDSBL command. Is automatically disabled to capture occurred.\\ **0** = Capture of the count is not enabled.\\ **1** = Capture of count enabled.| |
|st_capture|F|0|R|Nessuna|**Counter capture**\\ Viene attivato alla cattura del conteggio; viene resettato dal comando //RSCAPTURE//.\\ **0** = Cattura del conteggio non eseguita.\\ **1** = Eseguita cattura conteggio.| | |st_capture|F|0|R|No|**Counter capture**\\ Is activated at the capture of the count; is reset from the //RSCAPTURE// command.\\ **0** = The capture of the count does not executed.\\ **1** = The capture of the count executed.| |
| |
| |
===== - Limitazioni ===== | ===== - Limitations ===== |
| |
Se viene modificato il parametro //cntratio// successivamente allinvio del comando //DELCNT//, vengono azzerati i resti della conversione del delta spazio in impulsi. | If you change the //cntratio// parameter After sending the //DELCNT// command, are cleared the remnants of the conversion of the "delta space" in pulses. |
| |
| |
===== - Esempio applicativo ===== | ===== - Application example ===== |
| |
==== - File di configurazione ==== | ==== - Configuration file ==== |
| |
<code QCL> | <code QCL> |
;************************************************************************************* | ;************************************************************************************* |
; Nome Modulo: Ex_Count.CNF Progetto: Ex_COUNT | ; Module Name: Ex_Count.CNF Project: Ex_COUNT |
; Autore: QEM srl Data : 01/05/99 | ; Author: QEM srl Date : 01/05/99 |
; Sistema: QMove1 / QCL3 Libreria: 1LIB3B04 | ; System: QMove1 / QCL3 Library: 1LIB3B04 |
; Funzionalità: Esempio gestione CPUNTER Release: 0 | ; Functionality: CPUNTER managing example Release: 0 |
;------------------------------------- Note ------------------------------------------ | ;------------------------------------- Note ------------------------------------------ |
; [1] - Applicativo di esempio per utilizzo device COUNTER 2 | ; [1] - Sample application to use the COUNTER 2 device |
;************************************************************************************* | ;************************************************************************************* |
| |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
; Definizione Costanti | ; Defining Constants |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
CONST | CONST |
| |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
; Definizione Variabili SYSTEM | ; SYSTEM Variables Definition |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
SYSTEM | SYSTEM |
slPrsPos L ;Quota di preset | slPrsPos L ;Preset quota |
slSet1 L ;Setpoint 1 | slSet1 L ;Setpoint 1 |
slSet2 L ;Setpoint 2 | slSet2 L ;Setpoint 2 |
| |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
; Definizione Variabili GLOBAL | ; GLOBAL Variables Definition |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
GLOBAL | GLOBAL |
| |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
; Definizione Variabili TIMER | ; TIMER Variables Definition |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
TIMER | TIMER |
| |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
; Definizione DATAGROUP | ; DATAGROUP Definition |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
;DATAGROUP | ;DATAGROUP |
| |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
; Configurazione Bus | ; Bus Configuration |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
BUS | BUS |
| |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
; Definizione Variabili INPUT | ; INPUT Variables Definition |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
INPUT | INPUT |
ifAbilZ F 2.INP01 ;Abilitazione cattura impulso di zero | ifAbilZ F 2.INP01 ;Enabling capture zero pulse |
ifAxeFermo F 2.INP02 ;Segnalazione asse fermo | ifAxeFermo F 2.INP02 ;Signaling axis stopped |
| |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
; Definizione Variabili OUTPUT | ; OUTPUT Variables Definition |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
OUTPUT | OUTPUT |
ofGTSet1 F 2.OUT01 ;Segnalazione superamento setpoint 1 -> | ofGTSet1 F 2.OUT01 ;Reporting setpoint 1 is exceeded -> |
ofLTSet2 F 2.OUT02 ;Segnalazione superamento setpoint 2 <- | ofLTSet2 F 2.OUT02 ;Reporting setpoint 2 is exceeded <- |
| |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
; Dichiarazione device interni | ; Internal Device Declaration |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
INTDEVICE | INTDEVICE |
;Nome Tipo TCamp Contatore Inter | ;Name Typo TCamp Counter Inter |
Asse COUNTER2 2 2.CNT01 1 | Axis COUNTER2 2 2.CNT01 1 |
| |
END | END |
</code> | </code> |
| |
==== - Gestione COUNTER2 ==== | ==== - COUNTER2 management ==== |
| |
<code QCL> | <code QCL> |
;************************************************************************************* | ;************************************************************************************* |
; Nome File: TASK_00.MOD | ; File Name : TASK_00.MOD |
; Progetto : EX_COUNT | ; Project : EX_COUNT |
; Descrizione:Gestione Posizionamento | ; Description: Positioning Control |
;************************************************************************************* | ;************************************************************************************* |
| |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
; Operazioni di Inizializzazione Asse | ; Initialization work Axis |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
Asse:cntratio = 100000 ;Risoluz.encoder = Spazio in 1 giro | Axis:cntratio = 100000 ;Encoder resolution = Space in 1 round |
;encoder(Um) / impulsi giro encoder | ;encoder(Um) / encoder pulse round |
Asse:capture = 1 | Axis:capture = 1 |
IF slSet1 EQ 0 | IF slSet1 EQ 0 |
slSet1 = 500 | slSet1 = 500 |
| |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
; Ricerca di preset abilitata ad ogni passaggio sul finecorsa | ; Preset search enabled at each step the limit switch |
; ---------------------------- variabili utilizzate --------------------------------- | ; ------------------------------- variables used ------------------------------------- |
; slPrsPos : Quota di preset impostata | ; slPrsPos : Preset quota set |
;-------------------------------------------------------------------------------------- | ;-------------------------------------------------------------------------------------- |
MAIN: | MAIN: |
IF ifAbilZ ;Attende l'ingresso di abilitazione | IF ifAbilZ ;Waits for the enable input |
;impulso di zero trasduttore | ;zero pulse transducer |
INTENBL Asse ;Abilita la cattura dell'impulso di zero | INTENBL Axis ;Enables the capture of zero-pulse |
;trasduttore | ;transducer |
ELSE | ELSE |
INTDSBL Asse ;Disabilita la cattura dell'impulso di | INTDSBL Axis ;Disable the zero pulse |
;zero trasduttore | ;transducer capture |
ENDIF | ENDIF |
| |
IF Asse:st_capture ;Se è stato catturato il conteggio | IF Axis:st_capture ;If the count is captured |
IF ifAxeFermo ;Se l'asse è fermo | IF ifAxeFermo ;If the axis is stopped |
Asse:delta = -(Asse:delta-slPrsPos) ;Calcolo quota da sommare al conteggio | Axis:delta = -(Axis:delta-slPrsPos) ;Dimension calculation from sum to count |
DELCNT Asse ;Imposto il nuovo valore del conteggio | DELCNT Axis ;Imposed on the new value of the reference count |
RSCAPTURE Asse ;Resetto st_capture dell'Asse | RSCAPTURE Axis ;Reset the axis's st_capture |
ENDIF | ENDIF |
ENDIF | ENDIF |
| |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
; Comparazioni sul conteggio | ; Comparisons on counting |
; ----------------------------- variabili utilizzate -------------------------------- | ; ----------------------------- variables used -------------------------------- |
; slSet1: Quota di comparazione per uscita ofGTSet1 | ; slSet1: Comparison quota for ofGTSet1 output |
; slSet1: Quota di comparazione per uscita ofLTSet2 | ; slSet1: Comparison quota for ofLTSet2 output |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
IF Asse:posit GT slSet1 ;Se il conteggio è > del setpoint 1 | IF Axis:posit GT slSet1 ;If the count is > of setpoint 1 |
SETOUT ofGTSet1 ;Attiva l'uscita ofGTSet1 | SETOUT ofGTSet1 ;Activates the ofGTSet1 output |
ELSE | ELSE |
RESOUT ofGTSet1 ;Disattiva l'uscita ofGTSet1 | RESOUT ofGTSet1 ;Disable the ofGTSet1 output |
ENDIF | ENDIF |
IF Asse:posit LT slSet2 ;Se il conteggio è < del setpoint 2 | IF Axis:posit LT slSet2 ;If the count is < of setpoint 2 |
SETOUT ofLTSet2 ;Attiva l'uscita ofLTSet2 | SETOUT ofLTSet2 ;Activates the ofLTSet2 output |
ELSE | ELSE |
RESOUT ofLTSet2 ;Disattiva l'uscita ofLTSet2 | RESOUT ofLTSet2 ;Disable the ofLTSet2 output |
ENDIF | ENDIF |
| |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
; Operazioni finali | ; Final operations |
;------------------------------------------------------------------------------------- | ;------------------------------------------------------------------------------------- |
WAIT 1 | WAIT 1 |