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 March 10th, 2005, 04:10 AM   #1
windy
Guest
 
Posts: n/a
Siemens Step-7 Newbie

Hi, a newbie to siemens step-7 who has no training at all.
Currently have a few questions regrading programming,
1) what is the step-7 equivilent of rslogic500's OSR,first scan pulse,? how do i add it to my rung?

2)how do i change the timers/counter's timebase? its stated in the help file as a 16bit word but i do not know how to change/edit that value.

3) how do i assess the timer's done status as opposed to rslogic500 timer/dn and timer/en bit??

many thanks in adv!!!
  Reply With Quote
Old March 10th, 2005, 05:11 AM   #2
SimonGoldsworthy
Member
United Kingdom

SimonGoldsworthy is offline
 
SimonGoldsworthy's Avatar
 
Join Date: Mar 2005
Location: England
Posts: 1,079
Assuming S7 300/400 processors:

During start up, OB100 runs on a cold restart, OB101 runs on a warm restart. Any initialisation can be done inside these blocks.
If you want to detect the first scan of OB1, then you have to use a flag bit and generate the first scan logic yourself.

Timer times use the format w#16#BHTU
where B=time base, 0=0.01s, 1=0.1s, 2=1s, 3=10s
H=hundreds, T=Tens, U=Units
e.g. w#16#2500 = 500second timer.

Timer status is checked using the timer number as if it was any other logic variable e.g. "A T13"
  Reply With Quote
Old March 10th, 2005, 05:51 AM   #3
RMA
Member
Scotland

RMA is offline
 
RMA's Avatar
 
Join Date: Sep 2004
Location: North of Hamburg, Germany
Posts: 2,046
Red face

Quote:

Timer times use the format w#16#BHTU
where B=time base, 0=0.01s, 1=0.1s, 2=1s, 3=10s
H=hundreds, T=Tens, U=Units
e.g. w#16#2500 = 500second timer.



Alternatively you can use the form
L S5T#hH_mmM_ssS_xxxMS

if Hours, Mins, etc. are zero, then you can just leave them out.
e.g.

Code:
 
A M0.0 //Timer Start condition
L S5T#1S //Set Time = 1 Sec.
SP T1	 //and start T1 as Impulse
UN M0.0 //When Start signal removed,
R T1	 //Reset Timer
A T1	 //While Timer is running
= Q0.0 //switch on output A0.0
Edit: Oops, wrong language, A0.0 should of course be Q0.0
Oops 2, Und should be And!

Is SI still OK Jesper? Don't bother, just looked it up and changed it!

Last edited by RMA; March 10th, 2005 at 06:02 AM.
  Reply With Quote
Old March 10th, 2005, 06:08 AM   #4
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 11,788
Quote:
what is the step-7 equivilent of rslogic500's OSR,first scan pulse,?
Windy's post is a bit ambigous here.

"first scan" is done like Simon describes it.

A oneshot ("[OSR]"in an AB) is done with "FP" in STL in S7, or "(P)" in LAD in S7.
__________________
Jesper
3 strikes and you're out
  Reply With Quote
Old March 10th, 2005, 08:00 PM   #5
Unregistered
Guest
 
Posts: n/a
thks guys for your help...
but i am using lad programming is it possible to show me how to configure a first scan bit and the specification of the timer's time base .
is the data type s5timer and data type timer different? and lets say if i want to specify a 5 second timer ON delaywith time base 0.01s, is the following the correct way?
s5t#5s or is it w#16#0500

thanks and regards
  Reply With Quote
Old March 11th, 2005, 02:52 AM   #6
SimonGoldsworthy
Member
United Kingdom

SimonGoldsworthy is offline
 
SimonGoldsworthy's Avatar
 
Join Date: Mar 2005
Location: England
Posts: 1,079
Timers.....

Say you have a timer in some ladder logic. When you come to enter the timer value, the variable you enter must be in "s5time" format.

If the timer is to run for a fixed time, you would enter "s5t#5s". Your timer would work at 5 seconds for ever. If you wanted to change the time you would have to edit the block.
If you want to change the time according to a calculation, you would create an "s5time" variable, say in the temp data area, and then your program would write to that variable using calculated numbers. The calculated numbers would be in the w#16#0500 format and the timer would be assigned the variable name instead of a fixed time.
  Reply With Quote
Old March 11th, 2005, 02:57 AM   #7
SimonGoldsworthy
Member
United Kingdom

SimonGoldsworthy is offline
 
SimonGoldsworthy's Avatar
 
Join Date: Mar 2005
Location: England
Posts: 1,079
First scan bit....

Say we use M0.0 to be the first scan bit.
In OB100/101 set M0.0
The very last network in OB1 would reset M0.0

M0.0 will only be true for the first scan of OB1.
  Reply With Quote
Old March 11th, 2005, 03:12 AM   #8
Ken M
Member
Scotland

Ken M is offline
 
Join Date: Mar 2004
Location: .
Posts: 1,137
I'm going to start a campaign to rid the world of S5Timers!! I hate them.

They're awkward to configure, impossible to do arithmetic on (time differences etc), of limited duration and each CPU has only so many available. Let's get everyone using proper IEC timers. Who's with me, brothers? Programmers of the world unite, you have nothing to lose but your BCD-coded 3-digit timers!

Regards

Ken

(Sorry. Got a bit carried away there. For those who don't know what I'm talking about, try SFB4 'TON' from the STEP7 Library 'System Function Blocks' folder.)
  Reply With Quote
Old March 11th, 2005, 03:17 AM   #9
Sinking_Ship
Guest
 
Posts: n/a
I have basic knowledge of ladder logic but totally new to STL. Is STL tough to learn? If there any online materials that teach newbie the STL? Please advise.

Thanks a million.
  Reply With Quote
Old March 11th, 2005, 05:30 AM   #10
RheinhardtP
Lifetime Supporting Member + Moderator
Australia

RheinhardtP is offline
 
RheinhardtP's Avatar
 
Join Date: Oct 2004
Location: Perth
Posts: 471
Cool STL-->LAD

A nice way to learn if you have only done ladder is actually in Step 7, here you can convert your ladder code into STL, it can help you learn to read it , note that not all STL functions can be used doing Ladder, the siemens help file should be sufficient as a reference manual

Regards

Rheinhardt
__________________
“If a cluttered desk is a sign of a cluttered mind, of what, then, is an empty desk a sign?”

― Albert Einstein
  Reply With Quote
Old March 11th, 2005, 05:41 AM   #11
RolfB
Member
Germany

RolfB is offline
 
Join Date: Sep 2003
Posts: 119
Hi windy,


maybe these manuals are helpfulfor you:
http://support.automation.siemens.co...objid=11678629


Cheers
Rolf
  Reply With Quote
Old March 11th, 2005, 05:55 AM   #12
paraffin power
Member
England

paraffin power is offline
 
paraffin power's Avatar
 
Join Date: Aug 2002
Location: Manchester
Posts: 398
Ken
You're right-it's simply the least user-friendly data type ever. I create an FB called 'Timers' and use multi instances of SFB4 (TON). It's easier to handle the data.
Using this method, there's no limit on the number of timers (except the length of the instance data block) and you don't have to remember which timer number you're up to.

pp
__________________
Whatever hits the fan will not be evenly distributed.
  Reply With Quote
Old March 11th, 2005, 10:04 AM   #13
Ken M
Member
Scotland

Ken M is offline
 
Join Date: Mar 2004
Location: .
Posts: 1,137
PP


Spot on, brother. The revolution has now just increased its numbers by 100%. We're on the path to righteousness. Let's get some of the big hitters on-board - where are you S7Guy, JesperMP, RMA, Daniel Chartier, JVDCande and the others ...?

Ken
  Reply With Quote
Old March 11th, 2005, 11:35 AM   #14
S7Guy
Member
United States

S7Guy is offline
 
Join Date: Nov 2003
Location: Dayton, Ohio
Posts: 1,250
Sorry Ken, I'll probably be the lone dissenter.

I don't have a problem with Siemens timers, but it's probably because that is all I've ever used and they are second nature to me. They are actually pretty slick when you think about it: They have the five types, and although I mostly use the on-delay (SD), there are times I'm very glad the SS timer exists. I'm not worried about which ones have been used because I assign them dynamically on start-up, but I can see how that would be an issue in some projects, especially if they are addressed indirectly.

I haven't used SFB4, but in general I use such functions sparingly. For instance, the execution time of SFB4 is about 100 times longer than the SD instruction, and that may or may not make a difference, but I normally like to keep my scan times short and sweet if I can.

The time constants of Siemens timers can be tricky, and I'm sure if they could go back in time (about 1978), they would have designed the instruction set such that the timers didn't use the hokey 0-999 value and 10ms-10s multiplier. But at least they made it easier with S7, where you can just type in S5T#2M30S if that is what you want, plus you can use the S5Time data type in UDTs.

Doing math with the timers is definitely a challenge, and I don't even bother anymore. Instead, if I need to track the elapsed time against another timer, I'll just manufacture one programmatically. For instance, here is an On-Delay Timer:

Code:
 
			A #StartTimer
			JC M001
			L 0
			T MW 50
M001: L MW 50
			L #OB1PreviousScanTime
			+ I
			T MW50
			L #DesiredOnDelay
			>=I
			= #PulseOnDelay
			R #StartTimer
In real life, I make this type of timer using a canned UDT, and I just insert it in my other UDTs as needed, and the variables are right there when I need them. It can be easily modified for any type of timer, and there is no real limit to the time constant. In this case, I used the scan cycle time, but I have also use the interrupt OBs to pulse a trigger as well.

edit: Hmm, the code formatted kind of strange, but you get the idea.
  Reply With Quote
Old March 11th, 2005, 01:35 PM   #15
Imi'ike
Member
United States

Imi'ike is offline
 
Imi'ike's Avatar
 
Join Date: Jul 2004
Location: Western Michigan
Posts: 243
First Scan: I'll assume you are accustomed to using the first scan bit to initialize data only when the PLC is first powered up and that is what you want to do with your S7. If this is right, then don't think about it like that. Instead, put your initialization logic in OB100. For example, if you need a bit set, you could do something like this:

MB0.0 MB0.0
--|\|-----( )--


S5Timer Specification: If you want to use a constant time specification for your timer, then yes S5T#5S is what you want. If you want to use a variable, then the data type should be S5Time.

S5Time Base: The time base is not specified in S7 as it is with Allen-Bradley. Bits 12 and 13 specify the time base (i.e. 00 = 10ms, 01 = 100ms, 10 = 1sec, 11 = 10sec). So this is how you would specify the time base. If you use a constant for the time specification, then the PLC uses the smallest possible time base. The smallest time base is not necessarily 10ms. If you specify 2 hours, the time base can't be 10ms due to the structure of the S5Time data type.

S5Timer Types: You probably have feel for the five types of timers - pulse, extended pulse, on-delay, retentive on-delay, and off-delay. If not, use the context sensitive help.

S5Timer Status: With AB, you are accustomed to having access not only to the DN bit, but also the TT and EN bits. I believe the only status provided is that at the output Q of the timer. The status of this output depends on the timer type. If you regularly want the equivalent to EN, DN, and TT, then you can write your own function block to provide these bits.

IEC Timers: If you are going to use a lot of timers, these are nice to work with. Use them in a multi-instance function block otherwise you may use up a unique data block for each call of a timer. There are three type in the standard library as system function blocks (SFB3 pulse, SFB4 on-delay, and SFB5 off-delay). Here is a link to an example of amulti-instance function block with IEC timers. EntryID18723826
The PDF document that installed with Step 7 on your PC called "Working with Step 7, Getting Started" has a good multi-instance example.
  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
Siemens Step 7 byrnem LIVE PLC Questions And Answers 33 November 20th, 2006 08:59 AM
Modicon Concept To Siemens Step 7 jimdi4 LIVE PLC Questions And Answers 3 October 13th, 2004 01:54 AM
PLC control of stage lights Thesis LIVE PLC Questions And Answers 3 June 21st, 2004 09:44 PM
Can I program the old Siemens S5 with Step 7? Anibal Hernandez LIVE PLC Questions And Answers 4 April 12th, 2004 04:35 PM
Creating a register array to sequence rsdoran LIVE PLC Questions And Answers 15 October 17th, 2003 11:22 PM


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


.