Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 7 Jahren, 7 Monaten
Letzter Beitrag:
vor 7 Jahren, 7 Monaten
Beteiligte Autoren:
cardcoder, Erik Schwarz, PlusPoint

problem to Configure the serial port

Startbeitrag von PlusPoint am 18.07.2010 16:29

Hi,

Now i have problem to Configure the serial port
i m using Code as below :
=============================
IF PortNum > 0 THEN
// String to write into the port
sStringToWrite is string = "String to write"
nLengthWritten is int // Length of the string that was written
SizeInputBuffer is int = 5000// Size of buffer for read operations
SizeOutputBuffer is int = 5000// Size of buffer for write operations
// Time-out between two characters for sRead/sWrite (in ms)
BufferTimeout is int = 100

// Open the port
IF NOT sOpen(PortNum, SizeInputBuffer, SizeOutputBuffer, BufferTimeout) THEN
//Error("Error opening COM" + PortNum)
ELSE
// Configure the port
IF NOT sParameter(PortNum, 19200, 0, 8, 0, True, True, True) THEN
==============================================
sParameter is not working.
can you tell if i m doing anything wrong, all combination of true, false, even i tried for Parity combination.

i have problem with serial Printer and Serial scanner. i want to change baudrate to 19200 instead of 9600. now what i doing is changing baudrate from DIP Switch to 9600.



Thanks & regards,

Chandrahas

Antworten:

Hi,

I am using serial com since 10 years and Windev extensively, never had problems.
Maybe i am never using automatic DTR, RTS or xon/off control.

Try with sparameter(PortNum,19200,0,8,0) without optional parameters

Erik

von Erik Schwarz - am 19.07.2010 07:05
Chandrahas,

You have to work the software to the physical port settings of the device.

We sometimes have issues where we are talking to 3rd party software e.g. credit card authorisation modules. They work at fixed baud rates for their printing procedures.

The best way is to change the dip switch settings on the device and then do a test print. this will give the baud rate, data, stop bits, parity etc.

You can hard code them, but it easier to put them in an ini file with the comport number as well. This makes it more flexible if you change the printer.

Hope this is of help.

Mike Allison

von cardcoder - am 19.07.2010 09:24
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.