Help! how to create a counter in Cimplicity 8.0

UKA

Member
Join Date
Feb 2011
Location
salvador
Posts
1
Hello, I've been trying to create a "duplicate" of de points in the group I "demo_point" so I've created a copy of the script but Ichanged the "demo" for "park" the thing is that it doesn't starts the count I created
PARK_COSINE
PARK_COUNTER
PARK_POINTS_START_STOP
PARK_RANDOM
PARK_RATE_OF_CHANGE
PARK_SAWTOOTH
PARK_SINE
Points but I didn't create one for LOOP_COUNTER

the script looks like this

Sub Main()

Dim Park_Counter As New Point
Dim Park_Sine As New Point
Dim Park_Cosine As New Point
Dim Park_Rate_Of_Change As New Point
Dim Park_Toggle As New Point
Dim Park_Random As New Point
Dim Park_Sawtooth As New Point
Dim Park_Start_Stop As New Point
Dim Loop_Counter As New Point 'used to start and stop the demo points without resetting them
Dim I As Integer
Dim Rate As Integer 'used to control the rate at which the points change
Dim Flip As Boolean 'used for the sawtooth point

Park_Counter.Id = "PARK_COUNTER"
Loop_Counter.Id = "PARK_COUNTER"
Park_Sine.Id = "PARK_SINE"
Park_Cosine.Id = "PARK_COSINE"
Park_Rate_Of_Change.Id = "PARK_RATE_OF_CHANGE"
Park_Toggle.Id = "PARK_TOGGLE"
Park_Random.Id = "PARK_RANDOM"
Park_Sawtooth.Id = "PARK_SAWTOOTH"
Park_Start_Stop.Id = "PARK_POINTS_START_STOP"
Park_Start_Stop.OnChange
'This was set at 1000--but this puts to much strain on the system
Rate = (1000 / Park_Rate_Of_Change.GetValue) - 200

Park_Rate_Of_Change.OnChange

Flip = True
Loop_Counter.get ' Get the current value of the demo points

WAIT_FOR_START:
Park_Start_Stop.GetNext
If Park_Start_Stop.Value = 0 Then GoTo WAIT_FOR_START

Flip = Not(Flip)

Do While True
Flip = Not(Flip)
If Acquire("SET_PARK_POINTS",0) = False Then Exit Sub
For I = Loop_Counter.GetValue To 200
If Park_Start_Stop.GetNext(0) Then
End If
If Park_Start_Stop.Value = 0 Then GoTo WAIT_FOR_START
If Park_Rate_Of_Change.GetNext(0) Then
Rate = (1000 / Park_Rate_Of_Change.Value) - 200
End If
Randomize
Sleep Rate
Park_Counter.setvalue = I
Park_Sine.setvalue = Sin((I/50)*Pi) * 100
Park_Cosine.setvalue = Cos((I/50)*Pi) * 100
Park_Toggle.setvalue = I Mod 2
Park_Random.setvalue = Random(1,1000)
If Flip then
Park_Sawtooth.setvalue = I
Else
Park_Sawtooth.setvalue = 100 - I
End If
Next I
Loop_Counter.value = 1 'now we want to start from 1, so we reset the loop counter
Loop_Counter.set
Loop


Done:
Park_Start_Stop.Cancel
Park_Rate_Of_Change.Cancel

Release "SET_PARK_POINTS"

End Sub

Can anyone healp me please 🤞🏻
 

Similar Topics

Hi, I'm having trouble understanding my course and I need help please. Can someone please write a program for this process? I will use the answer...
Replies
24
Views
6,360
Im trying to create a save button that will allow the data once inserted in the form, save to a notepad file. The file can be accessed later for...
Replies
5
Views
1,575
PLC Guroos, I need to configure an flow switch ESD signals, but all relevant instruments are in another PLC system, both PLC's are connected with...
Replies
3
Views
1,416
I have an old Sentry Palletizer (S/O Number 3007 / Serial Number 1172) that has lost its program as the backup battery died years ago. I can...
Replies
0
Views
93
Hello, I need to write the following program in Ladder language, but I could not integrate the Fibonacci sequence into the ladder. Can you help...
Replies
22
Views
461
Back
Top Bottom