Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Take Siemens PLC as an example, a pressure value, when a switch is closed, how can you remember the pressure at this moment?
Take Siemens PLC as an example, a pressure value, when a switch is closed, how can you remember the pressure at this moment?
If you have a touch screen, or an industrial computer, this problem is very simple.

You can do without it, just a little more trouble. Set the PLC time and read the PLC time. In fact, these things are used back and forth. You should make two fixed FC blocks with parameters (interfaces).

It's hard to describe. But that format is not difficult, I forgot. Because I always forget, I often use a single integer, such as year, month, day, hour, minute and second, as parameters after understanding several common functions FC (with parameters).

Forget it. I'll answer you after watching the show.

The format of DATE_AND_TIME is 8 bytes, and I put it in a temporary variable: LB0-7. MB0-7 can do it, and so can DB blocks. Its definition is like this, or how to obtain data such as year, month and day.

1 year: 1 pound 0

BTI

L 2000

+I

T #CurYear

The highest byte (Siemens is like this, the height goes from left to right, but the address starts from low) LB0, that is, BCD code, is converted into an integer, plus 2000. This is this year.

February: l lb1////month

BTI

T #CurMouth

No.3: l lb 2////day

BTI

T #CurDay

4 weeks: 1 lb 7

Logistics base # 16#F

(Aw) names of people

BTI

L 1

I

T #CurWeek

Stop here, I changed two subprograms, one is to read and write four integers on Thursday, and the other is to read and write four integers in milliseconds. If you write, there are trigger bits and four input plastic variables. Let's open the program and tell the time:

5 o'clock: l lb 3////.

BTI

T # hours

6 points: l lb 4////points

BTI

T #CurMinute

7 seconds: 1lb 5///// sec

BTI

T #CurSecond

Don't take milliseconds. I can't watch it anymore. Of course I can copy. Here's how to get the time. Time is the format of that variable.

Each of these eight bytes has a meaning. The last two LB6 and LB7 represent weeks and milliseconds. But LB7 seems to use these two weeks and milliseconds for the first four digits and the last four digits respectively. I'll get the program:

8 ms: 1 lb 6

BTI

L 10

* Me

T #H_MS

L pound 7

Left W# 16#F0

(Aw) names of people

L 10

/I

L #H_MS

+I

T #CurMS

Cur*** above, Cur means now. Year, month, minute, second, millisecond, no explanation.

Command t is equivalent to MOVE. You can turn MOVE into a command.

Although the instructions are written here, when I call them, I only need to write the parameters (interfaces) on a box, that is, the T-diagram. This program is usually written without moving.

Your question, temporary variables can be defined as date and time, 8 bytes. You said you couldn't send it. It's simple. For example, if you put it in LB0-7, you send it like this:

L LD0

T MD0

L LD4

T MD4

This is not a complete transmission. MB0-7 is your variable.

Of course, you don't need to make this transfer. Temporary variables can be used. You can also subtract.

Do you have any difficulties?

In fact, if you think too much, there is nothing you can't solve.

Let's finish it. By the way, the plan has come out.