RedLion Crimson 3 setting date and time

For anyone that has been following this thread I have finally got the Red Lion to set the time in the PLC. Thanks for the help TConnolly!!

The attached files are for a G306 Red Lion HMI and a Allen Bradley Micrologix 1100. Hopefully this helps someone else.
What about on the Red Lion side?
 
Bullzi, to sync the PLC and the Redlion terminal (with the terminal being the master) in Crimson I create an array that points to a block of 8 integers in the PLC. Then to sync I execute the following program

In this example TimeSync is the array and it is in the PLCSTATUS tag folder, sub folder S2.

Code:
void SyncPLCTime(void)

/*
Synchronize PLC time to match HMI local time
Write time values to the TimeSync array.
Increment the last value in the array to trigger PLC update of the RTC.
*/
PLCSTATUS.S2.TimeSync[0] = GetYear(GetNow());
PLCSTATUS.S2.TimeSync[1] = GetMonth(GetNow());
PLCSTATUS.S2.TimeSync[2] = GetDate(GetNow());
PLCSTATUS.S2.TimeSync[3] = GetHour(GetNow());
PLCSTATUS.S2.TimeSync[4] = GetMin(GetNow());
PLCSTATUS.S2.TimeSync[5] = GetSec(GetNow());
PLCSTATUS.S2.TimeSync[6] = GetDay(GetNow());
PLCSTATUS.S2.TimeSync[7] = ++PLCSTATUS.S2.TimeSync[7] & 0x0FFF;
TimeSync[7] is my synchronize trigger word. When the PLC sees this value change, it updates its time with the values from the previous 7 registers.
I love it! This is perfect for what I am working on now. Thanks TConnolly! :site:
 
I am not fluent in Red Lion's Crimson. I can manipulate existing relationships and tag names, import tag names, but adding some events still elude me. When I tried to set up this array, I couldn't compile the revised code. I would get error messages.

I am trying to co-ordinate the RTC in the Red Lion with an AB MicroLogix. I've added the addresses into RSLogix 500, so that shouldn't be an issue.

Any assistance would be appreciated.
 
Are you using logic in the PLC to move the values from the Red Lion into the RTC data positions?

You'll need to do that since the Red Lion does not allow direct access to RTC values directly.

The functions in the example above will work to get the bits and pieces you need from the Red Lion internal clock value.
 
Are you using logic in the PLC to move the values from the Red Lion into the RTC data positions?

You'll need to do that since the Red Lion does not allow direct access to RTC values directly.

The functions in the example above will work to get the bits and pieces you need from the Red Lion internal clock value.
It seems that I should be able to access clock values when using the RL tagnames for the time components (i.e. Hour, Min, Sec).

First I need to understand why the RL will not compile the script. Is there a special method that I need to employ? Or is compiling a function of the save routine?
 
You can access the clock values in the Red Lion with the example, but getting them into the PLC will require some PLC code.

Use Ctrl + T to "translate" the script (check it's validity). There is an icon on the menu bar to do it also.

If you are using tags that do not exist, you may be prompted to create them.

If you can zip and post your cd3 file and your rss file we can help you better.
 
Use Ctrl + T to "translate" the script (check it's validity). There is an icon on the menu bar to do it also.

If you are using tags that do not exist, you may be prompted to create them.

If you can zip and post your cd3 file and your rss file we can help you better.

Thanks, Okie ...

Didn't know about the Ctrl+T. I'll give this another shot and if I don't have luck, I'll post files.
 
Here is how I have done it:
Code:
/*
  Get the time from the HMI and write it to the PLC tags
  The Micrologix uses Fucntion Files RTC:0 which cannot be accessed
  directly by the HMI.  The PLC is programmed to update the N registers
  with the RTC values unless the Set button is pressed.
  The button which calls this program first sets the button.  The PLC
  reads that button and reverses its copy so that when this program runs, the data is updated
  in reverse, then the last line turns the button back off.
*/

int i := GetNow();
PLC.MAIN.Clock.PLC_Year := GetYear(i);
PLC.MAIN.Clock.PLC_Month := GetMonth(i);
PLC.MAIN.Clock.PLC_Day := GetDate(i);
PLC.MAIN.Clock.PLC_Hour := GetHour(i);
PLC.MAIN.Clock.PLC_Min := GetMin(i);
PLC.MAIN.Clock.PLC_Sec := GetSec(i);
PLC.MAIN.Clock.Set := 0;

Which is quite similar to Troy's example. My tags are in folder hierarchy and I had two PLCs in this application (MAIN and Filters) so I had two programs like this, each with their own tags from each PLC.

My tags are set up as "N" registers in the Micrologix, and the last tag shown (PLC.MAIN.Clock.Set) is set when I want to tell the Micrologix to write those "N" registers to the RTC function file addresses.

In my case, N15:3/15 is the bit used to trigger the clock update, and N15:137 is the year value from the Red Lion and the next 5 values are Month, Day, Hour, Minute, and Second.

I use a button on a page to set the trigger bit when pressed and call the program when released.

In the PLC, when the trigger bit is set, the values are copied from the N registers to the RTC function files, and when the trigger bit is not set, the copy direction is reversed, so that the values shown on my "clocks" page will show the contents of the PLCs clocks.

The two rung mnemonics:
XIC N15:3/15 CPW #N15:137 #RTC:0.YR 6
XIO N15:3/15 CPW #RTC:0.YR #N15:137 6
 
Last edited:

Similar Topics

Hey guys, hoping someone here could give me a little advice. I'm working with a CR1000-04000 in Crimson 3.1 and I was interested in adding the...
Replies
4
Views
143
Hi, I have a complex database in Crimson 3.0 and in one of the display pages I am trying to get a tag to show the sum of several other tags. The...
Replies
3
Views
177
It states WinPcap must be installed for the Emulator to function. WinPcap.org states that the technology is mature with no updates planned. Am I...
Replies
3
Views
869
Following on from another thread, I just downloaded Crimson 3.2 and it now supports CR and Graphite HMIs. Time for a 'play' :-) It seems to have...
Replies
14
Views
2,041
Action On Release command Set(ConveyorPopup,ConveyorPop_1) rejected w/ string tags. SetStringTag(index, data) wants an index. How does one pass...
Replies
8
Views
973
Back
Top Bottom