plc.myforum.ro Forum Index plc.myforum.ro
PLCs users www.plc.myforum.ro!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

RSView32

 
Post new topic   Reply to topic    plc.myforum.ro Forum Index -> ALLEN-BRADLEY(Rockwell Automation)
View previous topic :: View next topic  
Author Message
Vasilis93
Junior
Junior


Joined: 07 Jun 2016
Posts: 12

PostPosted: 07/06/2016 12:21    Post subject: RSView32 Reply with quote

How can i use a timer (up) on my display area in RSView32 Works 100K
Back to top
View user's profile Send private message
dumb
Junior
Junior


Joined: 02 Jun 2016
Posts: 8

PostPosted: 07/06/2016 19:22    Post subject: Re: RSView32 Reply with quote

Vasilis93 wrote:
How can i use a timer (up) on my display area in RSView32 Works 100K


What do you want to do with this timer?
Easier to do for different events with the timer is :
Code:
 Put a timer in the plc that cycles a bit on when you want to run the application.
Set up a tag that uses that address and set up the event to look at the tag.
When the bit goes high, the VB code executes.
That way if you decide to change from 10 sec to some other value is it an easy PLC code change instead of RS-View.


or if you want a timer to an event put

Code:
In the macro place the following code
Pause 10 //or your time to up period
VBAExec VBA_ROUTINE_NAME


Or run a VBA script something like that:
Code:
Sub YourRoutine()
Dim objSomething As Something.Application
Dim tTag As Tag

Set tTag = gTagDb.GetTag("System\second")
Set objSomething = CreateObject("Something.Application")

With objSomething
//do what you need using tTag
End With
Set tTag = Nothing
Set objSomething = Nothing
End Sub
Back to top
View user's profile Send private message
Vasilis93
Junior
Junior


Joined: 07 Jun 2016
Posts: 12

PostPosted: 09/06/2016 07:27    Post subject: Reply with quote

I just want to see the time from my Timer-On
that I have put in Ladder.
Back to top
View user's profile Send private message
dumb
Junior
Junior


Joined: 02 Jun 2016
Posts: 8

PostPosted: 09/06/2016 18:18    Post subject: Reply with quote

Vasilis93 wrote:
I just want to see the time from my Timer-On
that I have put in Ladder.


be more explicit I do not understand..
Code:
Sub ReadPlcData()

Dim PlcData1
Dim PauseTime, Start, Finish, TotalTime
Dim RsLinxData1

'Top again loop call.
Topagain:

'Start Rslinx DDE Comms and set DDE Topic.
RsLinxData1 = DDEInitiate("RSLinx", "N7_0")

'Set plc data to variable
PlcData1 = DDERequest(RsLinxData1, "N7:0")
Cells(1, 1).Value = PlcData1

'Timer to reset dummy cell.
PauseTime = 0.5 ' Set duration. In seconds
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents
Loop
Finish = Timer ' Set end time.
TotalTime = Finish - Start ' Calculate total time.

'Goto to of module again to run loop.
GoTo Topagain

End Sub
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    plc.myforum.ro Forum Index -> ALLEN-BRADLEY(Rockwell Automation) All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Fa-ti si tu propriul forum GRATUIT, pe www.myforum.ro