You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old December 1st, 2003, 07:51 AM   #1
Preeya
Member
United States

Preeya is offline
 
Preeya's Avatar
 
Join Date: Nov 2003
Posts: 112
Question Questions abt Siemens S7 200

I am new to Siemens S7 200, is there a way to test programs offline without a PLC. Does the 'force' work only with the PLC?

Also can anyone give me some information on the use of timed interrupts? I notice that S7 has only 2 timers of ms timebase. I need to open and close a valve in milliseconds and need more timers in ms.
  Reply With Quote
Old April 9th, 2007, 05:23 AM   #2
moazzim
Member
Pakistan

moazzim is offline
 
Join Date: Apr 2007
Location: Dera Ghazi Khan
Posts: 16
i think u read special memories from help i am not sure but smb28 can solve your problme in term of timers
  Reply With Quote
Old April 9th, 2007, 07:39 AM   #3
504bloke
Lifetime Supporting Member + Moderator
England

504bloke is offline
 
504bloke's Avatar
 
Join Date: Jan 2005
Location: West Ssx
Posts: 2,635
From the Help in MicroWin

Quote:
Interrupts are event driven. Before an interrupt routine can be invoked, an association must be established between the interrupt event and the program segment that you want to execute when the event occurs. Use the Attach Interrupt instruction (ATCH) to associate an interrupt event (specified by the interrupt event number ) and the program segment (specified by an interrupt routine number). When you attach an interrupt event to an interrupt routine, that interrupt is automatically enabled.
If you disable all interrupts using the global disable interrupt instruction, each occurrence of the interrupt event is queued until interrupts are re-enabled, using the global enable interrupt instruction.
You can disable individual interrupt events by breaking the association between the interrupt event and interrupt routine with the Detach Interrupt instruction (DTCH). The Detach instruction returns the interrupt to an inactive or ignored state.
Understanding How the S7-200 Processes Interrupt Routines
The interrupt routine is executed in response to an associated internal or external event. Once the last instruction of the interrupt routine has been executed, control is returned to the main program. You can exit the routine by executing a Conditional Return from Interrupt instruction (CRETI).
Guidelines and Restrictions for Using Interrupt Routines
Interrupt processing provides quick reaction to special internal or external events. You should optimize interrupt routines to perform a specific task, and then return control to the main program.
By keeping the interrupt routines short and to the point, execution is quick and other processes are not deferred for long periods of time. If this is not done, unexpected conditions can cause abnormal operation of equipment controlled by the main program.
Restrictions
You cannot use the DISI, ENI, HDEF, LSCR, and END instructions in an interrupt routine.
System Support for Interrupts
Because contact, coil, and accumulator logic may be affected by interrupts, the system saves and reloads the logic stack, accumulator registers, and the special memory bits (SM) that indicate the status of accumulator and instruction operations. This avoids disruption to the main user program caused by branching to and from an interrupt routine.
Sharing Data Between the Main Program and Interrupt Routines
You can share data between the main program and one or more interrupt routines. Because it is not possible to predict when the S7-200 might generate an interrupt, it is desirable to limit the number of variables that are used by both the interrupt routine and elsewhere in the program. Problems with the consistency of shared data can result due to the actions of interrupt routines when the execution of instructions in your main program is interrupted by interrupt events. Use the local variable table of the interrupt routine to ensure that your interrupt routine uses only the temporary memory and does not overwrite data used somewhere else in your program.
There are a number of programming techniques you can use to ensure that data is correctly shared between your main program and interrupt routines. These techniques either restrict the way access is made to shared memory locations or prevent interruption of instruction sequences using shared memory locations.
For an STL program that is sharing a single variable: If the shared data is a single byte, word, or double word variable and your program is written in STL, then correct shared access can be ensured by storing the intermediate values from operations on shared data only in non-shared memory locations or accumulators.
For a LAD program that is sharing a single variable: If the shared data is a single byte, word, or double word variable and your program is written in LAD, then correct shared access can be ensured by establishing the convention that access to shared memory locations be made using only Move instructions (MOVB, MOVW, MOVD, MOVR). While many LAD instructions are composed of interruptible sequences of STL instructions, these Move instructions are composed of a single STL instruction whose execution cannot be affected by interrupt events.
For an STL or LAD program that is sharing multiple variables: If the shared data is composed of a number of related bytes, words, or double words, then the interrupt disable/enable instructions (DISI and ENI) can be used to control interrupt routine execution. At the point in your main program where operations on shared memory locations are to begin, disable the interrupts. Once all actions affecting the shared locations are complete, re-enable the interrupts. During the time that interrupts are disabled, interrupt routines cannot be executed and therefore cannot access shared memory locations; however, this approach can result in delayed response to interrupt events.
Calling Subroutines from Interrupt Routines
You can call one nesting level of subroutines from an interrupt routine. The accumulators and the logic stack are shared between an interrupt routine and a subroutine that is called.
Types of Interrupts Supported by the S7-200
The S7-200 supports the following types of interrupt routines:
Communication port interrupts: The S7-200 generates events that allow your program to control the communications port.
I/O interrupts: The S7-200 generates events for different changes of state for various I/O. These events allow your program to respond to the high-speed counters, the pulse outputs, or to rising or falling states of the inputs.
Time-based interrupts: The S7-200 generates events that allow your program to react at specific intervals.
Communication Port Interrupts
The serial communications port of the S7-200 can be controlled by your program. This mode of operating the communications port is called Freeport mode. In Freeport mode, your program defines the baud rate, bits per character, parity, and protocol. The Receive and Transmit interrupts are available to facilitate your program-controlled communications. Refer to the Transmit and Receive instructions for more information.
I/O Interrupts
I/O interrupts include rising/falling edge interrupts, high-speed counter interrupts, and pulse train output interrupts. The S7-200 can generate an interrupt on rising and/or falling edges of an input (either I0.0, I0.1, I0.2, or I0.3). The rising edge and the falling edge events can be captured for each of these input points. These rising/falling edge events can be used to signify a condition that must receive immediate attention when the event happens.
The high-speed counter interrupts allow you to respond to conditions such as the current value reaching the preset value, a change in counting direction that might correspond to a reversal in the direction in which a shaft is turning, or an external reset of the counter. Each of these high-speed counter events allows action to be taken in real time in response to high-speed events that cannot be controlled at programmable logic controller scan speeds.
The pulse train output interrupts provide immediate notification of completion of outputting the prescribed number of pulses. A typical use of pulse train outputs is stepper motor control.
You can enable each of the above interrupts by attaching an interrupt routine to the related I/O event.
Time-Based Interrupts
Time-based interrupts include timed interrupts and the timer T32/T96 interrupts. You can specify actions to be taken on a cyclic basis using a timed interrupt. The cycle time is set in 1-ms increments from 1 ms to 255 ms. You must write the cycle time in SMB34 for timed interrupt 0, and in SMB35 for timed interrupt 1.
The timed interrupt event transfers control to the appropriate interrupt routine each time the timer expires. Typically, you use timed interrupts to control the sampling of analog inputs or to execute a PID loop at regular intervals.
A timed interrupt is enabled and timing begins when you attach an interrupt routine to a timed interrupt event. During the attachment, the system captures the cycle time value, so subsequent changes to SMB34 and SMB35 do not affect the cycle time. To change the cycle time, you must modify the cycle time value, and then re-attach the interrupt routine to the timed interrupt event. When the re-attachment occurs, the timed interrupt function clears any accumulated time from the previous attachment and begins timing with the new value.
After being enabled, the timed interrupt runs continuously, executing the attached interrupt routine on each expiration of the specified time interval. If you exit the RUN mode or detach the timed interrupt, the timed interrupt is disabled. If the global disable interrupt instruction is executed, timed interrupts continue to occur. Each occurrence of the timed interrupt is queued (until either interrupts are enabled or the queue is full).
The timer T32/T96 interrupts allow timely response to the completion of a specified time interval. These interrupts are only supported for the 1-ms resolution on-delay (TON) and off-delay (TOF) timers T32 and T96. The T32 and T96 timers otherwise behave normally. Once the interrupt is enabled, the attached interrupt routine is executed when the active timer's current value becomes equal to the preset time value during the normal 1-ms timer update performed in the S7-200. You enable these interrupts by attaching an interrupt routine to the T32/T96 interrupt events.
__________________
Regards

Dave



"When you are courting a nice girl an hour seems like a second. When you sit on a red-hot cinder a second seems like an hour. That's relativity."
Albert Einstein (1879-1955)
  Reply With Quote
Old April 9th, 2007, 07:39 AM   #4
504bloke
Lifetime Supporting Member + Moderator
England

504bloke is offline
 
504bloke's Avatar
 
Join Date: Jan 2005
Location: West Ssx
Posts: 2,635
Further

Quote:
Interrupt Priority and Queuing
Interrupts are serviced by the S7-200 on a first-come-first-served basis within their respective priority group. Only one user-interrupt routine is ever being executed at any point in time. Once the execution of an interrupt routine begins, the routine is executed to completion. It cannot be pre-empted by another interrupt routine, even by a higher priority routine. Interrupts that occur while another interrupt is being processed are queued for later processing.
Maximum Number of Entries per Interrupt Queue
Queue CPU 221, CPU 222
CPU 224 CPU 224 XP
CPU 226 and CPU 226XM
Communications queue 4 8
I/O Interrupt queue 16 16
Timed Interrupt queue 8 8
Potentially, more interrupts can occur than the queue can hold. Therefore, queue overflow memory bits (identifying the type of interrupt events that have been lost) are maintained by the system. The table below shows the interrupt queue overflow bits. You should use these bits only in an interrupt routine because they are reset when the queue is emptied, and control is returned to the main program.

Interrupt Queue Overflow Bits
Description (0 = No Overflow, 1 = Overflow) SM Bit
Communications queue SM4.0
I/O Interrupt queue SM4.1
Timed Interrupt queue SM4.2
To create an interrupt routine, use one of the following methods:
From the Edit menu, choose Insert>Interrupt
From the Instruction Tree, right click on the Program Block icon and select Insert>Interrupt from the popup menu
From the Program Editor window, right-click and select Insert>Interrupt from the popup menu
The Program Editor changes from the display of the previous POU to the new interrupt routine. A new tab appears at the bottom of the Program Editor, identifying the new interrupt routine.
You can have a total of 128 interrupts in a program. Interrupts are serviced by the PLC on a first-come-first-served basis within their respective priority assignments. Only one user-interrupt routine is ever being executed at any point in time. Once the execution of an interrupt routine begins, the routine is executed to completion. It cannot be pre-empted by another interrupt routine, even by a higher priority routine. Interrupts that occur while another interrupt is being processed are queued for later processing.
Note:
The unconditional POU termination instructions (END for the main program, RET for SBR, and RETI for INT) are automatically inserted by the editors.
Quote:
Special Memory Bytes 34 and 35 control the time interval of interrupts 0 and 1. You can specify the time interval (in 1-ms increments) from 1 ms to 255 ms**. The time-interval value is captured by the CPU at the time that the corresponding timed interrupt event is attached to an interrupt routine. To change the time interval, you must reattach the timed interrupt event to the same interrupt routine or to a different interrupt routine. You can terminate the timed interrupt event by detaching the event.
S7-200
Symbol Name SM
Addr. Timed Interrupt Interval in milliseconds
Time_0_Intrvl SMB34 Timed Interrupt 0: Time interval value (in 1 ms increments from 1 ms to 255 ms**).
Time_1_Intrvl SMB35 Timed Interrupt 1: Time interval value (in 1 ms increments from 1 ms to 255 ms**).
**For the 21x Series, the time interval (in 1 ms increments) is from 5 ms to 255 ms
__________________
Regards

Dave



"When you are courting a nice girl an hour seems like a second. When you sit on a red-hot cinder a second seems like an hour. That's relativity."
Albert Einstein (1879-1955)

Last edited by 504bloke; April 9th, 2007 at 07:51 AM.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Any display with Siemens S7 200?? Preeya LIVE PLC Questions And Answers 6 January 14th, 2007 05:10 AM
siemens s7 200 Crunky LIVE PLC Questions And Answers 4 February 22nd, 2005 09:47 AM
Siemens S7 Timer Questions GTX LIVE PLC Questions And Answers 6 April 30th, 2004 09:55 AM
s7 200 master - slave Farid LIVE PLC Questions And Answers 1 March 14th, 2004 11:09 PM
Siemens S7 200 - Math question Preeya LIVE PLC Questions And Answers 1 December 16th, 2003 09:35 PM


All times are GMT -5. The time now is 01:38 AM.


.