codigo original, como lo encontre en el ejemplo y ya puentie los pines 2 y 3 de mi db-9 y no funciona y tambien ya puentie los 2y3 , 4y6, 7y8 que son para prueba de loopback segun la idea es q el mismo dato q envia, lo recibe por el mismo puerto y no me funciona de ninguna forma
Código HTML:
Ver original
<HTML> <head> <script> function conectar() { objSerie.CommPort = document.forma.puertoSerie.value; objSerie.PortOpen = true; forma.cadena.value = ""; forma.cadena.focus(); forma.texto.value += "Conectado\n" } function desconectar() { objSerie.PortOpen = false; } function enviar() { var cadena = forma.cadena.value; objSerie.Output = cadena; forma.texto.value += "local: " + cadena + "\n"; forma.cadena.value = ""; forma.cadena.focus(); } function comunicacion() { if ( objSerie.CommEvent == 2 ) {//si estamos recibiendo datos var cadena = objSerie.Input; forma.texto.value += "remoto: " + cadena + "\n"; } } </script> </head> <BODY onunload="desconectar();" style="margin:1px 0 0 10"> <OBJECT id="objSerie" classid="clsid:648A5600-2C6E-101B-82B6-000000000014" VIEWASTEXT> <PARAM NAME="_ExtentX" VALUE="1005"> <PARAM NAME="_ExtentY" VALUE="1005"> <PARAM NAME="_Version" VALUE="393216"> <PARAM NAME="BaudRate" VALUE="9600"> <PARAM NAME="CommPort" VALUE="2"> <PARAM NAME="DataBits" VALUE="7"> <PARAM NAME="DTREnable" VALUE="1"> <PARAM NAME="EOFEnable" VALUE="0"> <PARAM NAME="Handshaking" VALUE="0"> <PARAM NAME="InBufferSize" VALUE="1024"> <PARAM NAME="InputLen" VALUE="0"> <PARAM NAME="InputMode" VALUE="0"> <PARAM NAME="NullDiscard" VALUE="0"> <PARAM NAME="OutBufferSize" VALUE="512"> <PARAM NAME="ParityReplace" VALUE="63"> <PARAM NAME="RThreshold" VALUE="1"> <PARAM NAME="RTSEnable" VALUE="0"> <PARAM NAME="ParitySetting" VALUE="0"> <PARAM NAME="SThreshold" VALUE="1"> <PARAM NAME="StopBits" VALUE="0"> </OBJECT> <form name="forma" onsubmit="return false;"> <table style="border:1 solid black" cellpadding="4" cellspacing="0"> <tr style="background:cornsilk"> <td> <select id="puertoSerie"> <option value="1">COM1 <option value="2">COM2 </select> </td> </tr> <tr style="background:cornsilk"> </tr> <tr> </td> </tr> </table> </BODY> </HTML>
y modificado para saber si asegurarme q hace las conecciones y envio de datos
Código HTML:
Ver original
<HTML> <head> <script> function conectar() { document.getElementById('objSerie').CommPort = document.forms["forma"].puertoSerie.value; document.getElementById('objSerie').PortOpen = true; if (document.getElementById('objSerie').PortOpen==true){ document.forms["forma"].cadena.value = ""; document.forms["forma"].cadena.focus(); document.forms["forma"].texto.value += "Conectado al puerto: "+document.objSerie.CommPort+"\n"; } else{ document.forms["forma"].texto.value += "No se ha establecido la coneccion con el puerto\n"; } } function desconectar() { document.getElementById('objSerie').PortOpen = false; } function enviar() { var cadena = document.forms["forma"].cadena.value; document.getElementById('objSerie').Output = cadena; document.forms["forma"].texto.value += "cadena en objSerie.output: " + document.getElementById('objSerie').Output + "\n"; document.forms["forma"].texto.value += "local: " + cadena + "\n"; document.forms["forma"].cadena.value = ""; document.forms["forma"].cadena.focus(); } function comunicacion() { document.forms["forma"].texto.value += "entro a la funcion comunicacion\n"; document.forms["forma"].texto.value += "remoto: " + document.getElementById('objSerie').CommEvent + "\n"; if ( document.getElementById('objSerie').CommEvent == 2 ) {//si estamos recibiendo datos document.forms["forma"].texto.value += "cadena en objSerie.input: " + document.getElementById('objSerie').Input + "\n"; var cadena = document.getElementById('objSerie').Input; document.forms["forma"].texto.value += "remoto: " + cadena + "\n"; } else{ document.forms["forma"].texto.value += "entra pero no da el valor de: " + document.getElementById('objSerie').Input; } } </script> </head> <BODY onUnload="desconectar();" style="margin:1px 0 0 10"> <OBJECT id="objSerie" classid="clsid:648A5600-2C6E-101B-82B6-000000000014" VIEWASTEXT> <PARAM NAME="_ExtentX" VALUE="1005"> <PARAM NAME="_ExtentY" VALUE="1005"> <PARAM NAME="_Version" VALUE="393216"> <PARAM NAME="BaudRate" VALUE="9600"> <PARAM NAME="CommPort" VALUE="3"> <PARAM NAME="DataBits" VALUE="7"> <PARAM NAME="DTREnable" VALUE="1"> <PARAM NAME="EOFEnable" VALUE="0"> <PARAM NAME="Handshaking" VALUE="0"> <PARAM NAME="InBufferSize" VALUE="1024"> <PARAM NAME="InputLen" VALUE="0"> <PARAM NAME="InputMode" VALUE="0"> <PARAM NAME="NullDiscard" VALUE="0"> <PARAM NAME="OutBufferSize" VALUE="512"> <PARAM NAME="ParityReplace" VALUE="63"> <PARAM NAME="RThreshold" VALUE="1"> <PARAM NAME="RTSEnable" VALUE="0"> <PARAM NAME="ParitySetting" VALUE="0"> <PARAM NAME="SThreshold" VALUE="1"> <PARAM NAME="StopBits" VALUE="0"> </OBJECT> <form name="forma" onSubmit="return false;"> <table style="border:1 solid black" cellpadding="4" cellspacing="0"> <tr style="background:cornsilk"> <td> <select id="puertoSerie"> </select> </td> </tr> <tr style="background:cornsilk"> </tr> <tr> </td> </tr> </table> </form> </BODY> </HTML>
espero puedan ayudarme, si alguien lo hace funcionar favor de postearlo.
gracias