Začínáme v prostředí Mosaic

| Kategorie: Návody k obsluze  | Tento dokument chci!

Vydal: Teco a.s .

Strana 51 z 105







Poznámky redaktora
ZAČÍNÁME PROSTŘEDÍ MOSAIC 51 //Příklad programu: VAR_GLOBAL // inputs SB1 %X0.3 BOOL; // outputs KM1 %Y0.0, SB2 %X0.3 BOOL; END_VAR //------------------------------------------------------------------------ FUNCTION_BLOCK fbStartStop VAR_INPUT start BOOL R_EDGE; stop BOOL R_EDGE; END_VAR VAR_OUTPUT vystup BOOL; END_VAR vystup (vystup start) AND NOT stop; END_FUNCTION_BLOCK //------------------------------------------------------------------------ FUNCTION_BLOCK fbMotor VAR_INPUT motorStart BOOL; motorStop BOOL; END_VAR VAR startStop fbStartStop; motorIsRun BOOL; startingTime TON; END_VAR VAR_OUTPUT star BOOL; triangle BOOL; END_VAR startStop(start motorStart, stop motorStop, vystup motorIsRun); startingTime(IN motorIsRun, TIME#12s, triangle); star NOT triangle; END_FUNCTION_BLOCK //------------------------------------------------------------------------ PROGRAM prgMain VAR motor1 fbMotor; motor2 fbMotor; END_VAR motor1(motorStart SB1, motorStop SB2, star KM1, triangle KM2); motor2( motorStart SB3, motorStop SB4, star KM3, triangle KM4); END_PROGRAM .1, KM3 %Y0.2, KM4 %Y0.0, KM2 %Y0.2, SB4 %X0.1, SB3 %X0