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

Juhtpaneeli kirjeldus

Juhtpaneelil on 3 nuppu (S1 - Start, S2 - Stop, S4 - Reset), üks võtmega lüliti (S3 - Auto/Man) ja 4 indikaatorlampi (H1, H2, H3, H4).

Ü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.

7.5 Exercise: Increasing and resetting the values of array members

Description of the control panel

The control panel has three buttons (S1 – Start button, S2 – Stop button, S4 – Reset button), one key switch (S3 – Auto/Man (in normal state, it is on Auto)) and 4 indicator lights (lamps) (H1 – Start light, H2 – Reset light, H3 – Light Q1, H4 – Light Q2).

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 members at the beginning and at the end of the array. Then download the program and restart the controller (PLC).

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