Jump to content

Creating Data Tables with time logs


Mshak

Recommended Posts

So I am a beginner when it comes to not only unitronics software, but PLC's in general. I am tasked to connect 2 door bells (one in the front, one in the back) to the PLC and create a program that once one of the buttons has been pressed, it sends a signal to the plc which activates a horn and tower lights (depending on the door).

My problem is creating a data table that acts as a log. It is supposed to keep track of  - 1. the time when a button is press, and  - 2. the date.

Also one other question, the timer off command doesn't seem to work in my programming, which is supposed to turn off the outputs after 5 seconds. of being activated,

Thanks, I know it is a lot but any help would be appreciated. 

 

Light.PNG

Data Table.PNG

HMI.PNG

Link to comment
Share on other sites

  • MVP 2023
5 hours ago, Mshak said:

the timer off command doesn't seem to work in my programming, which is supposed to turn off the outputs after 5 seconds. of being activated,

Use a positive transition of your button push to activate a Time TE. Use the output bit of the TE to activate your outputs.

Something like this:

image.thumb.png.49996c4f0eb2cd589507fdafb6bceb91.png

You appear to have the Horn coil in both rungs 1 & 2. THAT WILL NOT WORK. You can only have a direct coil in one ladder rung.

Link to comment
Share on other sites

  • MVP 2023
6 hours ago, Mshak said:

My problem is creating a data table that acts as a log. It is supposed to keep track of  - 1. the time when a button is press, and  - 2. the date.

You're on the right track using the UDFB RTC to ASCII. Just place a line like this in your Main Routine:

image.png.27cc79223c1fa7ea420d0f3a0b0fee57.png

Then copy those operands over to your Data Table Struct triggered by a positive transition of your button press. You will also need to index the Data Table down a line each time.

Link to comment
Share on other sites

  • MVP 2023
12 minutes ago, Mshak said:

I see you numbers the time to #1 and the date to #9.... are those arbitrary numbers?  What do they represent?

If you look at the top comment line of the RTC to ASCII UDFB, it explains what the numbers mean. It's basically selecting which format style you want your Time and Date strings to be in.

Link to comment
Share on other sites

  • MVP 2023
33 minutes ago, Mshak said:

Can you explain exactly how to index the data table down a line each time?

You appear to be using Data Table Indexed. There is a function for "Insert Row to DTI" that automatically shifts the rows down below the point of insertion.

Link to comment
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
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.