Professional Documents
Culture Documents
Microcontroller (LAB3) 2
Microcontroller (LAB3) 2
Laboratory work # 3
Configuration of Modicon M340 controller
Almaty, 2024
Purpose of a laboratory work:
1. Programming using the structured text.
2. Calculation of power consumption table.
3. Ethernet network tuning.
4. Create the visualization of a process.
Objectives:
Obtaining the skills in Modicon M340 controllers configuration and networking
configuration.
Practice tasks
Part 1. Calculation of power consumption of controller.
In first part of laboratory work, I created configuration of the system and calculated
power supply module. Modules that I chose are shown in figure 1.
In 3rd part, I had some practical exercises and tasks for individual job to learn and get
knowledge about program that written Structured Text programming language.
II Example of task solving usage the construction if ... then ... else
Task 1. You need to enable light, when the button is pressed. For solving this
problem use the RE function (setting the Rising Engine).
The program:
status_button:=button; (*overwrite operation to set edge*)
if RE(status_button) then light:=1; (*condition for turning on the indicator*)
else light:=0; (*condition for turning off the indicator*)
end_if;
Task 2.
It is necessary to create a program in which when you press the button plus
"counter value will be increased on 1, when you click on the "minus", the count is
reduced by 1.
Figure 7 – Program of calculating by 1.
Task 3
It is necessary to create two new counters, one counter will have a format
INT (integer),the second the TIME (time). Counters must increase the value to 1 in
the time interval of 1 second by using the system bit% S6.
Task 2. Given two indicators of different colors. After pressing the "START" lights
up the first indicator, the second indicator is activated after 5 seconds. Program this
sequence using the counters. Create the visualization screen in real time.
Task 4. Default value of the variable is 100. When you press the "START"
button starts the reverse counter report, as soon as the variable value reaches
5, the counter stops and the green color is light. Make visualization of the
program.
Figure 13 – Program of reverse counting with turning on green indicator.
Conclusion
In this laboratory work, teams were assigned various tasks written in the ST
(Structured Text) programming language using Unity Pro XL software. The
tasks encompassed configuring settings of controller modules in the simulator,
starting from selecting the processor type to simulating the program's
execution. Additionally, participants learned how to calculate the power
consumption of the system using the Modicon M340 catalog.
Moreover, visualization of the process was developed by simulating the data
variables, enhancing understanding and representation of the system's
operation.