CoDeSys
Siemens S7-1200 viide Siemens LOGO! viide Automatiseerimise viide Mehhatroonikaseadmete viide Pneumoautomaatika viide
Joonis
Joonis

7.5 Ülesanne: Massiivi liikmete väärtuste suurendamine ja nullimine

Süsteemi „Nuppud ja lambid” kirjeldus

Süsteemus on 3 nuppu (S1 - Start, S2 - Stop, S3 - Reset) ja 3 indikaatorlampi (H1 - roheline, H2 - kollane, H3 - punane).

Ülesande püstitus

Koostada programm ja luua 200 liikmega massiiv (array), kasutades ülesandeks optimaalset andmetüüpi.

START nupu vajutusel peavad kõikide massiivi liikmete numbrilised väärtused suurenema ühe võrra. Kui mõni massiivi liige on saavutanud maksimaalse võimaliku väärtuse, siis ei tohi seda saada edasi suurendada (väärtus peab jääma olenemata START nupu vajutusest samaks).

RESET nupu vajutusel peavad kõikide massiivi liikmete numbrilised väärtused nulli minema.

Massiiv ei ole seotud ühegi füüsilise väljundiga. Ülesande korrektset täitmist kontrollitakse Online vaates massiivi liikmete väärtusi jälgides. Testimiseks on vajalik massiivi liikmetele anda ette suvalised algväärtused vähemalt massiivi esimestele ja viimastele liikmetele. Seejärel programm sisse laadida ja kontroller taaskäivitada.


Soovitatav lugemismaterjal

Ülesande lahendamiseks tutvuda järgmiste peatükkidega.

CoDeSys animatsioon

Alla laetav animatsioon virtuaalsele PLC-le "CODESYS Control WIN V3". See võimaldab testida PLC programmi arvutis ilma reaalse riistvarata.

7.5 Exercise: Increasing and resetting the values of array memebers

Description of the buttons and lights

The MFS stand has three buttons (S1 – Start button, S2 – Stop button, S4 – Reset button) and 3 indicator lights (lamps) (H1 – Green light, H2 – Yellow light, H3 – Red light).

Description of the exercise

Write a program and create there an array consisting of 200 members, by using the optimal data type for the task.

All array member values have to increase by one when pressing the START button. If some array member values have achieved the maximum possible value, then these should not increase further when pressing the START button.

All array member values are set to zero when the RESET button has been pressed.

The array is not related to any physical output. The correct execution of the task can be checked in the Login view by observing the array member values. For testing purposes, it is necessary to add some random values for the array memebers at the beginning and at the end of the array. Then download the program and restart the controller (PLC).


CoDeSys animation

Animation for virtual PLC "CODESYS Control WIN V3". Download it and solve the exercise on the PC without the real equipment.

Creative Commons Licence
"CoDeSys" is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License .