Local time not correct

from the manual:
if it isn't holding the time it may just be a faulty PLC. Does the time move on whilst you are powered up or does it stay the same, you can check in diagnostics.
The time is running in the diagnostics. You are right about the year,month and day but I want it to be the local time just to be correct.

I have also set the time of day timezone correct. Where can I find 'system and clock memory'?

Btw i have to go from nanoseconds to seconds.
 
The TIME variable doesn't seem to hold nano seconds. Where did you get this information?
That is why he is having to use the Date/Time rather than a timer, been there, got the tee shirt :)


If you have set the Timezone in Time of Day, 'System and Clock memory' is just above it in the PLC General properties.


Rather than Local Time does it work with System Time, if it does then we have narrowed down the problem.
 
The TIME variable doesn't seem to hold nano seconds. Where did you get this information?

When I use the 'MOVE' block I had the option between year,month,day,hour,minutes,seconds and nanoseconds.

I normally work with milliseconds but I can't chose that here so I either have to work with seconds which will result in a less detailed measurement or nanoseconds which is to small.

I have to do a study between 2 time measurements.
1 with a normal timer in the main.
1 with the current local time in the interrupt.
 
Stupid question, wouldn't a timer with a large preset do?

Why RD_LOC_T and not RD_SYS_T? I would assume you need to set up a timezone for the RD_LOC_T, which I can't see where in the hardware config for this to work.

I haven't got a simulator at work, or a PLC, but we'll give it a try at home.

Thank you! Can you simulate this in an interrupt?
 
Fair. For now, try to do something simple. Do you know the interrupts are being called?

I'd recommend testing two things:

1) move the code from interrupt 0.0 and 0.1 into your Main OB, and then trigger the calls on the value of the appropriate input. That way, you can test the IO and the time code. The times won't be as accurate, but you should get SOMETHING. Note that it may require you to trigger the inputs with a finger or roll the ball slowly, instead of properly rolling the ball at speed.

2) set a new tag in each interrupt that says it has been executed. you can reset it manually, from a watch table.

When you test the code, you should be able to see if the inputs trigger at all, and if so, if the time code seems to do anything. You should also find out if the interrupts are triggering at all.


I tested it and it worked!
Used a random bit in the interrupt and I saw it being activated.
Also I put the 'read the local time' code in the main and the time was correct! No more 1970 :). I don't know if this works in the interrupt tho
 
I don't see why it wouldn't... unless it is an asynchronous call (which I can't understand why it would be).
Also, the default priorities for these interrupts are fairly high too, so that shouldn't be the issue.
 
Whenever I start the CPU, the time is set at 1970-01-01-00:00:00 instead of the current local time.

1970-01-01-00:00:00 is an epoch time in computing. it has to do with a baseline for time reference, the amount of bits assigned to time storage, and the data type. FYI if you thought Y2K was an issue, wait until systems using 32-bit signed integers get to Jan 19 2038. Many embedded systems use signed 32-bit time stamping, cell phones, automotive, flight, PLCs, etc.
 
I don't see why it wouldn't... unless it is an asynchronous call (which I can't understand why it would be).
Also, the default priorities for these interrupts are fairly high too, so that shouldn't be the issue.

Hmm i tested it and doesn't work. I had one 'read local time' in my first interrupt and another one in my second interrupt. The T_DIFF was in my main, maybe that was the problem? I can send screenshots later. I had the same problem when I used a TON in my interrupt, not happened with the elapsed time back then. Now I'm having problems with the output of both 'read local time' blocks not being moved in the T_DIFF block.
 
Last edited:
1970-01-01-00:00:00 is an epoch time in computing. it has to do with a baseline for time reference, the amount of bits assigned to time storage, and the data type. FYI if you thought Y2K was an issue, wait until systems using 32-bit signed integers get to Jan 19 2038. Many embedded systems use signed 32-bit time stamping, cell phones, automotive, flight, PLCs, etc.

Oooh okay I get it thanks for your explanation.
 
I just tested this with PLCSim and it works.
The data is stored in a global DB.
I call RD_SYS_T and RD_LOC_T in OB40 and OB41 as well as setting a flag if those OB's are run.
In OB1, if both flags are high, I calculate the difference with T_DIFF.
I tested this with PLCSim sequencer by adding a delay of 10 seconds between both inputs and the result came out as 10s and 56 ms.
Additionally, I use both RD_SYS_T and RD_LOC_T and they both give me the same result.
I am using TIA Portal V15 on a VM.
 
I just tested this with PLCSim and it works.
The data is stored in a global DB.
I call RD_SYS_T and RD_LOC_T in OB40 and OB41 as well as setting a flag if those OB's are run.
In OB1, if both flags are high, I calculate the difference with T_DIFF.
I tested this with PLCSim sequencer by adding a delay of 10 seconds between both inputs and the result came out as 10s and 56 ms.
Additionally, I use both RD_SYS_T and RD_LOC_T and they both give me the same result.
I am using TIA Portal V15 on a VM.

Alright thanks, did you put them in an interrupt or everything in the main?
 
The RD_SYS_T and RD_LOC_T are called inside interrupts.

The T_DIFF is called in OB1.

The data block where everything is stored is a Global one.
 
Last edited:

Similar Topics

Is there a way to add a local message display to Studio 5000 View Designer? If its there, I’m not finding it. I have used them in older versions...
Replies
11
Views
396
Hi, I'm trying to export data from a DataGrid to Excel using VBA, but I'm getting an error "Object doesn't support this property or method". The...
Replies
0
Views
72
So our Powerflex 525's are set up to allow REMOTE operation from PLC through network. But if network is lost we want to be able to run in LOCAL...
Replies
5
Views
558
Migrating v8 FT View SE to v13, had to export tags because after v10 the configuration is no longer supported. Imported tags to new Tag Alarm...
Replies
1
Views
503
Hello, the PLC in question is 1769-L30ER. I have a local 4-20mA Analog Output module (1769-OF4CI), and also a remote ethernet PointIO analog...
Replies
0
Views
396
Back
Top Bottom