Você está na página 1de 2

Siemens - Industry Automation and Drive Technologies - Service& Support - Automation...

Page 1 of 2
show the entry list Time-controlled interrupts with the S7-22x QUESTION: How do I program a time-controlled interrupt for the S7-22x? ANSWER: The following CPUs can process a time-controlled interrupt: Interrupt Number of time-controlled interrupts supported Number of the interrupt Number of the possible interrupt programs CPU221 2 0 and 1 INT 0 to 127 CPU222 2 0 and 1 INT 0 to 127 CPU224 2 0 and 1 INT 0 to 127 CPU226 2 0 and 1 INT 0 to 127 CPU226XM 2 0 and 1 INT 0 to 127

The S7-200 supports one or more time-controlled interrupts. You can use a time-controlled interrupt to define actions that are to be executed in cycles. The cycle time is defined in steps of 1 ms. The area is between 1 ms (1) and 255 ms (255). You write the cycle time for the Interrupt 0 in the special flag byte SMB34, and you write the cycle time for the time-controlled Interrupt 1 in SMB35. The time-controlled interrupt event calls the corresponding interrupt program each time the time runs out. Using time-controlled interrupts you generally control the regular querying of the analog inputs. A time-controlled interrupt is enabled and the time begins to run when you assign an interrupt program to a time-controlled interrupt event. In the example this is done uniquely in the start-up subroutine "SBR 0". The system determines the cycle time so that subsequent modifications do not affect the cycle time. If you wish to modify the cycle time, you must specify a new value for the cycle time and then reassign the interrupt program to the time-controlled interrupt. When you reassign, the function deletes the accumulated time value of the previous assignment and the time begins to run with the new value. What does the command do? Main program Network 1 Unique assignment of event to the number of the interrupt program by querying the flag that is ONLY in the first cycle "1" Call the subroutine "0" in the first cycle End of main program Start subroutine "0" Using the "system flag SM 0.1 that assigns a fixed 1", set the interval for the time-controlled section to 100 * 1ms = 100 ms Enable all interrupts Assign time-controlled interrupt "0" to the interrupt program "0" LD SM 0.1 SM 0.1 Command Operand Example of operand

CALL MEND SBR LD MOVB

0 SM 0.1 100,SMB 34

ENI ATCH INT,EVENT INT= Number of the 0,10

http://support.automation.siemens.com/WW/llisapi.dll/8803785?func=ll&objId=8803785... 10.09.2010

Siemens - Industry Automation and Drive Technologies - Service& Support - Automation... Page 2 of 2

interrupt program EVENT= Number of the interrupt event Terminate subroutine Start interrupt program Now you can write the program that you want to process every 100 ms Terminate the interrupt program Notes:
l

RET INT ....... 0 .... ....

RETI

Interrupts are processed by the CPU in the order of their occurrence and according to their priority status. There can only ever be one program active for interrupt processing. If an interrupt program is being processed then that program is terminated first. It cannot be interrupted by a subsequently occurring interrupt program, not even if this has a higher priority. If an interrupt occurs while another interrupt is being processed, then the later interrupt is put into a queue for processing later. A maximum number of 8 interrupts can be put into the timed interrupt queue. It might happen that more interrupts occur than can be entered in the queue. In this case the system has queue overflow flags that specify the type of interrupt events that could not be included in the queue. The table shows the special flags that are set when there is queue overflow. You may only use these bits, SM 4.0 to 4.2, in an interrupt program, because they will be reset when the queue has been processed and main program processing continues. Special flag SM 4.0 SM 4.1 SM 4.2

Queue Queue overflow for communications interrupts Queue overflow for I/O interrupts Queue overflow for time-controlled interrupts

You will find more information in the S7-22x System Manual under Entry ID 1109582. Keywords: program configuration Entry ID:8803785 Date:2001-09-25 I regard this article.... Copy link
Print Siemens AG 2010 - Corporate Information - Privacy Policy - Terms of Use

as helpful

as not helpful Send to a friend

Suggestion for the entry

http://support.automation.siemens.com/WW/llisapi.dll/8803785?func=ll&objId=8803785... 10.09.2010

Você também pode gostar