Help with Citect cicode - i must be close ?

EICS_2

Member
Join Date
Mar 2015
Location
Melbourne
Posts
49
Some cicode help required Please. i am by no means a cicode expert.

i have a tag "D2_WESP_TRA_Op_stat" which depending on its returned integer value is a fault code which relates to some text.

i want to display this fault code "text" on my page. another forum member suggested to use the select case function.

i have a text display on my graphics page with the function Display_TR_Alarm(iTag) in the expression. i get a complile "WARNING" from this(but no errors) when i compile.

where have i gone wrong? the following is my cicode function "Display_TR_Alarm"

STRING
FUNCTION Display_TR_Alarm(INT iD2_WESP_TRA_Op_stat)
STRING sD2_WESP_TRA_Op_stat
SELECTCASE iD2_WESP_TRA_Op_stat
CASE1! if the Value of Alarm Status word 2 is 1 then display Line Vac Abnormal
sD2_WESP_TRA_Op_stat = "Line Vac Abnormal"
CASE2! if the Value of Alarm Status word 2 is 2 then display Low Bus Voltage
sD2_WESP_TRA_Op_stat = "Low Bus Voltage"
CASE4! if the Value of Alarm Status word 2 is 4 then display Low Liquid Level
sD2_WESP_TRA_Op_stat = "Low Liquid Level"
CASE8! if the Value of Alarm Status word 2 is 8 then display Reserved
sD2_WESP_TRA_Op_stat = "Reserved"
CASE16! if the Value of Alarm Status word 2 IS 16 then display Door Open
sD2_WESP_TRA_Op_stat = "Door Is Open"
CASE32! if the Value of Alarm Status word 2 IS 32 then display Remote Mode & OFF
sD2_WESP_TRA_Op_stat = "Remote Mode & OFF"
CASE48! if the Value of Alarm Status word 2 IS 48 then display Remote Mode & ON
sD2_WESP_TRA_Op_stat = "Remote Mode & ON"
CASEELSE
sD2_WESP_TRA_Op_stat = "No Alarms"
ENDSELECT
RETURN sD2_WESP_TRA_Op_stat
END


display.JPG
 
Last edited:
Your code seems to be missing a few spaces, but it looks like a PLCS issue because it would've generated compile errors otherwise.

What sort of compile warnings are you getting? I don't think you mentioned it yet.

As an aside, that select case statement looks like it's gonna have trouble handling situations where multiple alarms are triggered simultaneously.
 
thanks for the prompt reply. the warning i get is "Tag not defined" and the context is "Line[1]:Display_TR_Alarm({iTag})" for that string expression in the text properties. yes multiple alarm will be a problem but not sure if the io device will report this. i can come back to that .

i have been called to a meeting so my reply after this may be slow. many thanks in advance for your assistance.

regards
Alan
 
That compile warning is because Citect doesn't know what iTag is, as you haven't defined it in the tag database. Assuming you aren't using a genie for this, you will need to replace 'iTag' with the actual tag name of the TR_alarm tag you are reading.
 
thanks Von Hydro, my I/O device can end up with values from 0 - 65,535 according to the manual, now i certainly won't be adding every combination of alarms only the most meaningful and practical.
 
That compile warning is because Citect doesn't know what iTag is, as you haven't defined it in the tag database. Assuming you aren't using a genie for this, you will need to replace 'iTag' with the actual tag name of the TR_alarm tag you are reading.

Thanks Rlao all good now.
 

Similar Topics

in the past i have only been doing small mods to existing cicode and coping sections to reuse and modify to suit. Now i have been tasked to write...
Replies
5
Views
2,785
Hi all, my citect program write all the alarms to a xls file when i open that excel i will run a marco automatic and i can see a bargraph of all...
Replies
4
Views
3,929
Hi If any Citect guru would see this, I'd be very :bow: and even more if answers... Using v7.10 and would like to get some .pdf or something, to...
Replies
1
Views
3,562
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
73
I have DI module ICPCon M7024UD connect to my pc using COM3 MODBUS RTU and also RHT sensors are using MODBUS TCPIP.. The problem is, it cannot...
Replies
9
Views
1,668
Back
Top Bottom