Page 1 of 1

SerialPortError

Posted: Tue May 31, 2011 7:05 pm
by SPP
Hi,

I'm using the SerialPort functions integrated in PB 4.50
There is no problem in open the port, write and read data, and so on...
but the function SerialPortError always returns a value of 28 (1C hex),that seems means this:
#PB_SerialPort_Break
#PB_SerialPort_Frame
#PB_SerialPort_RxParity
If the port works fine, why this function returns an error?
Does anyone have the same problem?

Thanks

Re: SerialPortError

Posted: Wed Jun 01, 2011 6:28 am
by infratec
Hi SPP,

do you have serial port errors :?:

Because the results of SerialPortError() are only valid if an error occured before.
(That's the text in the helpfile: Returns the error if ... fails)

So you should use it in that way:

Code: Select all

if AvailableSerialPortInput() > 0
  if ReadSerialPortData() = 0
   debug SerialPortError()
  endif
endif
Bernd

Re: SerialPortError

Posted: Wed Jun 01, 2011 3:46 pm
by SPP
Hi Bernd, thanks for your reply,

You're right, the help file says:
"Return the error on the #SerialPort when ReadSerialPortData(), WriteSerialPortData() or WriteSerialPortString() fail"
i didn't see it, but... in order to detect a problem, I expected that after performing any port operation, if there`s no problem, this function returns 0.


Thanks again,
Best regards