Problem with Serial communication

Faucheuse
2009-03-09
2009-03-10
  • Faucheuse - 2009-03-09

    Hello,

    I tried recently to use the SysLibCom library in CoDeSys with that program :

    IF(result=0)

    THEN

    PortTest:=SysComOpen(2);
    
    
    
    ParamCom.byParity:=0;
    
    ParamCom.byStopBits:=1;
    
    ParamCom.dwBaudRate:=9600;
    
    ParamCom.dwScan:=0 ;
    
    ParamCom.dwTimeout:=0;
    
    ParamCom.Port:=2;
    
    ParamCom.dwBufferSize:=0;
    
    
    
    
    
    result:=SysComSetSettings(PortTest,ADR(ParamCom)) ;
    

    END_IF

    b:='BONJOUR';

    c:=SysComWrite(PortTest,ADR(b),LEN(b), 100) ;

    resultClose:=SysComClose(PortTest);

    But it doesn't work : when I try to access the system, it's write "ParamCom.Port:= ***INVALID : 0", but I can run the program normally.

    What's the matter here ?

    Thanks for your help.

    EDIT : I saw that the matter is the handle returns by the SysComOpen functiun.

     
  • hcchin - 2009-03-10

    May i know what hardware are you using for this SysLibCom library ?

     

Log in to post a comment.