Here is a detailed explanation of the program for reference:
The program starts by setting a counter value. In this example, the set value is 10. When you press the start button I0.1, the device begins to operate. Once the signal is input through I0.0, the system checks if the current count matches the preset value of 10. If it does, the output point is turned off, and the device stops. The stop button is I0.2.
The step-by-step logic is as follows:
LDSM0.1
MOVB 16#C8, SMB37
HDEF 0,0
MOVD +0, SMD38
HSC0
Explanation of the code:
(1) The high-speed counter HSC0 is initialized. The value 16#C8 indicates that the initial value is set, the preset value is not loaded, the counting direction remains unchanged during operation, and the counter type is incrementing.
(2) The HDEF instruction is used to define the mode of the high-speed counter (HSC0 in mode 0).
(3) The initial value of the counter is set to 0.
(4) The HSC instruction is executed to activate the counter.
LDNM14.0
EUMOVB
16#C8, SMB37
MOVD +0, SMD38
HSC0
Note: When the speed reaches the required value, M14.0 is reset, and the counter returns to its initial value for the next cycle.
LDD HC0, +10
=M14.0
Note: While the counter value is less than 10, M14.0 remains active.
LD I0.1
O Q0.0
AN I0.2
AM M14.0
= Q0.0
Explanation: I0.1 is the start signal, while I0.2 is the stop signal. When the counter reaches 10, the output Q0.0 is turned off, and the device stops. This setup ensures accurate control over the machine's operation based on the counter value. Adss Fiber Optic Cable,adss cable,cable adss,Singlemode Adss Fibre Optics,Adss Fiber Cable Guangzhou Jiqian Fiber Optic Cable Co.,ltd , https://www.jqopticcable.com