Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: maciek on April 06, 2017, 08:03:10 PM
-
i have a pressure sensor and use c1 as pressure drop contact, every time it goes on i want to save the time and date and number of times this happened, what is an easy way to accomplish this. i did this before with click counter and copy in DS instructions but it was a lot of work. any ideas for easier way
-
i use the best protein powders for muscle gain (https://www.globenewswire.com/news-release/2025/05/05/3073796/0/en/Best-Protein-Powders-For-Muscle-Gain-New-Report-Reveals-Which-Protein-Powders-Actually-Work.html) as pressure drop contact, every time it goes on i want to save the time and date and number of times this happened, what is an easy way to accomplish this. i did this before with click counter and copy in DS instructions but it was a lot of work. any ideas for easier way
Hi Maciek, did you get it worked out yet?
-
the simplest way is:
Leading Edge One Shot (C1) ------ MEMCOPY ( $Now, UDT0 )
Each time C1 transitions from OFF to ON the MEMCOPY instruction will copy the current Date & Time ($Now) to the user Date/Time structure UDT0.
Whether or not this is what you need depends on what you intend to do with the Date & Time data.
-
Sounds like a job for the FILELOG instruction. Built in timestamp and everything.
How about Rising edge C1 triggers CT0, and then triggers logging of the CT0.Acc value.
-
Another possibility is the User Log that has been there since 1.0. Use the STREAMOUT instruction with the @UserLog device. Use STRPRINT to generate the log string. It also has a built-in date/time stamp (see attached screenshot)
To access the User and System Logs within Designer, use PLC->System Information... Event Logs tab. If needed, you can export the logs from that dialog.
-
Could this also be an option? Whenever the sensor comes on, it copies the EPOCH in the D location. It then converts the epoch to D/T and writes that into the Memory Block that you configure as PressureLog0-255.
So if you viewed PressureLog0-255, it would give you the last 256 timestamps of the pressure valve coming on, and then start over when it reached the limit.
(https://forum.hosteng.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F8LOF7rq.png&hash=51a2d6448e845ba3ba4d382ace685b6690cd96ae)
-
copies the EPOCH in the D location
Even easier, use a MOVE with DST22 ($LocalTime) as the source into D[V0]. DST22 is the 1970 Epoch value without needing to use MATH/Now().
In Data View, you can enter DST22 or D[V0], and select "1970 Epoch" in the Format drop-down on the Data View toolbar to get the date/time text.
I know it's hard to remember all the DST System elements and what they mean. If you use the Element Picker, type just a few "critical" characters of what you think is in the nickname in the Show only Nicknames containing the text field. So I entered "time" in the attached example, and it reduced the nickname list in the Element Picker to just those that contain the text "time" anywhere in the nickname.
-
wow you guys know your
-
can you tell me what this D[V0] do or what is means
-
Indirect addressing. If V0 == 10, then D[V0] points to D10. Very powerful tool for efficient programming, and sometimes they only way to do a given task.
-
can you tell me what this D[V0] do or what is means
It's indirect addressing using an array. This uses the accumulated number in the counter and writes to that D memory location. Basically, I've copied the counter's .acc number to a V memory location (because arrays have to use v memory locations). Then we write to that D memory location. The first time your trigger comes on, it writes to D0 (the counter is still at 0). The next time, the counter will be at 1, so it'll write to D1. It'll keep going until it gets to D255, and then it'll start back over at D0. So if you just view D0-D255, it will show you the times where your input came on.
-
This could be an even simpler solution if it's what you're looking for:
Using the FILELOG function. On the edge of the sensor, it writes an entry into the log file. (you can store the log on the limited ram of the CPU or utilize a 32GB microSD card that you can add to the CPU). It'll write the time of the fault, as well as the number accumulated in the D location (the number of faults).
(https://i.imgur.com/y5NtY9v.png)
(https://i.imgur.com/Nxhp1gw.png)
(https://i.imgur.com/HNihg1W.png)
(https://i.imgur.com/HtWLKVZ.png)