| View previous topic :: View next topic |
| Author |
Message |
Vasilis93 Junior

Joined: 07 Jun 2016 Posts: 12
|
Posted: 07/06/2016 12:21 Post subject: RSView32 |
|
|
| How can i use a timer (up) on my display area in RSView32 Works 100K |
|
| Back to top |
|
 |
dumb Junior

Joined: 02 Jun 2016 Posts: 8
|
Posted: 07/06/2016 19:22 Post subject: Re: RSView32 |
|
|
| 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 |
|
 |
Vasilis93 Junior

Joined: 07 Jun 2016 Posts: 12
|
Posted: 09/06/2016 07:27 Post subject: |
|
|
I just want to see the time from my Timer-On
that I have put in Ladder. |
|
| Back to top |
|
 |
dumb Junior

Joined: 02 Jun 2016 Posts: 8
|
Posted: 09/06/2016 18:18 Post subject: |
|
|
| 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 |
|
 |
|