Having trouble reading in some 8-bit data (not text) from serial port using pyserial module.

Am storing the data in a string buffer as it comes in, that's working fine. Problem is that I'm printing the buffer out to the terminal screen, after a wee bit of data (30~200 it changes randomly), the buffer printout stops printing the data out, but the data is being added to the buffer as I'm also printing out the buffer length, and its increasing.

Below is sample output, see how it just stops printing out to terminal, but the buffer size is still incrementing indicating that data is still being received.


Sorry, had to add pic of code output as it wasn't pasting into here properly.

class Serial_Link(Thread):

    def __init__(self,tempVar):
        self.bignum = tempVar
        self.exit_val = 0
        self.RX_BUFFER = ""
        self.COM3 = serial.Serial()
        self.text = ""
        self.COM_OPEN = False


    def Serial_Read(self):
        if self.COM_OPEN == True:
            byte = self.COM3.read(1)
            self.RX_BUFFER = self.RX_BUFFER + byte
            print "RX_BUFFER: " + self.RX_BUFFER
            print "length: " + str(len(self.RX_BUFFER))

Did you try print repr(self.RX_BUFFER) instead ? Your buffer may contain special characters which confuse the terminal screen.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.