Speak with authority, quality is trustworthy.

PLC of conditional jumps, and subroutine calls instance method on the use of instruction

by:Coolmay     2020-07-10
Conditional jump instruction:

command name, mnemonics, instruction code, the program step in the following table:

step program can be executed sequentially or pulse, CJ execution for step 3, CJ ( P) Step 1.

instruction format:

when we press the X000 program jump instruction is up and running, the location of the program jump for the program to the location of the cursor, namely grade 10, here we must pay attention to the program pointer is written on the left to the left of the bus. When we start after the jump instruction, X001 this procedure will be skipped.

when X0 to ON, not by a jump between CJ command to label program execution. In the process of jump if Y, M, S is OUT, and the SET. RST directive driven make input state before the change is still keep jump. Drives through the X1 output Y10, for example, after the jump, in the process of jump even X0 to ON, but the output Y10 is still valid.

note: 1. For T/C, if jump when the timer or counter movement is going on, then immediately at this time or stop the timer interrupt count, until after the jump to continue timer or counter. But is the action of timer T192 C235 ~ ~ T199 and high-speed counter C255. With or without jump is still maintaining a job.

2。 Functional instruction does not perform when to jump, but PLSY, PLSR, except PWW orders.

subroutine call and return instructions:

command name, mnemonics, instruction code, the program step in the following table:

instruction format:

diagram FEND said the end of the main program, give priority to program we call, in front of the FEND behind FEND we called subroutines. SRET said end of the subroutine, or return to birdcall program. We should pay attention to, between FEND and SRET program, we call the first subroutine, we called the second before the second SRET subroutine. When we press the X001 pointer call to the P11, program starts from the P11 this place from the start, when encounter the first SRET application and return to the main program, but in this program if X002 is switched on, the program pointer call to P12, program begins to run from top to bottom, when met the second SRET application returns to the P12 this place, and then against the first SRET, returns to the main program. Because P12 - this program is embedded in a P11 this program, so we should pay attention to, this kind of program in PLC controller nested can be used for a maximum of 5 levels. Interrupt instruction:

interrupt instruction has a total of 3, we use a table to specify:

instruction format:

FEND here in front of the main program, FEND back to interrupt subroutine, can interrupt subroutine in and interrupt condition related to interrupt a pointer, so here we have to interrupt to you talk about the format of the pointer: interrupt pointer:

timer interrupt:

application example:

we'll introduce you to the program: FEND program says the Lord, in front of the back of the said interrupt subroutine, EI said allowing interruption, IRET said the interrupt return instructions, I610 pointer, said interruption time is 10 mm, 6 said the highest level of interruption. 。

when we press the X000 K1 data to be transmitted into D1, K255 data to be transmitted in D2, M1 is setting on, interrupt subroutine. Said the RAMP slope, said to create a data D3, from D1 to D2 and D3 range is from 1 to 255, because this is a timing interruption program, when the M1 through every 10 ms interrupt program, K1000 said 1000 scan cycle, because D3 range from 1 to 255, as it needs time to 1000 to 10 ms, that is to say from X0 connected to D3 into 255 time of 1000 x10ms = 10 seconds, when D3 is equal to 255 M8029 switched on, the M1 are reset disconnect, then interrupt instructions with the slope be disconnected. And then met IRET instruction to return.


plc manufacturers has become a standardized way of dealing with programmable control systems.
plc controller price are the in thing today. To buy a for yourself do visit Shenzhen Coolmay Technology Co., Ltd. at Coolmay PLC.
Coolmay provides a number of programmable control systems designed to handle plc controller price.
Chat Online
Chat Online
Chat Online inputting...
Sign in with: