Citect Cicode PC COM Communication

Monad

Member
Join Date
Aug 2012
Location
berlin
Posts
3
i'm a beginner with Citect and Cicode.
i want to send some data to pc com1 port.
i want to use ComOpen and ComWrite functions in cicode.
but when i run my project, the defined com port will be opened and ComOpen function return -1 value.
i will appreciate you help.

this my cicode code:

FUNCTION OpenPort()

INT hPort;
STRING sPort;
STRING Send;

sPort = "PORT1_BOARD1"
hPort = ComOpen (sPort,1);
mmes = hPort;

IF hPort >= 0 THEN

Send = "somedata";
SendLength = StrLength(Send);
ComWrite(hPort,Send,SendLength,2);

ELSE
Prompt("Not Open");
Message ("Info","Port NOT Opend.", 0);
END
END
 

Similar Topics

I am trying to display a variable within a cicode function onto a graphics page. This function queries a SQL database. I can get the value onto a...
Replies
3
Views
288
Hi guys, its my first time progamming cicode and I need to do popups alarms, there are several digital alarms and in their rising edge transition...
Replies
0
Views
507
Is there a way to run a Cicode function in the Cicode Editor? I have a function that works but I would like to run it without having a button on...
Replies
12
Views
2,983
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
Does anyone have a Citect 2018 CiCode Reference Guide in pdf Format??? I know all the functions are in the help but..... I like to print them out...
Replies
5
Views
2,229
Back
Top Bottom