<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.fr.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>5 Aug 2020 11:10:01 Z</lastBuildDate><pubDate>4 Aug 2020 16:21:31 Z</pubDate><description>Bonjour tout le monde, &#13;
&#13;
je découvre la communication entre un appareil et le PC, et j'essaie de comprendre et decouvrir les fonction sEcrit, slit, sEvenement etc... &#13;
&#13;
j'ai essayé avec Hyperterminal, et si j'envois "SN" l'appareil me reponds par son numero de Serie. &#13;
&#13;
j'essaie de reproduire cela sous Windev :&#13;
&#13;
J'ai donc une fenetre, avec une commande a envoyer, un zone pour le retour et un champs pour le numero du port. &#13;
&#13;
Niveau code j'ai : &#13;
&#13;
[code:wl]&#13;
SAI_retour = ""&#13;
NumPort = SAI_NUM_PORT_COM&#13;
&#13;
sFerme(NumPort)&#13;
BufferRx = ""&#13;
SI sOuvre(NumPort, 3000, 3000,sTimeoutDéfaut,Vrai) ALORS&#13;
	sEvénement(NumPort,sEveCaractèreReçu, Lecturecom)&#13;
	sFixeParamètre(NumPort, 38400, 0, 8, 0)&#13;
	sEcrit(NumPort,SAI_Commande)&#13;
SINON&#13;
	Erreur("Erreur d'ouverture du port COM"+NumPort)&#13;
FIN&#13;
[/code]&#13;
&#13;
[code:wl]&#13;
PROCÉDURE Lecturecom()&#13;
&#13;
Trace("Lecturecom")&#13;
i est un entier&#13;
BufferRx += sLit(NumPort,sDansFileEntrée(NumPort))&#13;
// ici on test BufferRx pour savoir si on à reçu le ou les caractères de fin de trame (dépend du protocole)&#13;
// j'ai pris 0x0d = 13 = CR pour l'exemple&#13;
i = Position(BufferRx, Caract(0x0d))&#13;
IF i &gt; 0 THEN&#13;
	// si oui on exploite&#13;
	Trace(BufferRx[[1 À i-1]])&#13;
	BufferRx = BufferRx[[i+1 À]]&#13;
END&#13;
&#13;
[/code]&#13;
&#13;
Le code Lecturecom a été trouvé sur ce forum d'ailleurs. Mais il ne se déclenche pas. C'est la que je ne comprends pas... &#13;
&#13;
La doc de l'appareil préconise : &#13;
&#13;
Bits per second: 38,400&#13;
Data bits: 8&#13;
Stop bits: 1&#13;
Flow control: None&#13;
&#13;
Donc je pense que mon sFixeParamètre est Ok&#13;
&#13;
Du coup, je sais pas d'ou cela peux venir. Si jamais vous avez des idées, je suis preneur, &#13;
&#13;
Merci d'avance !</description><ttl>30</ttl><generator>WEBDEV</generator><language>fr_FR</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/241621-communication-port-com-windev/read.awp</link><title>Communication Port COM / WINDEV</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster><item><author>yohann.michel</author><category>pcsoft.fr.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/241621-communication-port-com-windev-241642/read.awp</comments><pubDate>5 Aug 2020 11:10:01 Z</pubDate><description>Merci Philiipe, &#13;
&#13;
c'est bien le caractère CR qui manquait. &#13;
&#13;
sEcrit(NumPort, "SN"+Caract(0x0d)) &#13;
&#13;
j'ai une réponse, et j'a…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/241621-communication-port-com-windev-241642/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/241621-communication-port-com-windev-241642/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/241621-communication-port-com-windev/read.awp">Communication Port COM / WINDEV</source><title>Re: Communication Port COM / WINDEV</title></item><item><author>Philippe Pasquali</author><category>pcsoft.fr.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/241621-communication-port-com-windev-241623/read.awp</comments><pubDate>4 Aug 2020 17:36:15 Z</pubDate><description>Bonjour&#13;
Si vous remplacez : sEcrit(NumPort,SAI_Commande) par sEcrit(NumPort, "SN") avez-vous la trace : Lecturecom ?&#13;
il faut p…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/241621-communication-port-com-windev-241623/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/241621-communication-port-com-windev-241623/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/241621-communication-port-com-windev/read.awp">Communication Port COM / WINDEV</source><title>Re: Communication Port COM / WINDEV</title></item></channel></rss>
