B&R motion controle
Posté : 03 janv. 2021, 17:52
Hello I have this following program and I would like to be able to integrate the second Y axis to be able to control it and be able to program the two axes.
______________________________________________________________
PROGRAM _INIT
//Vitesse et acceleration par defaut
aNom := 5.0; //[mm/s^2]
vNom := 10.0; // [mm/s]
//Deplacement
x0 := 150.0; //[mm]
Pas:= 20.0 ; //[mm]
END_PROGRAM
PROGRAM _CYCLIC
CASE etat OF
0: //Attente demande de demarrage
IF ihm_on THEN
etat := 10;
gAxeCmd01.BpOn := TRUE;
END_IF
10: //Demarrage de l'axe
IF gAxeInfo01.PowerOn THEN
etat := 11;
gAxeCmd01.BpHome := TRUE;
END_IF
11://Attente fin prise d'origine
IF gAxeInfo01.Standstill THEN
gAxeCmd01.BpMoveAbsolute := TRUE;
etat := 12;
END_IF
12: //Passage en mode de commande "Deplacement absolu"
IF gAxeInfo01.StandstillAbs THEN
etat := 20;
END_IF
20: //Attente action utilisateur
IF ihm_start THEN //demande depart mouvement
ihm_start := FALSE;
gAxeCmd01.MoveAbsolute.Acc := aNom;
gAxeCmd01.MoveAbsolute.Vit := vNom;
gAxeCmd01.MoveAbsolute.Pos := x0;
gAxeCmd01.MoveAbsolute.BpMove := TRUE;
etat := 100;
ELSIF NOT ihm_on THEN
gAxeCmd01.BpMoveAbsolute := FALSE;
etat := 21;
END_IF
21://Sortie mode "deplacement absolu"
IF gAxeInfo01.Standstill THEN
gAxeCmd01.BpOn := FALSE;
etat := 22;
END_IF
22://Arret moteur
IF NOT gAxeInfo01.PowerOn THEN
etat := 30;
END_IF
30://Attente action utilisateur : demande de demarrage
IF ihm_on THEN
gAxeCmd01.BpOn := TRUE;
etat := 31;
END_IF
31://Demarrage moteur
IF gAxeInfo01.PowerOn THEN
gAxeCmd01.BpMoveAbsolute := TRUE;
etat := 12;
END_IF
//------------------------
//Deplacement aller-retour
//------------------------
100://Deplacement en x0
IF gAxeInfo01.StandstillAbs THEN //Information "mouvement termine"
gAxeCmd01.MoveAbsolute.Acc := aNom;
gAxeCmd01.MoveAbsolute.Vit := vNom;
gAxeCmd01.MoveAbsolute.Pos := 0;
gAxeCmd01.MoveAbsolute.BpMove := TRUE;
etat := 101;
END_IF
101://Retour en 0
IF gAxeInfo01.StandstillAbs THEN
etat := 20;
END_IF
END_CASE
//Actualisation de la position et de la vitesse courante
Position.x := gAxeInfo01.S_act;
Vitesse.x := gAxeInfo01.V_act;
END_PROGRAM
______________________________________________________________
PROGRAM _INIT
//Vitesse et acceleration par defaut
aNom := 5.0; //[mm/s^2]
vNom := 10.0; // [mm/s]
//Deplacement
x0 := 150.0; //[mm]
Pas:= 20.0 ; //[mm]
END_PROGRAM
PROGRAM _CYCLIC
CASE etat OF
0: //Attente demande de demarrage
IF ihm_on THEN
etat := 10;
gAxeCmd01.BpOn := TRUE;
END_IF
10: //Demarrage de l'axe
IF gAxeInfo01.PowerOn THEN
etat := 11;
gAxeCmd01.BpHome := TRUE;
END_IF
11://Attente fin prise d'origine
IF gAxeInfo01.Standstill THEN
gAxeCmd01.BpMoveAbsolute := TRUE;
etat := 12;
END_IF
12: //Passage en mode de commande "Deplacement absolu"
IF gAxeInfo01.StandstillAbs THEN
etat := 20;
END_IF
20: //Attente action utilisateur
IF ihm_start THEN //demande depart mouvement
ihm_start := FALSE;
gAxeCmd01.MoveAbsolute.Acc := aNom;
gAxeCmd01.MoveAbsolute.Vit := vNom;
gAxeCmd01.MoveAbsolute.Pos := x0;
gAxeCmd01.MoveAbsolute.BpMove := TRUE;
etat := 100;
ELSIF NOT ihm_on THEN
gAxeCmd01.BpMoveAbsolute := FALSE;
etat := 21;
END_IF
21://Sortie mode "deplacement absolu"
IF gAxeInfo01.Standstill THEN
gAxeCmd01.BpOn := FALSE;
etat := 22;
END_IF
22://Arret moteur
IF NOT gAxeInfo01.PowerOn THEN
etat := 30;
END_IF
30://Attente action utilisateur : demande de demarrage
IF ihm_on THEN
gAxeCmd01.BpOn := TRUE;
etat := 31;
END_IF
31://Demarrage moteur
IF gAxeInfo01.PowerOn THEN
gAxeCmd01.BpMoveAbsolute := TRUE;
etat := 12;
END_IF
//------------------------
//Deplacement aller-retour
//------------------------
100://Deplacement en x0
IF gAxeInfo01.StandstillAbs THEN //Information "mouvement termine"
gAxeCmd01.MoveAbsolute.Acc := aNom;
gAxeCmd01.MoveAbsolute.Vit := vNom;
gAxeCmd01.MoveAbsolute.Pos := 0;
gAxeCmd01.MoveAbsolute.BpMove := TRUE;
etat := 101;
END_IF
101://Retour en 0
IF gAxeInfo01.StandstillAbs THEN
etat := 20;
END_IF
END_CASE
//Actualisation de la position et de la vitesse courante
Position.x := gAxeInfo01.S_act;
Vitesse.x := gAxeInfo01.V_act;
END_PROGRAM