Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
4
Erster Beitrag:
vor 7 Jahren, 8 Monaten
Letzter Beitrag:
vor 7 Jahren, 8 Monaten
Beteiligte Autoren:
Manfred, Goof.pcs.crosspost, Piet van Zanten

Routine to read 2 serial comm port in same time

Startbeitrag von Manfred am 20.09.2010 00:19

Hey Folks, did you know how to read 2 serial port simultaneous?, i have a routine (ARIE HELPED) for one com, COM1 but need access to other port in the same time, i have 2 barcode reader ones for in and ones for exit, the application must read or capture each one in different times.

Regards people.

Osvaldo (Manfred)

Antworten:

Hi Manfred,

You can change the behaviour of a procedure by right clicking and choose properties.
Then you can make it run in a thread. That way two procedures can be executed simultaneously. I believe this feature is available from version 14, in earlier versions you will have to program the threads manually.

Regards,
Piet

von Piet van Zanten - am 20.09.2010 08:02
Just use the code two times.
2 thread or 2 event driven procedure

Sorry but i code in french.
----------------------------------
// after the port opening
//Détection de caractères sur le port COM1
sEvénement(1,sEveCaractèreReçu,"Lecture")
sEvénement(2,sEveCaractèreReçu,"Lecture")

----------------------------------
// callback proc
Procédure Lecture(NumPort,Event)


sTemp est une chaine = sLit(NumPort,sDansFileEntrée(NumPort))
selon NumPort
cas 1:
GlobalData.Reader1Buffer +=sTemp
// Add the first barcode Reader work here
cas 2:
GlobalData.Reader2Buffer +=sTemp
// Add the second barcode Reader work here
FIN
--------------------------------

I advise you to put a "header" char and a "final" char within your
reader configuration.
This would help you to isolate the barcode more efficiently and work on
it only when the code will be completely transmited, and avoid
incomplete transmissions with fixed lenght barcode.
like : 1234567890123

Bye
Goof

Le 20/09/2010 07:47, Manfred a écrit :
> Hey Folks, did you know how to read 2 serial port simultaneous?, i have a routine (ARIE HELPED) for one com, COM1 but need access to other port in the same time, i have 2 barcode reader ones for in and ones for exit, the application must read or capture each one in different times.
> Regards people.
> Osvaldo (Manfred)

Message forwarded from pcsoft.us.windev

von Goof.pcs.crosspost - am 20.09.2010 11:10
Excelent! Goof, Very usefull your help here my ten stars :spos::spos::spos::spos::spos::spos::spos::spos::spos:[[1]]

von Manfred - am 20.09.2010 12:31
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.