Bộ điếm / Counter

The programmers of the FX family also have internal counters that you can use for programming counting operation.
Bộ lập trình PLC có những bộ điếm bên trong mà bạn có thể lập trình để điếm.

Counters count signal pulses that are applied to their inputs by the program. The counter output is swithed on when the current counter value reaches the setpoint value defined by the program. Like timers, counter outputs can also be polled as often as you like in the program
Bộ điếm điếm những xung tín hiệu mà được đưa đến ngỏ vào bời chương trình. Ngỏ ra bộ điếm chuyển sang ON khi giá trị bộ điếm tiến tới giá trị cài đặt bở chương trình.

chương trình bộ điếm
chương trình bộ điếm
chương trình bộ điếm
chương trình bộ điếm

Bộ điếm 16 bit / 16 bit counter

– Setpoint range : 1 to 32767
-Counter overflow behavior: Counts to a maximum of 32767, after which the counter no longer changes. ( Điếm tối đa 32767, sau đó thì bộ điếm không thay đổi nữa. )
– Reseting: an RST instruction is used to delete the curent value of the counter and turn off its output
( dùng lệnh RST để xoá giá trị bộ điếm )
-Count direction ( hướng điếm ) : Incrementing ( tăng )
(
LD X0
OUT C0 K999

)

Chú ý: Để Count direction ( hướng điếm ) : Decrementing ( Giảm ) thì ta dùng lệnh DEC

LDP M10
DEC C0
LDP X1
DEC C0

Bộ điếm 16 bit điếm giảm
Bộ điếm 16 bit điếm giảm
counter 16 bit
counter 16 bit

Bộ điếm 32 bit / 32 bit counter

Setpoint range : -2 147 483 648 to 2 147 483 647
-Counter overflow behavior: Ring counter. Counts to a maximum of 2 147 483 647, after which the the next incrementing value is -2 147 483 648. ( Điếm tối đa 2 147 483 647, sau đó giá trị điếm kế tiếp là – 2 147 483 648. )
– Reseting: an RST instruction is used to delete the curent value of the counter and turn off its output
– Count direction ( hướng điếm ) : Incrementing ( tăng ) and decrementing ( giảm )
( the direction is specified by switching a special relay on or off )

M8xxx; xxx là số bộ điếm tương ứng, (M8200 to M8234 , C200 to C234).
Ví dụ: M8200, 200: bộ điếm C200
Khi M8xxx is ON hay có giá trị 1  thì điếm xuống ( count down )
Khi M8xxx is OFF hay có giá trị 0  thì điếm lên ( count up )

Sơ đồ dây cảm biến 2 dây

Cảm biến E2E-X2D1-N: ngỏ ra 2 dây NO, nguồn cấp 12-24 VDC

Nguồn: longhan.com.vn

Bộ điếm counter 32 bit FX1N YKHMI
Bộ điếm counter 32 bit FX1N YKHMI

Tổng quan bộ điếm PLC

Bộ điếm PLC FX
Bộ điếm PLC FX

(1) The counter values of retentive counters are retain when the power is switched off.
Giá trị bộ điếm được lưu lại khi mất điện.

(2) You can set the PLC parameters to configure whether the current values of these counters should be retained when the power supply is switched off.
Có thể thiết lập thông số PLC để giá trị hiện thời của bộ điếm được lưu lại khi mất điện.

Bộ điếm tốc độ cao high speed counter PLC FX1S FX1N

Basic high speed counter operation / Bộ điếm tốc độ cao

ALthough counters C235 to C255 ( 21 points) are all high speed counters, they share the same range of high speed inputs. Therefore, if an input is already being used by a high speed counter, it can not be used for any other high speed counters or for any other purpose, i.e as an interrupt.
The selection of high speed counters are not free, they are directly dependent on the type of counter required and which inputs are available.

Bộ điếm C235 đến C255 là những bộ điếm tốc độ cao, chúng cùng chia sẽ những ngỏ vào tốc độ cao. Bởi vậy, nếu 1 ngỏ vào đã được sử dụng bởi 1 bộ điếm tốc độ cao, nó không thể được dùng bởi bộ điếm khác hoặc cho mục đích khác. Lựa chọn bộ điếm tốc độ cao thì không tự do, chúng phụ thuộc trực tiếp vào kiểu bộ điếm và ngỏ vào có sẵn.
Available counter types;

a) 1 phase with user start/reset: C235 to C240
b) 1 phase with assigned start/reset: C241 to C245
c) 2 phase bi-directional: C246 to C250
d) A/B type: C251 to C255
Nguồn: program_manual_FX1S_2N

High speed counters operate by the principle of interrupts. This means they are events triggerd and independent of cycle time. The coil of the selected counter should be driven continously to indicate that this counter and its asociated inputs are reserved and that other high speed processes must not coincide wwith them

Bộ điếm tốc độ cao hoạt động bởi nguyên tắc ngắt.  Điều này có nghĩa rằng chúng là các sự kiện được ghi nhận và độc lập với chu kỳ quét của PLC. Bộ điếm được lựa chọn phải được điều khiển liên tục và các ngỏ vào liên kết với bộ điếm này phải được giữ nguyên và không được sử dụng bởi bộ điếm tốc độ cao khác.

Example / Ví dụ

Bộ điếm tốc độ cao
Bộ điếm tốc độ cao

When X20 is ON, high speed counter C235 is selected. The counter C235 coresponds to count input X0. X20 is NOT the counted signal. This is the continous drive mentioned earlier. X0 does not have to be included in the program. The input assignment is hardware related and cannot be changed by the user.

Khi X20 ON thì bộ điếm C235 được lựa chọn. C235 có ngỏ vào điếm là X0.
X20 không phải là tín hiệu điếm. Đây là tín hiệu điều khiển. X0 không có trong chương trình PLC. Gán ngỏ vào X0 được thực hiện trong phần cứng và không thể thay đổi bởi người dùng.

When X20 is OFF, coil C235 is turned OFF and coil C236 is turned ON. Counter C236 has an assigned input of X1, again the input X20 is NOT the counted input.
The assignment of counters and input devices is dependent upon the PLC selected. This is explained in the relevant, later sections

Khi X20 OFF, bộ điếm C235 bị tắt, bộ điếm C236 được lựa chọn. C236 có ngỏ vào điếm là X1.
X20 không phải là tín hiệu điếm. Đây là tín hiệu điều khiển. X1 không có trong chương trình PLC. Gán ngỏ vào X1 được thực hiện trong phần cứng và không thể thay đổi bởi người dùng.

Driving high speed counter coils:

Điều khiển bộ điếm tốc độ cao
Điều khiển bộ điếm tốc độ cao

The counted inputs are NOT used to drive the high speed counter coils. This is because the counter coils need to be continously driven ON to reserve the associated high speed inputs.
Therefore, a normal non high speed drive contact should be used to drive the high speed counter coil. Ideally the special auxilary contact M8000 should be used. However, this is not compulsory.

Ngỏ vào điếm hay tín hiệu điếm không được dùng để điều khiển bộ điếm tốc độ cao. Bởi vì bộ điếm tốc độ cao cần được điều khiển liên tục ON để ghi nhận ngỏ vào tốc độ cao. Bởi vậy, tiếp điểm bình thường được dùng. Lý tưởng là dùng tiếp điểm đặc biệt ( always ON ) M8000. Tuy nhiên, điều này không phải bắt buộc


LD M8000
OUT C235 K4789
LD M8000
OUT C236 D4

Danh sách bộ điếm tốc độ cao / Table

All counters are latched (EEPROM – backup up). Tất cả bộ điếm được lưu dữ liệu khi mất điện.

Chú ý: Có thể sử dụng đồng thời các loại bộ đếm khác nhau nhưng đầu vào của chúng không được trùng nhau. Đầu vào X0 đến X3 không thể được sử dụng cho nhiều hơn một bộ đếm.

Ví dụ: nếu C251 là đã sử dụng các bộ đếm và các lệnh sau đây không thể được sử dụng; C235, C236, C241, C244,  C247, C249, C252, C254, I0xx , I1xx

Màn hình tích hợp PLC FX1N, FX1S: 
Ngỏ vào X0, X1: 100 Khz

BÀI VIẾT LIÊN QUAN:
1. PLC FX1S
2. PLC FX1N

1 Phase Counters – User Start and Reset (C235 – C240)

Những bộ điếm này chỉ dùng 1 ngỏ vào.
Khi M8235 ON, C235 điếm xuống. Khi M8235 OFF, C235 điếm lên.

These counters only use one input each. When direction flag M8235 is ON, counter C235 counts down. When it is OFF, C235 counts up. When X11 is ON, C235 resets to 0 (zero). All contacts of the counter C235 are also reset. When X12 is ON, C235 is selected. From the
previous counter tables, the corresponding counted input for C235 is X0. C235 therefore
counts the number of times X0 switches from OFF to ON.
All of these counters are 32bit up/down ring counters.

1 Phase Counters - User Start and Reset (C235 - C240)
1 Phase Counters – User Start and Reset (C235 – C240)

Setting range: -2,147,483,648 to +2,147,483,647

Direction setting:

The counting direction for 1 phase counters is dependent on their corresponding flag
M8xxx; where xxx is the number of the corresponding counter, (C235 to C240).
When M8xxx is ON the counter counts down,
When M8xxx is OFF the counter counts up

M8xxx; xxx là số bộ điếm tương ứng, (M235 to M240 tương ứng C235 to C240).
Ví dụ: M8235, 235: bộ điếm C235
Khi M8xxx is ON hay có giá trị 1  thì điếm xuống
Khi M8xxx is OFF hay có giá trị 0  thì điếm lên

Using the SPD instruction

SPD S1 S2 D
S1: X0 to X5
S2: K, H,Knx, KnY, T,C,D,Z
D: T,C,D,Z

Function: detect the number of ‘encoder’ pulses in a given time frame. Results can be used to calculate speed.
Chức năng: phát hiện số xung encoder trong 1 khoảng thời gian trước. Kết quả dùng để tính toán tốc độ.

Care should be taken when using the SPD applied instruction. This instruction has both high speed counter and interrupt characteristics, therefore input devices X0 through X5 may be used as the source device for the SPD instruction. In common with all high speed processes the selected source device of the SPD instruction must not coincide with any other high speed function which is operating, i.e high speed counters or interupts using the same input.

Cẩn thận khi sử dụng lệnh SPD. Lệnh này có cả bộ điếm tốc độ cao và đặc tính ngắt, bởi vậy ngỏ vào X0 đến X5 có thể được dùng cho lệnh SPD. Giống như tất cả các quy trình tốc độ cao, thiết bị nguồn được chọn của lệnh SPD không được trùng với bất kỳ chức năng tốc độ cao nào khác đang hoạt động, tức là bộ đếm tốc độ cao hoặc ngắt sử dụng cùng một đầu vào.

When the SPD instruction is used it is considered by the system to be a 1 phase high speed counter. This should be taken into account when summing the maximum combined input signal frequencies.

Khi lệnh SPD được sử dụng, hệ thống coi lệnh này là bộ đếm tốc độ cao 1 pha. Điều này cần được tính đến khi tính tổng các tần số tín hiệu đầu vào kết hợp tối đa.

1 Phase Counters – Assigned Start and Reset (C241 to C245)

These counters have one countable input and 1 reset input each. Counters C244 and C245 also have a start input. When the direction flag M8245 is ON, C245 counts down. When it is OFF C245 will count up

M8xxx; where xxx is the number of the corresponding counter, ( M8241 to M8245 , C241 to C245 ).
When M8xxx is ON the counter counts down,
When M8xxx is OFF the counter counts up

Những bộ điếm này có 1 ngỏ vào điếm và 1 ngỏ vào reset
M8245 ON: C245 điếm xuống. 
M8245 OFF: C245 điếm lên

Setting range: -2,147,483,648 to +2,147,483,647. 

2 Phase Bi-directional Counters (C246 to C250)

These counters have one input for counting up and one input for counting down. Certain
counters also have reset and start inputs as well
Những bộ điếm này có 1 ngỏ vào cho điếm lên và 1 ngỏ vào cho điếm xuống.


0 0 votes
Đánh giá bài viết
Đăng ký
Thông báo
guest
0 Góp ý
Cũ nhất
Mới nhất like nhiều nhất
Inline Feedbacks
View all comments