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 August 29th, 2008, 08:37 AM   #1
Krilun
Member
United States

Krilun is offline
 
Krilun's Avatar
 
Join Date: Aug 2008
Location: Cleveland
Posts: 44
RSLogix 5000 Clock Design

I wrote a clock subroutine (Functional Block Diagram). The clock works fine, however, I cannot find a way to update the clock. If the program crashes and needs to be restarted, I need to have the current time sent in so the clock knows the current time. Does anyone know how to do this?

-Ken
  Reply With Quote
Old August 29th, 2008, 09:09 AM   #2
pandersen
Member
United States

pandersen is offline
 
Join Date: Oct 2007
Location: Chicago
Posts: 113
I'm not sure if you wrote a routine to keep track of the time, or if you wrote something to time intervals. If you wrote an actual clock, you should probably look into using GSVs and SSVs on the WALLCLOCKTIME attribute. The WALLCLOCKTIME is the CPUs internal clock and will definitely be more accurate than a routine. You need a 7 DINT array to store the time. When you do the GSV with that array as the destination, your array will have the time as [0]->Year, [1]->Month, [2]->Day, [3]->Hour, [4]->Minute, [5]->Second, [6]->Microsecond.

To set the time you fill in another 7 DINT array in the same manner with the date/time you wish to set, and use the SSV instruction.
__________________
Build a man a fire, and he will be warm for a day. Set a man on fire, and he will be warm for the rest of his life.
  Reply With Quote
Old August 29th, 2008, 09:12 AM   #3
Krilun
Member
United States

Krilun is offline
 
Krilun's Avatar
 
Join Date: Aug 2008
Location: Cleveland
Posts: 44
I'd like to actually write an actual clock. What is this GSV and SSV you speak of and where can I find it? Thanks Pandersen
  Reply With Quote
Old August 29th, 2008, 09:18 AM   #4
pandersen
Member
United States

pandersen is offline
 
Join Date: Oct 2007
Location: Chicago
Posts: 113
The GSV (Get System Value) and SSV (Set System Value) are not available in the FBD language, so you would have to use them in ladder.

ControlLogix already has a clock in it which you can access with those two instructions using the method I posted just before. There is a lot of nice information available about them and the WALLCLOCKTIME class in the RSLogix help file - just search for GSV, SSV, or WALLCLOCKTIME and read everything that comes up.
__________________
Build a man a fire, and he will be warm for a day. Set a man on fire, and he will be warm for the rest of his life.
  Reply With Quote
Old August 29th, 2008, 07:26 PM   #5
TConnolly
Lifetime Supporting Member
United States

TConnolly is offline
 
TConnolly's Avatar
 
Join Date: Apr 2005
Location: Salt Lake City
Posts: 5,871


Do a search on this forum for wallclocktime. There are a ton of threads about using it.

Also there are several tech notes and sample programs in the AB knowledge base. http://www.rockwellautomation.com/knowledgebase/ Do
a search on wallclocktime.
__________________
True craftsmanship is only one more power tool away.

That's the beauty of processors, they don't have emotions they just run code - The PLC Kid.
  Reply With Quote
Old August 30th, 2008, 07:46 AM   #6
Oakley
Member
United States

Oakley is offline
 
Oakley's Avatar
 
Join Date: Oct 2004
Posts: 1,083
You could develop an AOI that reads the wallclock, then use it in FBD.
__________________
Artificial intelligence never overcomes natural stupidity.
  Reply With Quote
Old August 30th, 2008, 02:21 PM   #7
TConnolly
Lifetime Supporting Member
United States

TConnolly is offline
 
TConnolly's Avatar
 
Join Date: Apr 2005
Location: Salt Lake City
Posts: 5,871
Quote:
Originally Posted by Oakley
You could develop an AOI that reads the wallclock, then use it in FBD.
Excellent idea!

To get this:


import this AOI code which calls GSV using the ST language and returns Year, Month, Day, Hour, Minute, and Second to output handles on a function block - requires V16 or greater.
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
     <RSLogix5000Content SchemaRevision="1.0" SoftwareRevision="16.03" TargetType="AddOnInstructionDefinition" ContainsContext="true" Owner="TConnolly" ExportDate="Sat Aug 30 13:08:08 2008" ExportOptions="Context">
     <Controller Use="Context" Name="Time">
     <AddOnInstructionDefinitions Use="Context">
     <AddOnInstructionDefinition Use="Target" Name="GetDateTIme" Revision="1.0" ExecutePrescan="false" ExecutePostscan="false" ExecuteEnableInFalse="false" CreatedDate="2008-08-30T18:45:47.218Z" CreatedBy="TConnolly" EditedDate="2008-08-30T19:06:30.718Z" EditedBy="TConnolly" SoftwareRevision="v16.03"
     >
     <Parameters>
     <Parameter Name="Year" DataType="DINT" Usage="Output" Radix="Decimal" Required="false" Visible="true">
     <Description>
     <![CDATA[WallClockTIme Calendar Year]]>
     </Description>
     <DefaultData>00 00 00 00</DefaultData>
     </Parameter>
     <Parameter Name="Month" DataType="DINT" Usage="Output" Radix="Decimal" Required="false" Visible="true">
     <Description>
     <![CDATA[WallClockTIme Calendar Month]]>
     </Description>
     <DefaultData>00 00 00 00</DefaultData>
     </Parameter>
     <Parameter Name="Day" DataType="DINT" Usage="Output" Radix="Decimal" Required="false" Visible="true">
     <Description>
     <![CDATA[WallClockTIme Calendar Day]]>
     </Description>
     <DefaultData>00 00 00 00</DefaultData>
     </Parameter>
     <Parameter Name="Hour" DataType="DINT" Usage="Output" Radix="Decimal" Required="false" Visible="true">
     <Description>
     <![CDATA[WallClockTime
     Hour]]>
     </Description>
     <DefaultData>00 00 00 00</DefaultData>
     </Parameter>
     <Parameter Name="Minute" DataType="DINT" Usage="Output" Radix="Decimal" Required="false" Visible="true">
     <Description>
     <![CDATA[WallClockTIme Minute]]>
     </Description>
     <DefaultData>00 00 00 00</DefaultData>
     </Parameter>
     <Parameter Name="Second" DataType="DINT" Usage="Output" Radix="Decimal" Required="false" Visible="true">
     <Description>
     <![CDATA[WallClockTIme Second]]>
     </Description>
     <DefaultData>00 00 00 00</DefaultData>
     </Parameter>
     </Parameters>
     <LocalTags>
     <LocalTag Name="wct" DataType="DINT" Dimensions="7" Radix="Decimal">
     <DefaultData>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
     00 00 00 00 00 00 00 00 00 00 00 00</DefaultData>
     </LocalTag>
     </LocalTags>
     <Routines>
     <Routine Name="Logic" Type="ST">
     <STContent>
     <Line Number="0">
     <![CDATA[//AOI - returns the cuttent date and time to individualt instruction outputs for use in FB.]]>
     </Line>
     <Line Number="1">
     <![CDATA[GSV(WallClockTime,,LocalDateTime,wct[0]);]]>
     </Line>
     <Line Number="2">
     <![CDATA[Year:= wct[0];]]>
     </Line>
     <Line Number="3">
     <![CDATA[Month:=wct[1];]]>
     </Line>
     <Line Number="4">
     <![CDATA[Day:=wct[2];]]>
     </Line>
     <Line Number="5">
     <![CDATA[Hour:=wct[3];]]>
     </Line>
     <Line Number="6">
     <![CDATA[Minute:=wct[4];]]>
     </Line>
     <Line Number="7">
     <![CDATA[Second:=wct[5];]]>
     </Line>
     <Line Number="8">
     <![CDATA[]]>
     </Line>
     </STContent>
     </Routine>
     </Routines>
     </AddOnInstructionDefinition>
     </AddOnInstructionDefinitions>
     </Controller>
     </RSLogix5000Content>
(To import, paste code into notepad and save with a .L5X extension. Then right click "Add On Instructions" in the Logix5000 project tree, and select "Import Add On Instruction")
__________________
True craftsmanship is only one more power tool away.

That's the beauty of processors, they don't have emotions they just run code - The PLC Kid.
  Reply With Quote
Old August 30th, 2008, 07:34 PM   #8
Alan Case
Lifetime Supporting Member
Australia

Alan Case is offline
 
Alan Case's Avatar
 
Join Date: Apr 2002
Location: Wagga Wagga
Posts: 1,252
Hi Alaric.
Nice job.
If you do a search on the Rockwell website there is code to calc the day of week from the date variable. Would be nice to integrate that into the AOI as well. It was a project I was always going to do but never got around to it.
Regards Alan Case
  Reply With Quote
Old September 1st, 2008, 04:09 PM   #9
504bloke
Lifetime Supporting Member + Moderator
England

504bloke is offline
 
504bloke's Avatar
 
Join Date: Jan 2005
Location: West Ssx
Posts: 2,635
Quote:
Originally Posted by Alan Case
Hi Alaric.
Nice job.
If you do a search on the Rockwell website there is code to calc the day of week from the date variable. Would be nice to integrate that into the AOI as well. It was a project I was always going to do but never got around to it.
Regards Alan Case
Come on Alaric, half a job isnt good enough !!!
__________________
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 September 1st, 2008, 11:32 PM   #10
TConnolly
Lifetime Supporting Member
United States

TConnolly is offline
 
TConnolly's Avatar
 
Join Date: Apr 2005
Location: Salt Lake City
Posts: 5,871
Yeah, I'll get right on that... and while I'm at it I'll add a Julian date output as well. Anyone need sunrise/sunset? I think I also did one of those, so may as well roll it in.
__________________
True craftsmanship is only one more power tool away.

That's the beauty of processors, they don't have emotions they just run code - The PLC Kid.
  Reply With Quote
Old September 2nd, 2008, 04:47 AM   #11
Alan Case
Lifetime Supporting Member
Australia

Alan Case is offline
 
Alan Case's Avatar
 
Join Date: Apr 2002
Location: Wagga Wagga
Posts: 1,252
Hi Alaric. I wasnt trying to be pushy and suggest that you code it but more of an open invite to someone who had the time or the inclination to expand the AOI out a bit.
But while you are at it a sunrise/sunset time would be nice.
We should be able to calc our latitude approx from the difference between the GSV time and localtime.
Regards Alan Case
  Reply With Quote
Old September 2nd, 2008, 07:47 AM   #12
Krilun
Member
United States

Krilun is offline
 
Krilun's Avatar
 
Join Date: Aug 2008
Location: Cleveland
Posts: 44
Alaric, awesome job! Thank you a lot, that will surely help me in my future work.

However, sigh... I need to stick with version 15 on the project I'm working on currently. So I use a GSV in ladder logic to get the date, however the date receieved is incorrect. It claims the year is 1998... basically everything is not right.

Is there a way to display the current correct date? Is there something I'm not doing?
  Reply With Quote
Old September 2nd, 2008, 08:41 AM   #13
Oakley
Member
United States

Oakley is offline
 
Oakley's Avatar
 
Join Date: Oct 2004
Posts: 1,083
Adjust the clock settings of the processor.
__________________
Artificial intelligence never overcomes natural stupidity.
  Reply With Quote
Old September 2nd, 2008, 09:02 AM   #14
Krilun
Member
United States

Krilun is offline
 
Krilun's Avatar
 
Join Date: Aug 2008
Location: Cleveland
Posts: 44
The BIOs is indicating the correct time on the processor. The GSV should be syncing the two clocks but it doesn't seem to be working
  Reply With Quote
Old September 2nd, 2008, 11:17 AM   #15
TConnolly
Lifetime Supporting Member
United States

TConnolly is offline
 
TConnolly's Avatar
 
Join Date: Apr 2005
Location: Salt Lake City
Posts: 5,871
Quote:
Originally Posted by Alan Case
Hi Alaric. I wasnt trying to be pushy and suggest that you code it but more of an open invite to someone who had the time or the inclination to expand the AOI out a bit.
But while you are at it a sunrise/sunset time would be nice.
We should be able to calc our latitude approx from the difference between the GSV time and localtime.
Regards Alan Case
Hey Alan, (and 504bloke) I knew that - I was kidding around and being sarcastic - I guess the tone didn't come through. Cheers.
__________________
True craftsmanship is only one more power tool away.

That's the beauty of processors, they don't have emotions they just run code - The PLC Kid.
  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
How To Enter Rslogix 5000???? sundar_scada LIVE PLC Questions And Answers 9 October 8th, 2009 11:29 AM
Rockwell Allen Bradley Programming Software, RSLogix 5, RSLogix 500, RS Linx, RSLogix vvcd LIVE PLC Questions And Answers 21 September 24th, 2009 10:04 PM
RSLOGIX 5000 Error Message introl LIVE PLC Questions And Answers 4 May 8th, 2008 03:40 PM
Gray Code and RSLogix 5000 IAA LIVE PLC Questions And Answers 5 September 28th, 2007 09:27 AM
RSLogix 5000 V15 Features Samneggs LIVE PLC Questions And Answers 18 April 20th, 2006 05:45 PM


All times are GMT -5. The time now is 04:15 PM.


.