7.3 Ülesanne: Massiivi liikmete valimine ja suurendamine
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, kus START nupu vajutusega saab valida, mitmendat 4 liikmelise massiivi (array) liiget suurendama hakatakse ning RESET nupu vajutus suurendab valitud liikme väärtust 1 võrra.
Liikmete valimine peab olema korratav.
Ühe massiivi liikme väärtus ei tohi olla suurendatav üle kasutatava muutuja andmetüübi maksimaalse väärtuse.
Massiiv ei ole seotud ühegi füüsilise väljundiga. Ülesande korrektset täitmist kontrollitakse Login vaates massiivi liikmete väärtusi jälgides.
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.3 Exercise: Selecting an array member and increasing its value
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 where START button selects from 4-member array a member and RESET button increases its value by 1.
The array member selection must be repeatable.
The value of an array member must not be increased over the allowed maximum value. The maximum value is given by the data type used in the array declaration.
The array is not associated with any PLC physical outputs. The correct execution of the program is controlled in Login view by watching the array values.
CoDeSys animation
Animation for virtual PLC "CODESYS Control WIN V3". Download it and solve the exercise on the PC without the real equipment.