Respond to serial port while processing other jobs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ulala099
    New Member
    • Aug 2008
    • 3

    Respond to serial port while processing other jobs

    Hi,
    I am programming GM862 using python. In my program the device should wait for serial port command for unlimited time and respond to any command while processing other parts of the program at the same time.

    For example My device logs data continuously. Now If I connect my PC to the device and send command "date" then it should respond to it and send the present time and date. But it should not stop processing the data.

    How can I do that? Any idea or suggestion?

    Thanks in advance.
  • Formula
    New Member
    • Aug 2008
    • 11

    #2
    Code:
    import socket
    
    timeout = 300 # seconds
    socket.settimeout(timeout)
    Or put zero for unlimited time

    Comment

    • ulala099
      New Member
      • Aug 2008
      • 3

      #3
      Originally posted by Formula
      Code:
      import socket
      
      timeout = 300 # seconds
      socket.settimeout(timeout)
      Or put zero for unlimited time
      Hi,
      Thanks for your reply.

      But this is not for serial port. Rather this is for networking, isn't it?

      I was trying SER.read() , SER.receive(tim eout) , SER.receivebyte (timeout). I couldn't find any function for reading line like readline() for GM862. How can I solve this problem?

      Comment

      Working...