Mahan Posted July 27, 2012 Report Posted July 27, 2012 Hi. i'm a beginner with Cicode Scada. i'm trying to send some (non-protocol) data via Com1 on my PC to a Device . i wrote a code in Cicode to open a Port i define in Port database named Port1_Bord1 but every time i run my project all ports automatically will be opened and ComOpen function always return -1 value; 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 will appreciate your helps. Quote
chelton Posted July 27, 2012 Report Posted July 27, 2012 A few things to check. For an onboard com port1 your Boards and ports form should look similar to the attached screen shot. Ensure there are no IO/Devices using this Port. Also the port can only be opened once. If the port is open and you try to re-open it it will return -1. Quote
Mahan Posted July 27, 2012 Author Report Posted July 27, 2012 Hi chelton. i checked the Board and Port data. they are almost the same as you said. but when i run my project all ports are open with out any command. do you know what should i do? Quote
chelton Posted July 27, 2012 Report Posted July 27, 2012 (edited) Is there another program/driver running on the pc that maybe using the same com port? Like AB software with DF1 driver? Edited July 27, 2012 by chelton Quote
Mahan Posted July 27, 2012 Author Report Posted July 27, 2012 no i create a new single project. there is no any other program or software using this port. i remove all IO devices but ports will be open when i run the project. Quote
BobB Posted July 31, 2012 Report Posted July 31, 2012 I would suggest you contact Citect global support with your issue, provided the product is in support. You can zip the project and send it to them. ww.citect.com Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.