Sign in to follow this  
Followers 0
Guest Slick504

Cpu Time

7 posts in this topic

I'm using SFC 1 to get the time from the cpu, according to the Siemens step 7 manual i need to use FC 8 "DT_TOD" to extract the time from the format. My problem is that the guy who wrote the code originally, has already used the FC 8 block. Can anyone tell me away around this. Cheers Graeme

Share this post


Link to post
Share on other sites
Hello Graeme, Simply program the FC 8 DT_TOD again BUT with different parameters. If the original code uses a RET_VAL with the parameter MD50 Then just program the block again BUT with a RET_VAL parameter of MD60 (for example) Hope this helps? Steve steve@plcman.co.uk http://www.plcman.co.uk

Share this post


Link to post
Share on other sites
HI Steve When i said FC8 was already used........i meant, that the guy who wrote the project, is using FC 8 as a Function Call. Siemens contains IEC blocks (converting blocks) and 1 of these is called FC8(DT_TOD) and is held within the library, but when i tried to copy FC8 from the FC library, i kept getting the message FC8 already exists, do you want to replace. I read the manual and found that i had to renumber the FC8 from the FC library to allow it to be in my project. Have you got any sample code for displaying and comparing the current time with a fixed value in the plc, ie, when the processor time = 7am switch bit x on. cheers Graeme

Share this post


Link to post
Share on other sites
Graeme, If the FC already exists in your project then you do not really need to copy it to a different FC Number. Just CALL the block again BUT with different parameters. If you are not sure then email me your project and I will modify it for you. Steve steve@plcman.co.uk

Share this post


Link to post
Share on other sites
Hi Graeme- I think that Steve is misunderstanding your issue with the FC8. Correct me if I'm wrong. My take is that the previous programmer created FC8 as a user FC. The FC8 in your program is NOT the FC8 that comes in the standard library. So you don't want to call the FC8 you currently have. You needed to insert the library FC8 but as a different FC. It sounds like you did this so you are golden at this point. I have an S7-313 currently running on my desk doing what I believe you want to do. I did this all in OB1 but you can do it anywhere you like. The key is that the time of day is simply a double integer storing the current time of day in MILLISECONDS. The TOD format is just a display aid. To get the value you want you just need to do enough standard and modulo divisions to break the milliseconds down into hours, minutes and seconds. Store each unit in it's own word or byte and you have what you need. If you don't need to interface with it but just need a trigger on a specific time you could simply calculate out the number of milliseconds you need and enter that as either a double integer constant (L#) or in a double length memory location (MD??? or DB??.DBD??). I could send you this S7-313 project if you want it. Just email me at kmenges@webexinc.com and I'll send it off. Chris- If you read this and you want me to post this code as a simple Siemens S7 example, let me know. Keith

Share this post


Link to post
Share on other sites
I have a "Clock" routine. It uses the SFC to read the clock and puts the time and date into integers for you. I don't seea way to attach files here, but shoot me an email and I will send it to you. RRobbins@cca-corp.com

Share this post


Link to post
Share on other sites
hello ! could anybody give me the sample about the cpu time .could anybody stick the program here ,thanks a lot

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0