Sign in to follow this  
Followers 0
mulderm

Sending time to Excel when a bit in PLC5 is "1"

13 posts in this topic

Hello, I use a PLC/5 processor with RSLogix5 and RSLinx Classic. Now I want when each time bit B3/0 is "1" place the time with a resolution of 0,1 seconds to a cel in Excel using DDE. Example: 18:45:7,8 (18 hours, 45 minutes and 7,8 seconds) How can I make this? mulderm

Share this post


Link to post
Share on other sites
I do my time and date within Excel using the now function: 'capture time and date stamp into column 8 Cells(lngRow, 13).Value = Now() Download this example here: http://forums.mrplc.com/index.php?autocom=downloads&showfile=134 edit the macros.

Share this post


Link to post
Share on other sites
Thank you Chakorules for the link. But how can I make the time (Now()) in 0,1 seconds resolution? mulderm

Share this post


Link to post
Share on other sites
I would do it right in Excel. Right click in the cell, click FORMAT. Make the ":ss" to make the seconds. Or are you asking for sub-seconds? Like tenths, or hundredths?

Share this post


Link to post
Share on other sites
Chakorules, I want to make the seconds in tenths. mulderm

Share this post


Link to post
Share on other sites
I am pretty sure that the resolution in Excel is only in seconds. You'll probablly need to get tenths time from the PLC. You can send it over DDE just like any other value from the PLC into excel.

Share this post


Link to post
Share on other sites
Chakorules, I have it! Using this VBA-code: Sub loggen() Dim A As Integer A = Range("A2").Value + 5 Range("A" & A).Select Selection.Value = "=NOW()" Selection.NumberFormat = "h:mm:ss.0" Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False End Sub I running this code everytime bit B3/0 is "1" using DDE and the cell is fill with the system time with tenth-seconds. Greetings, mulderm

Share this post


Link to post
Share on other sites
Wow! This is EXCELLENT research information. Thank you very much for following up and sharing with everyone. I didn't know that you could do that. Thank you for sharing! -

Share this post


Link to post
Share on other sites
Agreed, this is very helpful for me too Thanks for sharing $

Share this post


Link to post
Share on other sites
Nice work. I was looking for tenths of seconds about a year ago and couldn't figure out how to do it in Excel

Share this post


Link to post
Share on other sites
I've done some basic hot links from a ML1100 to Excel over our network but have'nt used VB. What is a good source to learn VB. My other question (and I know it sounds silly) but where do you type in the VB code at for an Excel spread sheet. Thanks.

Share this post


Link to post
Share on other sites
In Excel goto Tools, Macro, Macros... for you VB code I'm more of a dive in heads first type of guy but a bookstore should have some good books to assist you with learning VB

Share this post


Link to post
Share on other sites
I did some VB programing a few years ago, and found a "Programming Excel for Dummies" book. It helped me greatly.

Share this post


Link to post
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
Sign in to follow this  
Followers 0