I have recently been familiar with the Delphi language, and from the current job recruitment situation, Delphi looks a little inferior to some development tools, especially after Borland was acquired by Oracle, it seems that Delphi is destined to be forgotten by the world. At the same time, people on major forums and BBS have too many prejudices about Delphi. Most people look down on simple languages such as Delphi and VB, orProgramLack of difficult language or development tools.
However, it seems that these are the opinions of Real programmers, rather than those of everyone. Most programmers do not actually know the native language of Delphi-Pascal-and there is a very special application: that is, as an internationally used PLCProgramming LanguageYes.
In the field of automatic control, there are several languages that are used in a variety of ways. The most common ones are lad, STL, and FBD. In addition to these commonly used languages, there is also a commonly used language, that is, the SCL. What language is the SCL language? Structured Text programming.
The SCL language is more complex for some complex operations, especially mathematical operations. The programming complexity of this language is much simpler than that of LAD, STL, and FBD. Let's take a look at the PASCAL language application used in the automation field. Let's take the Siemens PLC as an example to make a simple comparison and implement a simple control language for the forward and backward motor.
First, let's look at a defined function block: FC
STL language:
Step 1 Define data interfaces
In data interface:
Estop bool // stop i0.0 urgently
Power bool // Control Power Supply i0.1
Startdir bool // start i0.2
Startrev bool // reverse start i0.2
Stop bool // stop i0.3
Test bool // Test Lamp i0.4
Out interface area:
Rundir bool // start q0.0
Runrev bool // reverse start q0.1
Runninglamp bool // run indicator q0.2
Step 2: implement the Program:
Net1: Forward Control
A estop
A power
An startrev
A
A (
O startdir
O rundir
)
= Rundoir
Net2: Reverse Control
A estop
A power
An startdir
A stop
A (
O startrev
O runrev
)
= Runrev
Net3: indicator light
O rundir
O runrev
O Test
= Runninglamp
The above section is a common implementation that automation personnel may use. Let's see how Pascal implements it.
Function "motorstart"
Title
Version
Var_input
Estop: bool;
Power: bool;
Startdir: bool;
Startrev: booll;
Stop: bool;
Test: bool;
End_var
Var_output
Rundir: bool;
Runrev: bool;
Runlamp: bool;
End_var
Var_temp
Dirtemp: bool;
Revtemp: bool;
End_temp
Begin:
// Forward
If estop = true and power = true and stop = true and startdir = true then
Dirtemp: = true;
Else
Dirtemp: = false;
End_if
If dirtemp = true and startrev = false then
Rundir: = true;
End_if;
// Reverse
If estop = true and power = true and stop = true and startrev = true then
Revtemp: = true;
Else
Revtemp: = true;
End_if
If revtemp and startdir = false then
Runrev: = true;
End_if;
// Indicator light
If rundir = true or runrev = true or test = true then
Runninglamp: = true;
End_if
End_function
The above SCL section does not seem to be simpler or easier than the STL language. Instead, it looks very complicated. Of course, if you do a logic operation, the SCL is actually not simpler than other languages. However, if the cycle and the mathematical operation are performed, it would be much easier to use the SCL.
I will not talk about it here. I will have the opportunity to discuss other applications in the future.
I just want to express my opinion. In fact, if you write Windows applications for Delphi applications, it should be no different from the C/C ++ components in Microsoft Visual Studio. If there is a certain gap, that is, no one has ever written an operating system with Pascal, and the mainstream operating systems are all implemented in C language. At this point, people may think that Pascal is inferior to C language, the person who learns C is a good guy, but the person who learns Pascal is not very good.CodeI mean writing code. The key is to look at the application. It is most important to select a proper development tool for different applications.
You can bend down and look for bricks ........................