summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancis Tisserant <tissf@free.fr>2014-04-08 09:58:04 +0200
committerFrancis Tisserant <tissf@free.fr>2014-04-08 09:58:41 +0200
commita31737363ce6f493740b1fb6e40eef403104aae8 (patch)
tree4d87f845ec7c984eed6d61a274277cfb12c6775c
parent30ba6cfa29d6f6fcf96857353248800e40016682 (diff)
downloadlinuxcnc-a31737363ce6f493740b1fb6e40eef403104aae8.tar.gz
linuxcnc-a31737363ce6f493740b1fb6e40eef403104aae8.zip
French doc: cleaning and add M19
Signed-off-by: Francis Tisserant <tissf@free.fr>
-rw-r--r--docs/html/gcode_fr.html6
-rw-r--r--docs/src/common/starting-emc.txt2
-rw-r--r--docs/src/config/ini_config.txt13
-rw-r--r--docs/src/config/ini_config_es.txt2
-rw-r--r--docs/src/gcode/m-code_fr.txt314
-rw-r--r--docs/src/gcode/overview.txt9
-rw-r--r--docs/src/gcode/overview_fr.txt135
-rw-r--r--docs/src/hal/canonical-devices_es.txt5
-rw-r--r--docs/src/hal/parallel_port.txt3
-rw-r--r--docs/src/hal/rtcomps.txt7
-rw-r--r--docs/src/hal/rtcomps_es.txt322
11 files changed, 662 insertions, 156 deletions
diff --git a/docs/html/gcode_fr.html b/docs/html/gcode_fr.html
index 70b93e40f..1489243db 100644
--- a/docs/html/gcode_fr.html
+++ b/docs/html/gcode_fr.html
@@ -72,7 +72,7 @@ tr.head td, tr.head th { background: navy; color: white; }
<TR> <TH COLSPAN=3>Contr&ocirc;le de broche </TR>
<TR> <TD> <A HREF="gcode/m-code_fr.html#sec:M3-M4-M5">M3, M4</A> <TD> S <TD> Marche broche sens horaire, sens anti-horaire </TR>
<TR> <TD> <A HREF="gcode/m-code_fr.html#sec:M3-M4-M5">M5</A> <TD> <TD> Arr&ecirc;t de la broche </TR>
-<TR> <TD> <A HREF="gcode/m-code_fr.html#sec:M19">M19</A> <TD> <TD> Aligner la broche </TR>
+<TR> <TD> <A HREF="gcode/m-code_fr.html#sec:M19">M19</A> <TD> <TD> Orientation de la broche </TR>
<TR> <TD> <A HREF="gcode/gcode_fr.html#sec:G96-G97-Broche">G96</A> <TD> D S <TD> Vitesse de coupe constante (pieds par minute ou m&egrave;tres par minute) </TR>
<TR> <TD> <A HREF="gcode/gcode_fr.html#sec:G96-G97-Broche">G97</A> <TD> <TD> Vitesse en tours par minute </TR>
<TR> <TH COLSPAN=3>Arrosages </TR>
@@ -124,6 +124,10 @@ tr.head td, tr.head th { background: navy; color: white; }
<TR> <TD> <A HREF="gcode/o-code_fr.html#sec:Boucles">O- while</A> <TD> <TD>Boucles, while/endwhile do/while</TR>
<TR> <TD> <A HREF="gcode/o-code_fr.html#sec:Conditionnels">O- if</A> <TD> <TD>Conditionnels, if/else/endif</TR>
<TR> <TD> <A HREF="gcode/o-code_fr.html#sec:Repetitions">O- repeat</A> <TD> <TD>R&eacute;p&egrave;te n fois l'ex&eacute;cution de blocs de code</TR>
+<TR> <TD> <A HREF="gcode/m-code_fr.html#_m70_save_modal_state_a_id_sec_m70_save_modal_state_a">M70</A> <TD> <TD>Enregistre l'&eacute;tat modal</TR>
+<TR> <TD> <A HREF="gcode/m-code_fr.html#_m71_invalidate_stored_modal_state_a_id_sec_m71_invalidate_stored_modal_state_a">M71</A> <TD> <TD>Invalide l'&ecute;tat modal enregistr&egrave;</TR>
+<TR> <TD> <A HREF="gcode/m-code_fr.html#_m72_restore_modal_state_a_id_sec_m72_restore_modal_state_a">M72</A> <TD> <TD>Restaure l'&ecute;tat modal enregistr&egrave;</TR>
+<TR> <TD> <A HREF="gcode/m-code_fr.html#_m73_save_and_autorestore_modal_state_a_id_sec_m73_save_autorestore_modal_state_a">M73</A> <TD> <TD>Enregistre et auto-restaure l'&ecute;tat modal</TR>
<TR> <TH COLSPAN=3>Codes d'entr&eacute;e/sortie </TR>
<TR> <TD> <A HREF="gcode/m-code_fr.html#sec:M62-a-M65-Ctrl-Sortie-Numerique">M62&hellip;M65</A> <TD> P <TD> Contr&ocirc;le de sortie num&eacute;rique </TR>
<TR> <TD> <A HREF="gcode/m-code_fr.html#sec:M66-Ctrl-Entree-Numerique-Et-Analogique">M66</A> <TD> P E L Q <TD> Contr&ocirc;le d'entr&eacute;e num&eacute;rique et analogique </TR>
diff --git a/docs/src/common/starting-emc.txt b/docs/src/common/starting-emc.txt
index 23cbaa386..87ac541f4 100644
--- a/docs/src/common/starting-emc.txt
+++ b/docs/src/common/starting-emc.txt
@@ -19,7 +19,7 @@ LinuxCNC. The ini file [HAL] section specifies the order of loading up HAL
files if more than one is used. Once the HAL=xxx.hal files are loaded then the
GUI is loaded then the POSTGUI=.xxx.hal file is loaded. If you create PyVCP or
GladeVCP objects with HAL pins you must use the postgui HAL file to make any
-connections to those pins. See the <<sub:HAL-section,HAL>> section of the
+connections to those pins. See the <<sub:HAL-section,[HAL]>> section of the
INI configuration for more information.
[float]
diff --git a/docs/src/config/ini_config.txt b/docs/src/config/ini_config.txt
index 376a56c0d..7960f9f0c 100644
--- a/docs/src/config/ini_config.txt
+++ b/docs/src/config/ini_config.txt
@@ -482,8 +482,8 @@ Section.
executing a pause instruction, and when accepting a command from a user
interface. There is usually no need to change this number.
-[[sub:HAL-section]]
-=== [HAL] section(((HAL (inifile section))))
+=== [HAL] section[[sub:HAL-section]]
+(((HAL (inifile section))))
* 'TWOPASS=ON' - Use two pass processing for loading HAL comps. With TWOPASS processing,
all [HAL]HALFILES are first read and multiple appearances of loadrt
@@ -600,8 +600,8 @@ planning module in 'motion'.
Using this will allow the machine to go beyond the soft limits
while in operation. It is not generally desirable to allow this.
-[[sub:AXIS-section]]
-=== [AXIS_<num>] Section(((AXIS (inifile section))))
+=== [AXIS_<num>] Section[[sub:AXIS-section]]
+(((AXIS (inifile section))))
The [AXIS_0], [AXIS_1], etc. sections contains general parameters for
the individual components in the axis control module. The axis section
@@ -1042,8 +1042,9 @@ image::images/encoder-scale.png[align="center"]
than the axis MAX_VELOCITY. Subsequent testing has shown that use of
STEPGEN_MAXVEL does not improve the tuning of stepgen's position loop.
-[[sub:EMCIO-Section]]
-=== [EMCIO] Section(((EMCIO (inifile section))))
+
+==== [EMCIO] Section[[sub:EMCIO-Section]]
+(((EMCIO (inifile section))))
* 'EMCIO = io' - Name of IO controller program
diff --git a/docs/src/config/ini_config_es.txt b/docs/src/config/ini_config_es.txt
index ce2139c5e..8c2f1a7e8 100644
--- a/docs/src/config/ini_config_es.txt
+++ b/docs/src/config/ini_config_es.txt
@@ -212,7 +212,7 @@ User Manual.
The following [DISPLAY] items are for the AXIS interface only.
* 'DEFAULT_LINEAR_VELOCITY = .25' - The default velocity for linear jogs, in ,
- <<sub:TRA]-section,machine units>> per second.
+ <<sub:TRAJ-section,machine units>> per second.
* 'MIN_VELOCITY = .01' - The approximate lowest value the jog slider.
diff --git a/docs/src/gcode/m-code_fr.txt b/docs/src/gcode/m-code_fr.txt
index c49c14fe5..1a5e378b9 100644
--- a/docs/src/gcode/m-code_fr.txt
+++ b/docs/src/gcode/m-code_fr.txt
@@ -5,6 +5,10 @@
[[cha:M-codes]] (((Les M-codes)))
+:ini: {basebackend@docbook:'':ini}
+:hal: {basebackend@docbook:'':hal}
+:ngc: {basebackend@docbook:'':ngc}
+
== Table des M-codes
[width="60%", options="header", cols="2^,5<"]
@@ -16,6 +20,7 @@
|<<sec:M3-M4-M5,M3 M4 M5>> | Contrôle de la broche
|<<sec:M6-Appel-Outil,M6 Tn>> | Appel d'outil n=numéro d'outil
|<<sec:M7-M8-M9,M7 M8 M9>> | Contrôle des arrosages
+|<<sec:M19,M19>> | Orientation de la broche
|<<sec:M48-M49,M48 M49>> | Contrôle des correcteurs de vitesse
|<<sec:M50-Controle-Correcteur-Vitesse-Travail,M50>> | Contrôle du correcteur de vitesse travail
|<<sec:M51-Controle-Correcteur-Vitesse-Broche,M51>> | Contrôle du correcteur de vitesse de broche
@@ -26,6 +31,10 @@
|<<sec:M66-Ctrl-Entree-Numerique-Et-Analogique,M66>> | Contrôle d'entrée numérique et analogique
|<<sec:M67-Ctrl-Sortie-Analogique-Synchro,M67>> | Contrôle sortie analogique synchronisée
|<<sec:M68-Ctrl-Sortie-Analogique-Directe,M68>> | Contrôle sortie analogique directe
+|<<sec:M70-Save-Modal-State,M70>> | Enregistre l'état modal
+|<<sec:M71-Invalidate-Stored-Modal-State,M71>> | Invalide l'état modal enregistré
+|<<sec:M72-Restore-Modal-State,M72>> | Restaure l'état modal
+|<<sec:M73-Save-Autorestore-Modal-State,M73>> | Enregistrement/auto-restauration de l'état modal
|<<sec:M100-a-M199, M100 à M199 >> | M-codes définis par l'utilisateur
|========================================================
@@ -168,6 +177,63 @@ il n'y aura pas d'outil dans la broche après le changement.
Il est toujours permis d'utiliser une de ces commandes,
que les arrosages soient arrêtés ou non.
+[[sec:M19]]
+== M19 Orientation de la broche
+(((M19 Orientation de la broche)))
+
+* _M19 R- Q- [P-]_
+
+* _R_ - Position à atteindre à partir de 0, cette valeur doit être comprise entre
+0 et 360 degrés.
+
+* _Q_ - Durée d'attente en secondes pour compléter l'orientation. Si
+_motion.spindle.is_oriented_ n'est pas devenue vraie dans le temps imparti par Q,
+une erreur de timeout se produira.
+
+* _P_ - Direction de rotation vers la position cible.
+** _0_ - rotation pour petit mouvement angulaire (défaut)
+** _1_ - rotation toujours en sens horaire (même direction qu'avec M3)
+** _2_ - rotation toujours en sens anti-horaire (même direction qu'avec M4)
+
+
+M19 est révoqué par M3,M4 ou M5.
+
+L'orientation de la broche nécessite un codeur de position avec index,
+indiquant la position de la broche ainsi que sa direction de rotation.
+
+Paramètres de réglage de la section [RS274NGC].
+
+ORIENT_OFFSET = 0 à 360 (offset fixe en degrés, ajouté au mot R de M19)
+
+Broches de HAL
+
+* _motion.spindle-orient-angle_ (sortie float)
+Orientation souhaitée pour M19. Valeur du paramètre R de M19 plus la valeur du
+paramètre d'ini [RS274NGC]ORIENT_OFFSET.
+
+* _motion.spindle-orient-mode_ (sortie s32)
+Mode de rotation de la broche souhaité. Reflète le mot P de M19, Défaut = 0
+
+* _motion.spindle-orient_ (sortie bit)
+Indique le début du cycle d'orientation de la broche. Positionné par M19.
+Remis à zéro par M3,M4 ou M5.
+Si _spindle-orient-fault_ n'est pas à zéro alors que _spindle-orient_ est vraie
+la commande M19 échoue avec un message d'erreur.
+
+* _motion.spindle-is-oriented_ (entrée bit)
+Pin de confirmation de l'orientation de la broche. Termine le cycle
+d'orientation. Si _spindle-orient_ est vraie quand _spindle-is-oriented_ est
+activée, la pin _spindle-orient_ est mise à zéro et la pin _spindle-locked_
+est activée. La pin _spindle-brake_ est également activée.
+
+* _motion.spindle-orient-fault_ (entrée s32)
+Entrée de code d'erreur pour le cycle d'orientation. Toute valeur, autre que
+zéro, provoquera l'abandon du cycle d'orientation.
+
+* _motion.spindle-locked_ (sortie bit)
+Pin indiquant que le cycle de rotation est terminé. Désactivée par M3,M4 ou M5.
+
+
[[sec:M48-M49]]
== M48, M49 Contrôle des correcteurs de vitesse
(((M48, M49 Autoriser/Inhiber les correcteurs de vitesse)))
@@ -236,27 +302,27 @@ _motion.feed-hold_ est sans effet sur la vitesse quand _M53_ est inhibé.
== M61 Correction du numéro de l'outil courant
(((M61 Correction du numéro de l'outil courant)))
-* _M61 Q-_ - Corrige le numéro de l'outil courant, en mode MDI ou après un
+* _M61 Q _ - Corrige le numéro de l'outil courant, en mode MDI ou après un
changement manuel d'outil dans la fenêtre de données manuelles. Au démarrage
de LinuxCNC avec un outil dans la broche, il est possible ainsi d'ajuster le
numéro de l'outil courant sans faire de changement d'outil.
C'est une erreur si:
-* Q- n'est pas égal où supérieur à 0
+* Q n'est pas égal où supérieur à 0
[[sec:M62-a-M65-Ctrl-Sortie-Numerique]]
== M62 à M65 Contrôle de bits de sortie numérique
(((M62 Contrôle un bit de sortie numérique)))
-* _M62 P-_ - Active un bit de sortie numérique en synchronisme avec
+* _M62 P_ - Active un bit de sortie numérique en synchronisme avec
un mouvement.
-* _M63 P-_ - Désactive un bit de sortie numérique en synchronisme avec
+* _M63 P_ - Désactive un bit de sortie numérique en synchronisme avec
un mouvement.
-* _M64 P-_ - Active immédiatement un bit de sortie numérique.
-* _M65 P-_ - Désactive immédiatement un bit de sortie numérique.
+* _M64 P_ - Active immédiatement un bit de sortie numérique.
+* _M65 P_ - Désactive immédiatement un bit de sortie numérique.
-Le mot _P-_ spécifie le numéro du bit de sortie numérique. Le mot P doit
+Le mot _P_ spécifie le numéro du bit de sortie numérique. Le mot P doit
être compris entre 0 et une valeur par défaut de 3. Si nécessaire, le
nombre des entrées/sorties peut être augmenté en utilisant
le paramètre _num_dio_ lors du chargement du contrôleur de mouvement.
@@ -288,16 +354,16 @@ appropriées sont connectées aux sorties dans le fichier HAL.
----
M66 P- | E- <L-> <Q->
----
-* _P-_ - Spécifie le numéro d'un bit d'entrée numérique entre 0 et 3.
-* _E-_ - Spécifie le numéro d'un bit d'entrée analogique entre 0 et 3.
-* _L-_ - Spécifie le mode d'attente.
+* _P_ - Spécifie le numéro d'un bit d'entrée numérique entre 0 et 3.
+* _E_ - Spécifie le numéro d'un bit d'entrée analogique entre 0 et 3.
+* _L_ - Spécifie le mode d'attente.
** Mode 0: _IMMEDIATE_ - pas d'attente, retour immédiat, la valeur courante de
l'entrée est stockée dans le paramètre #5399
** Mode 1: _RISE_ attente d'un front montant sur l'entrée.
** Mode 2: _FALL_ attente d'un front descendant sur l'entrée.
** Mode 3: _HIGH_ attente d'un état logique HAUT sur l'entrée.
** Mode 4: _LOW_ attente d'un état logique BAS sur l'entrée.
-* _Q-_ - Spécifie le timeout pour l'attente, en secondes. Si le timeout est
+* _Q_ - Spécifie le timeout pour l'attente, en secondes. Si le timeout est
dépassé, l'attente est interrompue et la variable #5399 positionnée à -1.
* Le mode _0_ est le seul autorisé pour une entrée analogique.
@@ -330,8 +396,8 @@ motion.analog-in-nn appropriées sont connectées aux entrées dans le fichier H
M67 E- Q-
----
* _M67_ - Contrôle une sortie analogique synchronisée avec un mouvement.
-* _E-_ - Spécifie le numéro de la sortie, doit être compris entre 0 et 3.
-* _Q-_ - Spécifie la valeur à appliquer sur la sortie.
+* _E_ - Spécifie le numéro de la sortie, doit être compris entre 0 et 3.
+* _Q_ - Spécifie la valeur à appliquer sur la sortie.
Les changements de valeur spécifiés, seront effectifs au début du
prochain mouvement commandé. S'il n'y a pas de commande de mouvement ultérieur,
@@ -356,8 +422,8 @@ connectées aux sorties dans le fichier HAL.
M68 E- Q-
----
* _M68_ - Contrôle directement une sortie analogique.
-* _E-_ - Spécifie le numéro de la sortie, doit être compris entre 0 et 3.
-* _Q-_ - Spécifie la valeur à appliquer sur la sortie.
+* _E_ - Spécifie le numéro de la sortie, doit être compris entre 0 et 3.
+* _Q_ - Spécifie la valeur à appliquer sur la sortie.
M68 produit son effet immédiatement après être reçu par le
contrôleur de mouvement. Il n'est pas synchronisé avec un mouvement.
@@ -369,9 +435,219 @@ chapitre "LinuxCNC et HAL" dans le Manuel de l'intégrateur pour plus
d'informations sur le contrôleur de mouvement.
[NOTE]
-M68 ne sera opérationnel que si les pins motion.analog-out-nn appropriées sont
+M68 ne sera opérationnel que si les pins _motion.analog-out-nn_ appropriées sont
connectées aux sorties dans le fichier HAL.
+[[sec:M70-Save-Modal-State]]
+== M70 Enregistrement de l'état modal
+(((M70 Save Modal State)))
+
+Pour enregistrer explicitement l'état modal au niveau de l'appel courant,
+programmer _M70_. Une fois l'état modal enregistré avec _M70_, il peut être
+restauré exactement dans le même état en exécutant un _M72_.
+
+Une paire d'instructions _M70_ et _M72_ est typiquement utilisée pour protéger
+un programme contre d'éventuels changements modaux pouvant se produire dans les
+sous-programmes.
+
+[[saved_state_by_M70]]
+Les états enregistrés sont les suivants:
+
+* unités machine courantes G20/G21 (po/mm)
+* plan de travail courant (G17/G18/G19 G17.1,G18.1,G19.1)
+* statut de la compensation de rayon d'outil (G40,G41,G42,G41.1,G42,1)
+* mode de déplacement - relatif/absolu (G90/G91)
+* mode de vitesse (G93/G94,G95)
+* coordonnées système courantes (G54-G59.3)
+* statut de la compensation de longueur d'outil (G43,G43.1,G49)
+* options du plan de retrait (G98,G99)
+* mode de contrôle de broche (G96-css ou G97-RPM)
+* mode de déplacement en arc (G90.1, G91.1)
+* mode diamètre/rayon des tours (G7,G8)
+* mode de contrôle de trajectoire (G61, G61.1, G64)
+* avance et vitesse broche courantes (valeurs _F_ et _S_)
+* statut de la broche (M3,M4,M5) - on/off et direction
+* statut de l'arrosage (M7) et (M8)
+* réglages des correcteurs de vitesse broche (M51) et du correcteur de vitesse
+travail (M50)
+* réglage du contrôle de vitesse adaptative (M52)
+* réglage du contrôle de la coupure de vitesse (M53)
+
+Noter qu'en particulier, les modes de mouvement (G1 etc) ne sont _PAS_ restaurés.
+
+_Le niveau de l'appel courant_ signifie:
+
+ * Exécution dans le programme principal. Il n'y a qu'un seul emplacement de
+stockage pour l'état modal au niveau du programme principal; si plusieurs
+instructions _M70_ sont exécutées tour à tour, seul l'état enregistré le plus
+récent est restauré quand un _M72_ est exécuté.
+
+ * Exécution dans un sous-programme G-code. L'état enregistré par _M70_
+dans un sous-programme se comporte exactement comme un paramètre nommé local -
+on ne peut s'y référer qu'à l'intérieur du sous-programme en invoquant un _M72_,
+à la sortie du sous-programme, le paramètre disparaît.
+
+Une invocation récursive d'un sous-programme introduit un nouveau niveau d'appel.
+
+[[sec:M71-Invalidate-Stored-Modal-State]]
+== M71 Invalidation de l'état modal enregistré
+(((M71 Invalidate Stored Modal State)))
+
+<<saved_state_by_M70,L'état modal enregistré par _M70_>> ou par
+<<sec:M73-Save-Autorestore-Modal-State, _M73_>> au niveau de l'appel courant est
+invalidé (ne peut plus être restauré nulle part).
+
+Un appel ultérieur à _M72_ sur le même niveau d'appel, échouera.
+
+Si il est exécuté dans un sous-programme qui protège l'état modal par un _M73_,
+un _return_ ou _endsub_ ultérieur ne restaurera _PAS_ l'état modal.
+
+L'utilité de ce dispositif est douteuse. Il ne devrait pas être invoqué quand
+il peut disparaître.
+
+[[sec:M72-Restore-Modal-State]]
+== M72 Restauration de l'état modal
+(((M72 Restore Modal State)))
+
+<<saved_state_by_M70,L'état modal enregistré par un _M70_>> peut être
+restauré en exécutant un _M72_.
+
+La gestion de G20/G21 reçoit un traitement particulier car les avances sont
+interprétées différemment selon G20/G21: si les unités de longueur (mm/po)
+doivent être modifiées par une opération de restauration, _M72_ va restaurer le
+mode distance en premier, puis ensuite tous les autres états, y compris les
+avances pour être sure que les valeurs d'avance soient interprétées selon un
+réglage d'unités correct.
+
+C'est une erreur d'exécuter _M72_ sans enregistrement précédent avec _M70_ à
+ce niveau.
+
+L'exemple suivant montre l'enregistrement puis la restauration de l'état modal
+autour de l'appel d'un sous-programme utilisant _M70_ et _M72_. Noter que
+le sous-programme 'imperialsub' n'est pas "au courant" des caractéristiques de
+M7x et peut être utilisé non modifié:
+
+
+[source,{ngc}]
+----
+O<showstate> sub
+(DEBUG, imperial=#<_imperial> absolute=#<_absolute> feed=#<_feed> rpm=#<_rpm>)
+O<showstate> endsub
+
+O<imperialsub> sub
+g20 (imperial)
+g91 (relative mode)
+F5 (low feed)
+S300 (low rpm)
+(debug, in subroutine, state now:)
+o<showstate> call
+O<imperialsub> endsub
+
+; programme principal
+g21 (metric)
+g90 (absolute)
+f200 (fast speed)
+S2500 (high rpm)
+
+(debug, in main, state now:)
+o<showstate> call
+
+M70 (save caller state in at global level)
+O<imperialsub> call
+M72 (explicitely restore state)
+
+(debug, back in main, state now:)
+o<showstate> call
+m2
+----
+
+[[sec:M73-Save-Autorestore-Modal-State]]
+== M73 Enregistrement et auto-restauration de l'état modal
+(((M73 Save and Autorestore Modal State)))
+
+
+Pour enregistrer l'état modal à l'intérieur d'un sous-programme et restaurer cet
+état lors d'un 'endsub' ou autre 'return', programmer _M73_.
+
+En cas d'abandon d'un programme en cours d'exécution dans un sous-programme
+traitant un _M73_, l'état ne sera *PAS* restauré.
+
+En outre, la fin normale (_M2_) d'un programme principal contenant un _M73_ ne
+restaurera *pas* l'état.
+
+L'utilisation suggérée consiste à placer au début d'un sous-programme, un O-code
+de sous-programme comme dans l'exemple ci-dessous. En utilisant _M73_, cette
+manière valide le design des sous-programmes qui doivent modifier l'état modal
+mais qui protège le programme appelant contre tout changement inopiné de
+l'état modal. Noter l'usage de <<sec:Parametres-Nommes, paramètres nommés>> dans
+le sous-programme 'showstate'.
+
+[source,{ngc}]
+----
+O<showstate> sub
+(DEBUG, imperial=#<_imperial> absolute=#<_absolute> feed=#<_feed> rpm=#<_rpm>)
+O<showstate> endsub
+
+O<imperialsub> sub
+M73 (save caller state in current call context, restore on return or endsub)
+g20 (imperial)
+g91 (relative mode)
+F5 (low feed)
+S300 (low rpm)
+(debug, in subroutine, state now:)
+o<showstate> call
+
+; note - M72 n'est pas utilisé ici - le endsub suivant ou un
+; 'return' explicite restaurera l'état de l'appelant
+O<imperialsub> endsub
+
+; programme principal
+g21 (metric)
+g90 (absolute)
+f200 (fast speed)
+S2500 (high rpm)
+(debug, in main, state now:)
+o<showstate> call
+o<imperialsub> call
+(debug, back in main, state now:)
+o<showstate> call
+m2
+----
+
+
+== Restauration sélective de l'état modal par le test de paramètres prédéfinis[[sec:Selectively-restoring-modal-state]]
+
+Exécuter un 'M72' ou au retour d'un sous-programme contenant un _M73_ pour
+restaurer <<saved_state_by_M70,*tout* l'état modal enregistré>>.
+
+Si seulement certains aspects de l'état modal doivent être préservés, une
+alternative consiste a utiliser les <<sec:Predefined-Named-Parameters,paramètres nommés prédéfinis>>, paramètres locaux et états conditionnels. L'idée est de rappeler
+les modes à restaurer au début du sous-programme et de restaurer ceux-ci avant
+de quitter. Voici un exemple, basé sur le programme
+'nc_files/tool-length-probe.ngc':
+
+
+[source,{ngc}]
+----
+O<measure> sub (measure reference tool)
+;
+#<absolute> = #<_absolute> (remember in local variable if G90 was set)
+;
+g30 (above switch)
+g38.2 z0 f15 (measure)
+g91 g0z.2 (off the switch)
+#1000=#5063 (save reference tool length)
+(print,reference length is #1000)
+;
+O<restore_abs> if [#<absolute>]
+ g90 (restore G90 only if it was set on entry:)
+O<restore_abs> endif
+;
+O<measure> endsub
+
+----
+
+
[[sec:M100-a-M199]]
== M100 à M199 Commandes définies par l'utilisateur
(((M100 à M199 M-codes définis par l'utilisateur)))
@@ -381,9 +657,9 @@ connectées aux sorties dans le fichier HAL.
M1-- <P- Q->
----
-* _M1--_ - Un entier compris entre 100 et 199.
-* _P-_ - Un nombre passé comme premier argument au programme externe.
-* _Q-_ - Un nombre passé comme second argument au programme externe.
+* _M1 --_ - Un entier compris entre 100 et 199.
+* _P_ - Un nombre passé comme premier argument au programme externe.
+* _Q_ - Un nombre passé comme second argument au programme externe.
Le programme externe, nommé _M100_ à _M199_, (avec un _M_ majuscule et aucune
extension) qui doit se trouver dans le répertoire pointé par la variable
diff --git a/docs/src/gcode/overview.txt b/docs/src/gcode/overview.txt
index 1d93ed9a1..de735c6eb 100644
--- a/docs/src/gcode/overview.txt
+++ b/docs/src/gcode/overview.txt
@@ -179,7 +179,7 @@ types of parameter of different purpose and appearance, each described
in the following sections. The only value type supported by parameters
is floating-point; there are no string, boolean or integer types in
G-code like in other programming languages. However, logic expressions
-can be formulated with <<sub:Binary-Operators,boolean operators>>
+can be formulated with <<sec:Binary-Operators,boolean operators>>
( 'AND', 'OR', 'XOR', and the comparison operators
'EQ','NE','GT','GE','LT','LE'), and the 'MOD', 'ROUND', 'FUP' and
'FIX' <<cap:Functions,operators>> support integer arithmetic.
@@ -635,8 +635,7 @@ parameters>> can be added easily without changes to the source code.
* `#<_value>` - [[param:_value]]
Return value from the last O-word `return` or `endsub`. Default
value 0 if no expression after `return` or `endsub`. Initialized
- to 0 on program start. See also
- <<sec:Subroutine-return-values,Subroutine return values>>.
+ to 0 on program start.
* `#<_value_returned>` -
1.0 if the last O-word `return` or `endsub` returned a value, 0
@@ -1242,7 +1241,7 @@ Interpreter. The Interpreter reads the file when it starts up, and
writes the file when it exits.
The format of a parameter file is shown in Table
-<<cap:format-parameter-file,Parameter File Format>>.
+<<sec:format-parameter-file,Parameter File Format>>.
The Interpreter expects the file to have two columns. It skips any
lines which do not contain exactly two numeric values. The first
@@ -1266,7 +1265,7 @@ ascending order.
The original file is saved as a backup file when the new file
is written.
-.Parameter File Format[[format-parameter-file]]
+.Parameter File Format[[sec:format-parameter-file]]
[width="90%", options="header"]
|========================================
diff --git a/docs/src/gcode/overview_fr.txt b/docs/src/gcode/overview_fr.txt
index c64233d0f..2631edaf2 100644
--- a/docs/src/gcode/overview_fr.txt
+++ b/docs/src/gcode/overview_fr.txt
@@ -5,6 +5,10 @@
[[cha:Vue-generale-G-code]] (((Vue générale du G-code de LinuxCNC)))
+:ini: {basebackend@docbook:'':ini}
+:hal: {basebackend@docbook:'':hal}
+:ngc: {basebackend@docbook:'':ngc}
+
== Brève description du G-code de LinuxCNC
Le G-code est le langage de programmation des machines numériques. Le G-code
@@ -255,8 +259,8 @@ paramètres sont utilisés pour accéder aux offsets des systèmes de coordonné
déterminer l'état de l'interpréteur et de la machine, par exemple _#<_relative>_
retourne 1 si G91 est actif et 0 si G90 est activé. Ils sont en lecture seule.
-[[sec:Parametres-Numerotes]]
-== Paramètres numérotés
+[[sub:Parametres-Numerotes]]
+=== Paramètres numérotés
(((Paramètres numérotés)))
Un paramètre numéroté commence par le caractère _#_ suivi par un
@@ -306,13 +310,14 @@ le fichier G-code.
du programme (X Y Z A B C U V W)
[[sub:Parametres-sous-programme]]
-== Paramètres de sous-programme
+=== Paramètres de sous-programme
+(((Paramètres de sous-programme)))
* _1-30_ - Paramètres d'appel d'arguments, locaux au sous-programme. Voir la
section des <<cha:O-codes, O-codes>>.
-[[sec:Parametres-Nommes]]
-== Paramètres nommés
+=== Paramètres nommés[[sec:Parametres-Nommes]]
+(((Paramètres nommés)))
Les paramètres nommés fonctionnent comme les paramètres numérotés mais
sont plus faciles à lire. Les paramètres nommés sont convertis en
@@ -356,8 +361,124 @@ Les paramètres globaux _a, _b, _c, ... _z sont réservés pour une
utilisation spéciale. Dans le futur, ils pourront fournir l'accès aux
derniers Aword, Bword, Cword, ... Zword etc.
-[[sec:Parametres-Systeme]]
-== Paramètres système
+=== Paramètres nommés prédéfinis[[sec:Predefined-Named-Parameters]]
+(((Paramètres nommées prédéfinis)))
+
+The following global read only named parameters are available to
+access internal state of the interpreter and machine state. They can
+be used in arbitrary expressions, for instance to control flow of the
+program with if-then-else statements.
+
+
+* `#<_vmajor>` - Major package version. If current version was 2.5.2 would return 2.5.
+
+* `#<_vminor>` - Minor package version. If current version was 2.6.2 it would return 0.2.
+
+* `#<_line>` -
+ Sequence number. If running a G-Code file, this returns the current line number.
+
+* `#<_motion_mode>` -
+ Return the interpreter's current motion mode:
+[width="20%",options="header"]
+|========================================
+|Motion mode | return value
+|G1| 10
+|G2| 20
+|G3| 30
+|G33| 330
+|G38.2| 382
+|G38.3| 383
+|G38.4| 384
+|G38.5| 385
+|G5.2| 52
+|G73| 730
+|G76| 760
+|G80| 800
+|G81| 810
+|G82| 820
+|G83| 830
+|G84| 840
+|G85| 850
+|G86| 860
+|G87| 870
+|G88| 880
+|G89| 890
+|========================================
+* `#<_plane>` -
+ returns the value designating the current plane:
+[width="20%",options="header"]
+|========================================
+|Plane | return value
+|G17| 170
+|G18| 180
+|G19| 190
+|G17.1| 171
+|G18.1| 181
+|G19.1| 191
+|========================================
+
+
+* `#<_ccomp>` -
+ Status of cutter compensation. Return values:
+[width="20%",options="header"]
+|========================================
+|Mode | return value
+|G40 | 400
+|G41 | 410
+|G41.1| 411
+|G41 | 410
+|G42 | 420
+|G42.1 | 421
+|========================================
+
+* `#<_metric>` -
+ Return 1 if G21 is on, else 0.
+
+* `#<_imperial>` -
+ Return 1 if G20 is on, else 0.
+
+* `#<_absolute>` -
+ Return 1 if G90 is on, else 0.
+
+* `#<_incremental>` -
+ Return 1 if G91 is on, else 0.
+
+* `#<_inverse_time>` -
+ Return 1 if inverse feed mode (G93) is on, else 0.
+
+* `#<_units_per_minute>` -
+ Return 1 if Units/minute feed mode (G94) is on, else 0.
+
+* `#<_units_per_rev>` -
+ Return 1 if Units/revolution mode (G95) is on, else 0.
+
+* `#<_coord_system>` -
+ Return index of the current coordinate system (G54..G59.3)
+[width="20%",options="header"]
+|========================================
+|Mode | return value
+|G54| 0
+|G55| 1
+|G56| 2
+|G57| 3
+|G58| 4
+|G59| 5
+|G59.1|6
+|G59.2|7
+|G59.3|8
+|========================================
+
+* `#<_tool_offset>` -
+ Return 1 if tool offset (G43) is on, else 0.
+
+* `#<_retract_r_plane>` -
+ Return 1 if G98 is set, else 0.
+
+* `#<_retract_old_z>` -
+ Return 1 if G99 is on, else 0.
+
+[[sub:Parametres-Systeme]]
+=== Paramètres système
(((Paramètres système)))
Deux paramètres nommés globaux, permettant de lire, à partir du G-code,
diff --git a/docs/src/hal/canonical-devices_es.txt b/docs/src/hal/canonical-devices_es.txt
index 912441a8a..f253460a9 100644
--- a/docs/src/hal/canonical-devices_es.txt
+++ b/docs/src/hal/canonical-devices_es.txt
@@ -1,6 +1,5 @@
= Canonical Device Interfaces
-[[cha:Canonical-Device-Interfaces]]
////
ATTENTION TRANSLATORS before translating this document copy the base document
@@ -15,12 +14,16 @@ Link <<anchor-name,text after the comma can be translated>>
Make sure the documents build after translating.
////
+
.Note
*********************************************************************
By version 2.1, the HAL drivers should have all been updated to
match these specs. Send an email if you spot any problems.
*********************************************************************
+[[cha:Canonical-Device-Interfaces]]
+== Introduction
+
The following sections show the pins, parameters, and functions that
are supplied by “canonical devices”. All HAL device drivers should
supply the same pins and parameters, and implement the same behavior.
diff --git a/docs/src/hal/parallel_port.txt b/docs/src/hal/parallel_port.txt
index 5d441b4e3..ed0eae1f7 100644
--- a/docs/src/hal/parallel_port.txt
+++ b/docs/src/hal/parallel_port.txt
@@ -153,7 +153,8 @@ low. If '-invert' is FALSE, setting the HAL '-out' pin TRUE drives the
physical pin high, and FALSE drives it low. If '-invert' is TRUE, then
setting the HAL '-out' pin TRUE will drive the physical pin low.
-=== Functions [[parport-functions]] (((parport functions)))
+=== Functions[[sub:parport-functions]]
+(((parport functions)))
* 'parport.<p>.read' (funct) Reads physical input pins of port
'<portnum>' and updates HAL '-in' and '-in-not' pins.
diff --git a/docs/src/hal/rtcomps.txt b/docs/src/hal/rtcomps.txt
index 9ce1b917c..fe7454f95 100644
--- a/docs/src/hal/rtcomps.txt
+++ b/docs/src/hal/rtcomps.txt
@@ -86,8 +86,7 @@ on the step type and control type selected.
* '(bit) stepgen.<chan>.phase-D' - Phase D output (step types 5-14 only).
* '(bit) stepgen.<chan>.phase-E' - Phase E output (step types 11-14 only).
-[[sub:stepgen-parameters]]
-.Parameters
+.Parameters[[sub:stepgen-parameters]]
* '(float) stepgen.<chan>.position-scale' - Steps per position unit.
This parameter is used for both output and feedback.
@@ -104,7 +103,7 @@ on the step type and control type selected.
* '(float) stepgen.<chan>.stepspace' - Minimum spacing between two
step pulses (step types 0 and 1 only), in nano-seconds. Set to 0 to
enable the stepgen 'doublefreq' function. To use 'doublefreq' the
- <<parport-functions,parport reset function>> must be enabled.
+ <<sub:parport-functions,parport reset function>> must be enabled.
* '(float) stepgen.<chan>.dirsetup' - Minimum time from a direction
change to the beginning of the next
step pulse (step type 0 only), in nanoseconds.
@@ -155,7 +154,7 @@ maxfreq is zero, it will remain zero, but the output frequency will
still be limited.
When using the parallel port driver the step frequency can be doubled using
-the <<parport-functions,parport reset>> function together with stepgen's
+the <<sub:parport-functions,parport reset>> function together with stepgen's
'doublefreq' setting.
[[fig:StepDir-timing]]
diff --git a/docs/src/hal/rtcomps_es.txt b/docs/src/hal/rtcomps_es.txt
index 72995f801..b654c448c 100644
--- a/docs/src/hal/rtcomps_es.txt
+++ b/docs/src/hal/rtcomps_es.txt
@@ -1,6 +1,7 @@
-= Realtime Components
+= HAL Component Descriptions
-[[cha:realtime-components]] (((Realtime Components)))
+[[cha:realtime-components]]
+(((Realtime Components)))
////
ATTENTION TRANSLATORS before translating this document copy the base document
@@ -15,6 +16,7 @@ Link <<anchor-name,text after the comma can be translated>>
Make sure the documents build after translating.
////
+
[[sec:Stepgen]]
== Stepgen(((stepgen)))
@@ -24,24 +26,21 @@ built in pre-tuned position loop, so PID tuning is not required. In
velocity mode, it drives a motor at the commanded speed, while obeying
velocity and acceleration limits. It is a realtime component only, and
depending on CPU speed, etc, is capable of maximum step rates of 10kHz
-to perhaps 50kHz. Figure <<fig:Stepgen-Block-Diag,Stepgen-Block-Diag>> shows three block
-diagrams, each is a single step pulse generator. The first diagram is
-for step type '0', (step and direction). The second is for step type
-'1' (up/down, or pseudo-PWM), and the third is for step types 2 through
-14 (various stepping patterns). The first two diagrams show position
+to perhaps 50kHz. Figure <<fig:Stepgen-Block-Diag,Step Pulse Generator Block Diagram>>
+shows three block diagrams, each is a single step pulse generator.
+The first diagram is for step type '0', (step and direction). The second is
+for step type '1' (up/down, or pseudo-PWM), and the third is for step types 2
+through 14 (various stepping patterns). The first two diagrams show position
mode control, and the third one shows velocity mode. Control mode and
step type are set independently, and any combination can be selected.
[[fig:Stepgen-Block-Diag]]
-.Step Pulse Generator Block Diagram (position mode)
+.Step Pulse Generator Block Diagram position mode
(((Stepgen Block Diagram)))
-image::images/stepgen-block-diag.png[]
-
-.Step Pulse Generator Block Diagram (velocity mode)[[fig:Stepgen-Block-Diag]]
-image::images/stepgen-block-diag.eps[]
+image::images/stepgen-block-diag.png[align="center"]
-=== Installing
+.Installing
----
halcmd: loadrt stepgen step_type=<type-array> [ctrl_type=<ctrl_array>]
@@ -64,27 +63,27 @@ halcmd: loadrt stepgen step_type=0,0,2 ctrl_type=p,p,v
will install three step generators. The first two use step type '0'
(step and direction) and run in position mode. The last one uses step
type '2' (quadrature) and runs in velocity mode. The default value for
-'<config-array>' is '0,0,0' which will install three type '0'
+'<config-array>' is '0,0,0' which will install three type '0'
(step/dir) generators. The maximum
number of step generators is 8 (as defined by MAX_CHAN in stepgen.c).
Each generator is independent, but all are updated by the same
function(s) at the same time. In the following descriptions, '<chan>'
is the number of a specific generator. The first generator is number 0.
-
-=== Removing
+(((Stepgen Block Diagram)))
+.Removing
----
halcmd: unloadrt stepgen
----
-=== Pins
+.Pins
Each step pulse generator will have only some of these pins, depending
on the step type and control type selected.
* '(float) stepgen.<chan>.position-cmd' - Desired motor position, in
position units (position mode only).
-* '(float) stepgen.<chan>.velocity-cmd' - Desired motor velocity, in
+* '(float) stepgen.<chan>.velocity-cmd' - Desired motor velocity, in
position units per second (velocity mode only).
* '(s32) stepgen.<chan>.counts' - Feedback position in counts,
updated by 'capture_position()'.
@@ -102,11 +101,12 @@ on the step type and control type selected.
* '(bit) stepgen.<chan>.phase-D' - Phase D output (step types 5-14 only).
* '(bit) stepgen.<chan>.phase-E' - Phase E output (step types 11-14 only).
-=== Parameters
+[[sub:stepgen-parameters]]
+.Parameters
-* '(float) stepgen.<chan>.position-scale' - Steps per position unit.
+* '(float) stepgen.<chan>.position-scale' - Steps per position unit.
This parameter is used for both output and feedback.
-* '(float) stepgen.<chan>.maxvel' - Maximum velocity, in position
+* '(float) stepgen.<chan>.maxvel' - Maximum velocity, in position
units per second. If 0.0, has no effect.
* '(float) stepgen.<chan>.maxaccel' - Maximum accel/decel rate, in
positions units per second squared.
@@ -117,8 +117,9 @@ on the step type and control type selected.
type 0 and 1) or minimum time in a
given state (step types 2-14), in nano-seconds.
* '(float) stepgen.<chan>.stepspace' - Minimum spacing between two
- step pulses (step types 0 and 1 only),
- in nano-seconds.
+ step pulses (step types 0 and 1 only), in nano-seconds. Set to 0 to
+ enable the stepgen 'doublefreq' function. To use 'doublefreq' the
+ <<sub:parport-functions,parport reset function>> must be enabled.
* '(float) stepgen.<chan>.dirsetup' - Minimum time from a direction
change to the beginning of the next
step pulse (step type 0 only), in nanoseconds.
@@ -148,43 +149,52 @@ values for these parameters ensure that the motor can follow the
generated pulse train.
[[sub:Stepgen-Step-Types]]
-=== Step Types
+.Step Types
-The step generator supports 15 different 'step types'. Step type 0 is
-the most familiar, standard step and direction. When configured for
+.Step Type 0
+Step type 0 is the standard step and direction type. When configured for
step type 0, there are four extra parameters that determine the exact
-timing of the step and direction signals. See figure
-<<fig:StepDir-timing,StepDir timing>> for the meaning of these parameters. The
+timing of the step and direction signals. In the following figure
+the meaning of these parameters is shown. The
parameters are in nanoseconds, but will be rounded up to an integer
multiple of the thread period for the threaed that calls
-'make_pulses()'. For example, if 'make_pulses()' is called every 16 us,
+'make_pulses()'. For example, if 'make_pulses()' is called every 16 us,
and steplen is 20000, then the step pulses will
be 2 x 16 = 32 us long. The default value for all four of the parameters
is 1ns, but the automatic rounding takes effect the first time the code
runs. Since one step requires 'steplen' ns high and 'stepspace' ns
low, the maximum frequency is 1,000,000,000 divided by
-'(steplen+stepspace)'. If 'maxfreq' is set higher than that limit, it
+'(steplen+stepspace)'. If 'maxfreq' is set higher than that limit, it
will be lowered automatically. If
maxfreq is zero, it will remain zero, but the output frequency will
still be limited.
+When using the parallel port driver the step frequency can be doubled using
+the <<sub:parport-functions,parport reset>> function together with stepgen's
+'doublefreq' setting.
+
[[fig:StepDir-timing]]
.Step and Direction Timing
-image::images/stepgen-type0.png[]
-
+image::images/stepgen-type0.png[align="center"]
+.Step Type 1
Step type 1 has two outputs, up and down. Pulses appear on one or the
other, depending on the direction of travel. Each pulse is 'steplen' ns
long, and the pulses are separated by at least 'stepspace' ns. The
maximum frequency is the same as for step type 0. If 'maxfreq' is set
-higher than the limit it will be lowered. If 'maxfreq' is zero, it
+higher than the limit it will be lowered. If 'maxfreq' is zero, it
will remain zero but the output frequency will still be
limited.
+[WARNING]
+Do not use the parport reset function with step types 2 - 14. Unexpected
+results can happen.
+
+.Step Type 2 - 14
Step types 2 through 14 are state based, and have from two to five
outputs. On each step, a state counter is incremented or decremented.
-Figures <<fig:Two-and-Three-Phase,Two-and-Three-Phase>>, <<fig:Four-Phase,Four-Phase>>, and
+Figures <<fig:Two-and-Three-Phase,Two-and-Three-Phase>>, <<fig:Four-Phase,Four-Phase>>, and
<<fig:Five-Phase,Five-Phase>> show the output patterns as a function of the state
counter. The maximum frequency is 1,000,000,000 divided by 'steplen',
and as in the other modes, 'maxfreq' will be lowered if it is above the
@@ -192,23 +202,23 @@ limit.
[[fig:Two-and-Three-Phase]]
.Two-and-Three-Phase Step Types
-(((Two-and-Three-Phase)))
+(((Two and Three Phase)))
-image::images/stepgen-type2-4.png[]
+image::images/stepgen-type2-4.png[align="center"]
[[fig:Four-Phase]]
.Four-Phase Step Types
(((Four Phase)))
-image::images/stepgen-type5-10.png[]
+image::images/stepgen-type5-10.png[align="center", width=800]
[[fig:Five-Phase]]
.Five-Phase Step Types
(((Five Phase)))
-image::images/stepgen-type11-14.png[]
+image::images/stepgen-type11-14.png[align="center"]
-=== Functions
+.Functions
The component exports three functions. Each function acts on all of
the step pulse generators - running different generators in different
@@ -225,7 +235,7 @@ The high speed function 'stepgen.make-pulses' should be run in a very
fast thread, from 10 to 50 us depending on the
capabilities of the computer. That thread's period determines the
maximum step frequency, since 'steplen', 'stepspace', 'dirsetup',
-'dirhold', and 'dirdelay' are all rounded up to a integer multiple of
+'dirhold', and 'dirdelay' are all rounded up to a integer multiple of
the thread periond in
nanoseconds. The other two functions can be called at a much lower
rate.
@@ -239,7 +249,7 @@ realtime component only, and depending on CPU speed, etc, is capable of
PWM frequencies from a few hundred Hertz at pretty good resolution, to
perhaps 10KHz with limited resolution.
-=== Installing
+.Installing
----
loadrt pwmgen output_type=<config-array>
@@ -248,7 +258,7 @@ loadrt pwmgen output_type=<config-array>
The '<config-array>' is a series of comma separated decimal integers. Each
number causes a single PWM generator to be loaded, the value of the number
determines the output type. The following example will install three PWM
-generators. There is no default value, if '<config-array>' is not specified,
+generators. There is no default value, if '<config-array>' is not specified,
no PWM generators will be installed. The maximum number of frequency generators
is 8 (as defined by MAX_CHAN in pwmgen.c). Each generator is independent,
but all are updated by the same function(s) at the same time. In the following
@@ -260,13 +270,13 @@ generator is number 0.
loadrt pwmgen output_type=0,1,2
----
-=== Removing
+.Removing
----
unloadrt pwmgen
----
-=== Output Types
+.Output Types
The PWM generator supports three different 'output types'.
@@ -285,7 +295,7 @@ The PWM generator supports three different 'output types'.
commands, the PWM signal appears on the down output, and the up output
remains false. Output type 2 is suitable for driving most H-bridges.
-=== Pins
+.Pins
Each PWM generator will have the following pins:
@@ -305,22 +315,22 @@ output type selected:
* '(bit) pwmgen.<chan>.down' - PWM/PDM output for negative input
value (output type 2 only).
-=== Parameters
+.Parameters
* '(float) pwmgen.<chan>.scale' - Scaling factor to convert 'value'
from arbitrary units to duty cycle.
-* '(float) pwmgen.<chan>.pwm-freq' - Desired PWM frequency, in Hz.
+* '(float) pwmgen.<chan>.pwm-freq' - Desired PWM frequency, in Hz.
If 0.0, generates PDM instead of
PWM. If set higher than internal limits, next call of 'update_freq()'
will set it to the internal limit. If non-zero, and 'dither' is false,
next call of 'update_freq()' will set it to the nearest integer
multiple of the 'make_pulses()' function period.
-* '(bit) pwmgen.<chan>.dither-pwm' - If true, enables dithering to
+* '(bit) pwmgen.<chan>.dither-pwm' - If true, enables dithering to
achieve average PWM frequencies or
duty cycles that are unobtainable with pure PWM. If false, both the PWM
frequency and the duty cycle will be rounded to values that can be
achieved exactly.
-* '(float) pwmgen.<chan>.min-dc' - Minimum duty cycle, between 0.0
+* '(float) pwmgen.<chan>.min-dc' - Minimum duty cycle, between 0.0
and 1.0 (duty cycle will go to
zero when disabled, regardless of this setting).
* '(float) pwmgen.<chan>.max-dc' - Maximum duty cycle, between 0.0
@@ -328,7 +338,7 @@ output type selected:
* '(float) pwmgen.<chan>.curr-dc' - Current duty cycle - after all
limiting and rounding (read only).
-=== Functions
+.Functions
The component exports two functions. Each function acts on all of the
PWM generators - running different generators in different threads is
@@ -336,52 +346,62 @@ not supported.
* '(funct) pwmgen.make-pulses' - High speed function to generate PWM
waveforms (no floating point).
-* '(funct) pwmgen.update' - Low speed function to scale and limit
+* '(funct) pwmgen.update' - Low speed function to scale and limit
value and handle other parameters.
-The high speed function 'pwmgen.make-pulses' should be run in a very
+The high speed function 'pwmgen.make-pulses' should be run in a very
fast thread, from 10 to 50 us depending on the
capabilities of the computer. That thread's period determines the
maximum PWM carrier frequency, as well as the resolution of the PWM or
PDM signals. The other function can be called at a much lower rate.
-== Encoder[[sec:Encoder]](((encoder)))
+[[sec:Encoder]]
+== Encoder(((encoder)))
This component provides software based counting of signals from
quadrature encoders. It is a realtime component only, and depending on
CPU speed, latency, etc, is capable of maximum count rates of 10kHz to
-perhaps up to 50kHz. Figure <<fig:Encoder-Block-Diag,Encoder-Block-Diag>> is a block
-diagram of one channel of encoder counter.
+perhaps up to 50kHz.
+
+The base thread should be 1/2 count speed to allow for noise and timing
+variation. For example if you have a 100 pulse per revolution encoder on the
+spindle and your maximnum RPM is 3000 the maximum base thread should be 25 us.
+A 100 pulse per revolution encoder will have 400 counts. The spindle speed
+of 3000 RPM = 50 RPS (revolutions per second). 400 * 50 = 20,000 counts per
+second or 50 us between counts.
+
+Figure <<fig:Encoder-Block-Diag,Encoder Counter Block Diagram>> is a block
+diagram of one channel of encoder counter.
[[fig:Encoder-Block-Diag]]
.Encoder Counter Block Diagram
(((Encoder Block Diagram)))
-image::images/encoder-block-diag.png[]
+image::images/encoder-block-diag.png[align="center"]
-=== Installing
+.Installing
----
halcmd: loadrt encoder [num_chan=<counters>]
----
'<counters>' is the number of encoder counters that you want to
-install. If 'numchan' is not specified, three counters will be
+install. If 'numchan' is not specified, three counters will be
installed. The maximum
number of counters is 8 (as defined by MAX_CHAN in encoder.c). Each
counter is independent, but all are updated by the same function(s) at
the same time. In the following descriptions, '<chan>' is the number
of a specific counter. The first counter is number 0.
-=== Removing
+.Removing
----
halcmd: unloadrt encoder
----
-=== Pins
+.Pins
-* 'encoder.<chan>.counter-mode' (bit, I/O) (default: FALSE) - Enables
+* 'encoder.<chan>.counter-mode' (bit, I/O) (default: FALSE) - Enables
counter mode. When true, the
counter counts each rising edge of the phase-A input, ignoring the
value on phase-B. This is useful for counting the output of a single
@@ -393,7 +413,7 @@ halcmd: unloadrt encoder
'position are' reset to zero on next rising edge of Phase Z. At the
same time, 'index-enable' is reset to zero to indicate that the rising
edge has occoured. The 'index-enable' pin is bi-directional. If
- 'index-enable' is False, the Phase Z channel of the encoder will be
+ 'index-enable' is False, the Phase Z channel of the encoder will be
ignored, and the
counter will count normally. The encoder driver will never set
'index-enable' True. However, some other component may do so.
@@ -402,7 +422,7 @@ halcmd: unloadrt encoder
* 'encoder.<chan>.latch-input' (bit, In) (default: TRUE) - Not used at
this time.
* 'encoder.<chan>.latch-rising' (bit, In) - Not used at this time.
-* 'encoder.<chan>.min-speed-estimate' (float, in) - Determine the
+* 'encoder.<chan>.min-speed-estimate' (float, in) - Determine the
minimum true velocity magnitude at which
velocity will be estimated as nonzero and postition-interpolated will
be interpolated. The units of 'min-speed-estimate' are the same as the
@@ -426,36 +446,36 @@ halcmd: unloadrt encoder
revolution 'encoder') to be used for lathe threading, and may have
other uses as well.
* 'encoder.<chan>.position-latched (float, Out)' - Not used at this time.
-* 'encoder.<chan>.position-scale (float, I/O)' - Scale factor, in
+* 'encoder.<chan>.position-scale (float, I/O)' - Scale factor, in
counts per length unit. For example, if
position-scale is 500, then 1000 counts of the encoder will be reported
as a position of 2.0 units.
-* 'encoder.<chan>.rawcounts (s32, In)' - The raw count, as determined
+* 'encoder.<chan>.rawcounts (s32, In)' - The raw count, as determined
by update-counters. This value is
updated more frequently than counts and position. It is also unaffected
by reset or the index pulse.
* 'encoder.<chan>.reset' (bit, In) - When True, force 'counts' and
'position' to zero immediately.
* 'encoder.<chan>.velocity' (float, Out) - Velocity in scaled units per
- second. 'encoder' uses an algorithm that greatly reduces quantization
+ second. 'encoder' uses an algorithm that greatly reduces quantization
noise as compared
- to simply differentiating the 'position' output. When the magnitude
+ to simply differentiating the 'position' output. When the magnitude
of the true velocity is below
min-velocity-estimate, the velocity output is 0.
-* 'encoder.<chan>.x4-mode (bit, I/O) (default: TRUE)' - Enables
+* 'encoder.<chan>.x4-mode (bit, I/O) (default: TRUE)' - Enables
times-4 mode. When true, the counter counts each edge of
the quadrature waveform (four counts per full cycle). When false, it
only counts once per full cycle. In counter-mode, this parameter is
ignored. The 1x mode is useful for some jogwheels.
-=== Parameters
+.Parameters
* 'encoder.<chan>.capture-position.time (s32, RO)'
* 'encoder.<chan>.capture-position.tmax (s32, RW)'
* 'encoder.<chan>.update-counters.time (s32, RO)'
* 'encoder.<chan>.update-counter.tmax (s32, RW)'
-=== Functions
+.Functions
The component exports two functions. Each function acts on all of the
encoder counters - running different counters in different threads is
@@ -473,48 +493,49 @@ This component provides Proportional/Integral/Derivative control
loops. It is a realtime component only. For simplicity, this discussion
assumes that we are talking about position loops, however this
component can be used to implement other feedback loops such as speed,
-torch height, temperature, etc. Figure <<fig:PID-block-diag,PID-block-diag>> is a
+torch height, temperature, etc. Figure <<fig:PID-block-diag,PID Loop Block Diagram>> is a
block diagram of a single PID loop.
[[fig:PID-block-diag]]
.PID Loop Block Diagram
+(((PID Block Diagram)))
-image::images/pid-block-diag.png[]
+image::images/pid-block-diag.png[align="center"]
-=== Installing
+.Installing
----
halcmd: loadrt pid [num_chan=<loops>] [debug=1]
----
'<loops>' is the number of PID loops that you want to install. If
-'numchan' is not specified, one loop will be installed. The maximum
+'numchan' is not specified, one loop will be installed. The maximum
number of
loops is 16 (as defined by MAX_CHAN in pid.c). Each loop is completely
independent. In the following descriptions, '<loopnum>' is the loop
number of a specific loop. The first loop is number 0.
-If 'debug=1' is specified, the component will export a few extra
+If 'debug=1' is specified, the component will export a few extra
parameters that
may be useful during debugging and tuning. By default, the extra
parameters are not exported, to save shared memory space and avoid
cluttering the parameter list.
-=== Removing
+.Removing
----
halcmd: unloadrt pid
----
-=== Pins
+.Pins
The three most important pins are
* '(float) pid.<loopnum>.command' - The desired position, as
commanded by another system component.
-* '(float) pid.<loopnum>.feedback' - The present position, as
+* '(float) pid.<loopnum>.feedback' - The present position, as
measured by a feedback device such as an encoder.
-* '(float) pid.<loopnum>.output' - A velocity command that attempts
+* '(float) pid.<loopnum>.output' - A velocity command that attempts
to move from the present position to the desired position.
For a position loop, 'command' and 'feedback' are in position units.
@@ -542,7 +563,7 @@ the PID block is at its maximum or minimum limit.
* '(float) pid.<loopnum>.saturated_s' - The time the output has been saturated.
* '(s32) pid.<loopnum>.saturated_count' - The time the output has been saturated.
-=== Parameters
+.Parameters
The PID gains, limits, and other 'tunable' features of the loop are
implemented as parameters.
@@ -553,9 +574,9 @@ implemented as parameters.
* '(float) pid.<loopnum>.bias' - Constant offset on output
* '(float) pid.<loopnum>.FF0' - Zeroth order feedforward - output
proportional to command (position).
-* '(float) pid.<loopnum>.FF1' - First order feedforward - output
+* '(float) pid.<loopnum>.FF1' - First order feedforward - output
proportional to derivative of command (velocity).
-* '(float) pid.<loopnum>.FF2' - Second order feedforward - output
+* '(float) pid.<loopnum>.FF2' - Second order feedforward - output
proportional to 2nd derivative
of command (acceleration)footnote:[FF2 is not currently implemented,
but it will be added. Consider this note a “FIXME” for the code].
@@ -578,7 +599,7 @@ additional parameters will be exported:
* '(float) pid.<loopnum>.commandD' - Derivative of the command.
* '(float) pid.<loopnum>.commandDD' - 2nd derivative of the command.
-=== Functions
+.Functions
The component exports one function for each PID loop. This function
performs all the calculations needed for the loop. Since each loop has
@@ -589,19 +610,18 @@ and execute at different rates.
for a single PID loop.
If you want to understand the exact algorithm used to compute the
-output of the PID loop, refer to figure <<fig:PID-block-diag,PID-block-diag>>, the
+output of the PID loop, refer to figure <<fig:PID-block-diag,PID Loop Block Diagram>>, the
comments at the beginning of 'emc2/src/hal/components/pid.c' , and of
course to the code itself. The loop calculations are in the C
function 'calc_pid()'.
-[[sec:Simulated-Encoder]]
-== Simulated Encoder(((sim-encoder)))
+== Simulated Encoder[[sec:Simulated-Encoder]](((sim-encoder)))
The simulated encoder is exactly that. It produces quadrature pulses
with an index pulse, at a speed controlled by a HAL pin. Mostly useful
for testing.
-=== Installing
+.Installing
----
halcmd: loadrt sim-encoder num_chan=<number>
@@ -611,13 +631,13 @@ halcmd: loadrt sim-encoder num_chan=<number>
specified, one encoder will be installed. The maximum number is 8 (as
defined by MAX_CHAN in sim_encoder.c).
-=== Removing
+.Removing
----
halcmd: unloadrt sim-encoder
----
-=== Pins
+.Pins
* '(float) sim-encoder.<chan-num>.speed' - The speed command for the
simulated shaft.
@@ -627,11 +647,11 @@ halcmd: unloadrt sim-encoder
When '.speed' is positive, '.phase-A' leads '.phase-B'.
-=== Parameters
+.Parameters
* '(u32) sim-encoder.<chan-num>.ppr' - Pulses Per Revolution.
* '(float) sim-encoder.<chan-num>.scale' - Scale Factor for 'speed'.
- The default is 1.0, which means that 'speed' is in revolutions per
+ The default is 1.0, which means that 'speed' is in revolutions per
second. Change to 60 for RPM, to 360 for
degrees per second, 6.283185 for radians per seconed, etc.
@@ -639,12 +659,12 @@ Note that pulses per revolution is not the same as counts per
revolution. A pulse is a complete quadrature cycle. Most encoder
counters will count four times during one complete cycle.
-=== Functions
+.Functions
The component exports two functions. Each function affects all
simulated encoders.
-* '(funct) sim-encoder.make-pulses' - High speed function to
+* '(funct) sim-encoder.make-pulses' - High speed function to
generate quadrature pulses (no floating point).
* '(funct) sim-encoder.update-speed' - Low speed function to read
'speed', do scaling, and set up 'make-pulses'.
@@ -656,13 +676,13 @@ Debounce is a realtime component that can filter the glitches created
by mechanical switch contacts. It may also be useful in other
applications where short pulses are to be rejected.
-=== Installing
+.Installing
----
halcmd: loadrt debounce cfg=<config-string>
----
-'<config-string>' is a series of comma separated decimal integers.
+'<config-string>' is a series of comma separated decimal integers.
Each number installs
a group of identical debounce filters, the number determines how many
filters are in the group.
@@ -675,31 +695,31 @@ halcmd: loadrt debounce cfg=1,4,2
will install three groups of filters. Group 0 contains one filter,
group 1 contains four, and group 2 contains two filters. The default
-value for '<config-string>' is '"1"' which will install a single group
+value for '<config-string>' is '"1"' which will install a single group
containing a single filter. The
maximum number of groups 8 (as defined by MAX_GROUPS in debounce.c).
The maximum number of filters in a group is limited only by shared
memory space. Each group is completely independent. All filters in a
single group are identical, and they are all updated by the same
function at the same time. In the following descriptions, '<G>' is the
-group number and '<F>' is the filter number within the group. The
+group number and '<F>' is the filter number within the group. The
first filter is group 0,
filter 0.
-=== Removing
+.Removing
----
halcmd: unloadrt debounce
----
-=== Pins
+.Pins
Each individual filter has two pins.
* '(bit) debounce.<G>.<F>.in' - Input of filter '<F>' in group '<G>'.
* '(bit) debounce.<G>.<F>.out' - Output of filter '<F>' in group '<G>'.
-=== Parameters
+.Parameters
Each group of filters has one parameterfootnote:[Each individual
filter also has an internal state variable. There is a
@@ -712,10 +732,10 @@ circumstances.].
The filter delay is in units of thread periods. The minimum delay is
zero. The output of a zero delay filter exactly follows its input - it
doesn't filter anything. As 'delay' increases, longer and longer
-glitches are rejected. If 'delay' is 4, all glitches less than or
+glitches are rejected. If 'delay' is 4, all glitches less than or
equal to four thread periods will be rejected.
-=== Functions
+.Functions
Each group of filters has one function, which updates all the filters
in that group 'simultaneously'. Different groups of filters can be
@@ -723,33 +743,32 @@ updated from different threads at different periods.
* '(funct) debounce.<G>' - Updates all filters in group '<G>'.
-[[sec:Siggen]]
-== Siggen(((siggen)))
+== Siggen[[sec:Siggen]](((siggen)))
Siggen is a realtime component that generates square, triangle, and
sine waves. It is primarily used for testing.
-=== Installing
+.Installing
----
halcmd: loadrt siggen [num_chan=<chans>]
----
'<chans>' is the number of signal generators that you want to install.
-If 'numchan' is not specified, one signal generator will be installed.
+If 'numchan' is not specified, one signal generator will be installed.
The maximum
number of generators is 16 (as defined by MAX_CHAN in siggen.c). Each
generator is completely independent. In the following descriptions,
'<chan>' is the number of a specific signal generator (the numbers
start at 0).
-=== Removing
+.Removing
----
halcmd: unloadrt siggen
----
-=== Pins
+.Pins
Each generator has five output pins.
@@ -775,14 +794,97 @@ For example, if 'siggen.0.amplitude' is 1.0 and 'siggen.0.offset' is
is 2.5 and 'siggen.0.offset' is 10.0, then the outputs will swing from
7.5 to 12.5.
-=== Parameters
+.Parameters
None. footnote:[Prior to version 2.1, frequency, amplitude, and offset
were parameters. They were changed to pins to allow control by other
components.]
-=== Functions
+.Functions
* '(funct) siggen.<chan>.update' - Calculates new values for all five outputs.
+[[sec:lut5]]
+== lut5(((lut5)))
+
+The lut5 component is a 5 input logic component based on a look up table.
+
+* 'lut5' does not require a floating point thread.
+
+.Installing
+
+----
+loadrt lut5 [count=N|names=name1[,name2...]]
+addf lut5.N servo-thread | base-thread
+setp lut5.N.function 0xN
+----
+
+.Computing Function
+
+To compute the hexadecimal number for the function starting from the top put
+a 1 or 0 to indicate if that row would be true or false. Next write down every
+number in the output column starting from the top and writing them from right
+to left. This will be the binary number. Using a calculator with a program
+view like the one in Ubuntu enter the binary number and then convert it to
+hexadecimal and that will be the value for function.
+
+.Look Up Table
+[width="50%",cols="6*^",options="header"]
+|====================================
+|Bit 4|Bit 3|Bit 2|Bit 1|Bit 0|Output
+|0|0|0|0|0|
+|0|0|0|0|1|
+|0|0|0|1|0|
+|0|0|0|1|1|
+|0|0|1|0|0|
+|0|0|1|0|1|
+|0|0|1|1|0|
+|0|0|1|1|1|
+|0|1|0|0|0|
+|0|1|0|0|1|
+|0|1|0|1|0|
+|0|1|0|1|1|
+|0|1|1|0|0|
+|0|1|1|0|1|
+|0|1|1|1|0|
+|0|1|1|1|1|
+|1|0|0|0|0|
+|1|0|0|0|1|
+|1|0|0|1|0|
+|1|0|0|1|1|
+|1|0|1|0|0|
+|1|0|1|0|1|
+|1|0|1|1|0|
+|1|0|1|1|1|
+|1|1|0|0|0|
+|1|1|0|0|1|
+|1|1|0|1|0|
+|1|1|0|1|1|
+|1|1|1|0|0|
+|1|1|1|0|1|
+|1|1|1|1|0|
+|1|1|1|1|1|
+|====================================
+
+.Two Input Example
+
+In the following table we have selected the output state for each line
+that we wish to be true.
+
+.Look Up Table
+[width="50%",cols="6*^",options="header"]
+|====================================
+|Bit 4|Bit 3|Bit 2|Bit 1|Bit 0|Output
+|0|0|0|0|0|0
+|0|0|0|0|1|1
+|0|0|0|1|0|0
+|0|0|0|1|1|1
+|====================================
+
+Looking at the output column of our example we want the output to be on
+when Bit 0 or Bit 0 and Bit1 is on and nothing else. The binary number is
+'b1010' (rotate the output 90 degrees CW). Enter this number into the
+calculator then change the display to hexadecimal and the number needed for
+function is '0xa'. The hexadecimal prefix is '0x'.
+