method for reading serial port data