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
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