Citect - How Do I use a semaphore to block calling code ?

EICS

Member
Join Date
Dec 2008
Location
Melbourne, Australia
Posts
323
I have some code i need to block until a super genie for data entry has completed (by operator input)as per below.


FUNCTION
New_Setpoint()

Code…………..
Code…………..

IF Code…………..

THEN
AssWin("!6FibSP",20,350,41, sTagbase+"_MBSP_NEW");WinTitle("Fiberiser Spinner Speed - Entry");
! pop up Keypad for entry New Speed Setpoint - Rev 1.1

! hSem = SemOpen("WaitTillEntry",1);
! SemWait(hSem, -1);

// I need to block this section onwards until the operator enters a setpoint from the !6FibSP Super Genie
Called from above call
END

iExist_SP = TagRead(sTagbase+"_MBSP"); ! read the existing Setpoint value (Rev 1.2)
iNew_SP = TagRead(sTagbase+"_MBSP_NEW"); ! read the New Setpoint value just entered from above (Rev 1.2)
sNew_SP = IntToStr(iNew_SP); ! convert New Setpoint value just entered from above to STRING (Rev 1.2)
code………………….
code…………………..
code…………………..
code…………………...

[FONT=&quot]END[/FONT][FONT=&quot] [/FONT][FONT=&quot][/FONT][FONT=&quot] [/FONT]
 
for some strange reason i cannot edit my post above? possibly the colors have caused this.


I have some code i need to block until a super genie for data entry has completed (by operator input) as per below.


FUNCTION
New_Setpoint()

Code…………..
Code…………..

IF Code…………..

THEN
AssWin("!6FibSP",20,350,41, sTagbase+"_MBSP_NEW");WinTitle("Fiberiser Spinner Speed - Entry");
! pop up Keypad for entry of New Speed Setpoint - Rev 1.1



// I need to wait here until super genie entry of new setpoint is made.

// cannot use Sleep(x)


// hSem = SemOpen("WaitTillEntry",1); <---- Having trouble here
// SemWait(hSem, -1); <---- Having trouble here

// I need to block this section onwards until the operator enters a setpoint from the !6FibSP Super Genie
Called from above call



END

iExist_SP = TagRead(sTagbase+"_MBSP"); ! read the existing Setpoint value (Rev 1.2)
iNew_SP = TagRead(sTagbase+"_MBSP_NEW"); ! read the New Setpoint value just entered from above (Rev 1.2)
sNew_SP = IntToStr(iNew_SP); ! convert New Setpoint value just entered from above to STRING (Rev 1.2)
code………………….
code…………………..
code…………………..
code…………………...

[FONT=&quot]END[/FONT]
 
for some strange reason i cannot edit my post above? possibly the colors have caused this.


I have some code i need to block until a super genie for data entry has completed (by operator input) as per below.


FUNCTION
New_Setpoint()

Code…………..
Code…………..

IF Code…………..

THEN
AssWin("!6FibSP",20,350,41, sTagbase+"_MBSP_NEW");WinTitle("Fiberiser Spinner Speed - Entry");
! pop up Keypad for entry of New Speed Setpoint - Rev 1.1



// I need to wait here until super genie entry of new setpoint is made.

// cannot use Sleep(x)


// hSem = SemOpen("WaitTillEntry",1); <---- Having trouble here
// SemWait(hSem, -1); <---- Having trouble here

// I need to block this section onwards until the operator enters a setpoint from the !6FibSP Super Genie
Called from above call



END

iExist_SP = TagRead(sTagbase+"_MBSP"); ! read the existing Setpoint value (Rev 1.2)
iNew_SP = TagRead(sTagbase+"_MBSP_NEW"); ! read the New Setpoint value just entered from above (Rev 1.2)
sNew_SP = IntToStr(iNew_SP); ! convert New Setpoint value just entered from above to STRING (Rev 1.2)
code………………….
code…………………..
code…………………..
code…………………...

[FONT=&quot]END[/FONT]

Trying to fill in the gaps and not knowing what your trying to achieve.
But looking at what you have I would be making smaller re-usable functions, and not trying to use semaphores or pausing code until....
If operator changes set point call a function.
 
yes sorry chelton, I don't know the correct terminology so its hard to explain. but I will try in sparky speak. this is what I want to do for 9 devices.

I have the code executing already for my test project and am happy its stable. but its specific to that device. i need to make the same code work for all 9 without duplicating.

what i want to do

- i call a super genie for operator entry of the new set point
- operator enters new sp
- new sp is compared to existing and if OK within process parameters (calls separate function on operator entry) a message appears to prompt operator to accept or reject, if not within process parameters message windows appear informing rejection due to many reasons

I woke up this morning with a better idea. i will try this when on-site Monday.

AssWin("!6FibSP",20,350,41, sTagbase+"_MBSP_NEW");WinTitle("Fiberiser Spinner Speed - Entry");

// my cicode above calls the the !6FibSP super genie, I will pass 2 arguments to the !6FibSP super genie (operator entry number pad) i will then pass the 2 arguments from the super genie to a new function (with my other code inside)on new Set point entry.

so i have one super genie i will call it "SG1" to simplify (SG1 - is general device control) this calls another super genie (SG2 - operator entry number pad) which I will then call a function "Limits" for the entry parameter check and messaging.

would i be correct that that i can use the cicode object symbol in graphics builder to accept the 2 arguments (1 string and 1 Int) in SG2 from the calling SG1 super genie. or would this be done in page properties "on page entry"

i would then pass 2 arguments (1 string and 1 Int)from the operator "ENTER" command to my function "Limits"
 
Last edited:

Similar Topics

Hello, the system we use is Scada 7.5 series. We have usb key activ now we need additional key to make the system work, how do we solve this...
Replies
0
Views
33
So i've been at this for a long while, i have Citect Scada 2018, i have full access to everything but i can't seem to find any option or...
Replies
0
Views
67
Hello, i've been at this for months now, i tried creating accounts on the aveva website but it seems to never approve my accounts or at least when...
Replies
3
Views
97
Hello, I have a running project on Citect v5.42 and simatic net v6.4 I have created a new spare PC and loaded all software like Citect, station...
Replies
0
Views
76
Hello everyone, In a factory where we installed Citect 7.20 the computer began to show the first signs of end of life. They never considered...
Replies
0
Views
83
Back
Top Bottom