Analysis and Application of FOR Loop Statement

Publisher:chinalisaLatest update time:2023-09-25 Source: 易易小事Author: Lemontree Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

F loop statements are widely used and are used in programming. Being able to read these program statements can help you better understand the control principles of electromechanical equipment and bring convenience to the installation of electromechanical equipment.

1. Program Application

The following figure controls the three-phase coil windings to connect and disconnect in sequence by programming the 1st to 6th tubes, generating a rotating magnetic field to drive the motor to rotate. It is difficult for people without programming knowledge to understand the frequency conversion circuit, so it is very important to be able to read the program.

2. FOR statement in robot

In robot language programming, FOR and ENDFOR appear in pairs. FOR indicates the start of a loop, the value specified by FOR indicates the number of loops, and ENDFOR indicates the end of the loop.

1. Grammatical structure

2. Classic Program

3. FOR instruction

1. Classic Program

The execution process of PLC program is divided into 3 steps: 1. Input; 2. Program scanning; 3. Output refresh. In one working cycle, some program segments need to be executed multiple times. At this time, FOR instruction can be used. FOR and NEXT are used in pairs.

3. for statement in C language

1. Sentence structure

Expression 1 assigns an initial value to the loop variable; Boolean expression 2 is the loop condition; expression 3 modifies the value of the loop variable.

2. Classic Program

Reference address:Analysis and Application of FOR Loop Statement

Previous article:Robot Wars: Tesla humanoid robots can do yoga French media: Robots "take over" Hangzhou Asian Games
Next article:What are the methods of moving robot cables?

Latest robot Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号