Reading UniOp Hardware clock w/ SLC 5/02

monkeyhead

Member
Join Date
Sep 2004
Location
I'm right here
Posts
656
So I've got an SLC 5/02 that I need to do some up/downtime counters with. But I also want to reset the counts at shift changes and keep track of a few days worth of Data automatically.

Since the 5/02 doesn't have a real time clock, I set up a fairly slick STI interrupt, that's suprisingly accurate, to keep track of the time and increment the minutes, hours, days, etc. Problem is that if the PLC is off, the clock stops. I then realized that the UniOp touchscreen has a hardware clock and writes the date and time to the PLC's memory.

The date is written as two bytes to N7:105 for month and day, and one byte to the high bits of N7:106 for the year. Then the time is written in 00:00:00 format. Each digit occupies 4 bits. The hours are the lower byte of N7:106. The first 4 bits represent the 10's position and the the last 4 bits represent the 1's position of the of the hours (does this qualify as BCD?). Then the 16 bits of N:107 are used to represent each of the remaing four digits for minutes and seconds.

I set up a goofy JSR that runs once the PLC and the HMI are talking after a power up to sync my STI based clock with the hardware clock in the UniOp. It's basically a bunch of bitwise AND insturctions (AND with - F000H, 0F00H, 00F0H, or 000FH) to pick out each of the digits of the clock that I want and then I bit shift the result so the signifigant numbers occupy the lowest four bits of the register. Then I multiply the 10's position by 10 and add the 1's position to it.

Long story, but the point is... is there an easier way to do this? I know this works, but it comes off as kludgy to me. Seems like I should be able to accomplish this much easier than using a bunch of ANDs and BSRs. It's definately not an 'ol electrician friendly routine. I ended up giving the whole silly mess it's own file because of how many rungs it took up.

Any ideas on how I might accomplish this more elagantly?
 
Nevermind... I found a much better way. AND out the parts I don't want and use the FRD command to convert it over.

If it's the high byte, then I divide the result by 100. I knew I was making the whole thing way too complicated.
 
Dear friends,
I,ve uploaded a project from a uniop (ek-04) and download it to a new idetical one using designer6, all is alright!.. but the problem is that when i download the project(while the uniop in cofig. mode) , the downloading in pc side is achieved successfully but the uniop screen become empty when download is complete!..when i turn it off and power it on , the texts on the screen appear (self test ..the.. uniopver4.40 operation mode) then the screen become empty and no text or software appear on it!..
please help me to solve this problem...
john
 

Similar Topics

Hi all, i have 8 CJ2m plc units that show different numbers on the plc display and i am stuck on reading the info. my unit has an ip address of...
Replies
1
Views
19
Hi Everyone, I am not proficient in RSLogix 500 so I have a question regarding the evaluation of N7:0 data as an input. So as I understand in...
Replies
1
Views
75
Trying to setup a message read via Ethernet. I have the path setup as 1, 1, 2, 192.168.66.10 I get an error code 1, ext err 315. I am beating...
Replies
9
Views
229
Dear all, I don't know why setup of password became challenging and weird. After setting up the password and try to upload the ladder from the plc...
Replies
3
Views
171
hi all, i have a plc i need to get info from for a site im working on: I have a 1764 Micro Logix 1500 LSP Series C (See Attached Image) im...
Replies
2
Views
373
Back
Top Bottom