SerialPortError

Just starting out? Need help? Post your questions and find answers here.
User avatar
SPP
User
User
Posts: 44
Joined: Sun Mar 04, 2007 10:34 am
Location: BCN - SPAIN

SerialPortError

Post 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
The PB community is great... nice to meet you!
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: SerialPortError

Post 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
User avatar
SPP
User
User
Posts: 44
Joined: Sun Mar 04, 2007 10:34 am
Location: BCN - SPAIN

Re: SerialPortError

Post 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
The PB community is great... nice to meet you!
Post Reply