Hi,
I am communicating with a LIN interface (PCAN-LIN) for a project. I am using a CompactLogix PLC with serial port. I was wondering if anyone has had experience communicating via serial commands (ASCII read/write) without using handshaking? The interface we are using doesn't have RS-232 handshaking, just TX/RX. I sometimes find it difficult to get a proper response from the interface because it is filling my buffer with other data. I send it a serial stream of bytes to command it to do something, then expect a response (typically 4 bytes). If I clear my read buffer when I write, then the next message I get is usually the serial stream I expect. The problem is, if it is forwarding messages from the LIN bus (which happens every 10ms or less when the scheduler is running), then my ASCII buffer is constantly filling up with data. When I tell it to turn OFF the master scheduler and stop communicating wit the LIN slaves, I always undershoot when reading (ARD) the response message and receive some trailing bytes from the LIN bus.
Any advice is appreciated!! I am somewhat of a serial n00b.
I am communicating with a LIN interface (PCAN-LIN) for a project. I am using a CompactLogix PLC with serial port. I was wondering if anyone has had experience communicating via serial commands (ASCII read/write) without using handshaking? The interface we are using doesn't have RS-232 handshaking, just TX/RX. I sometimes find it difficult to get a proper response from the interface because it is filling my buffer with other data. I send it a serial stream of bytes to command it to do something, then expect a response (typically 4 bytes). If I clear my read buffer when I write, then the next message I get is usually the serial stream I expect. The problem is, if it is forwarding messages from the LIN bus (which happens every 10ms or less when the scheduler is running), then my ASCII buffer is constantly filling up with data. When I tell it to turn OFF the master scheduler and stop communicating wit the LIN slaves, I always undershoot when reading (ARD) the response message and receive some trailing bytes from the LIN bus.
Any advice is appreciated!! I am somewhat of a serial n00b.