Author Topic: Disabling Rx Port  (Read 8457 times)

Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
Disabling Rx Port
« on: August 07, 2009, 04:00:06 PM »
Hi Mark,
  I am using one of the Uart connected to a RS485 chip, what ever gets sent out on the tx line also goes onto the rx line, as its half duplex. I set a break in the tx line before sending a command and would like to disable the RX line at the start of the break, and enable it after the breakis complete. I dont mind the characters being returned as I can ignore them, but dont want the break line coming back in.

Is the best way to solve this is to use fnDriver( SerialPortID, RX_OFF , 0 ); , turn back on using the MODIFY_CONFIG?

Is there need to do a fnFlush( SerialPortID, FLUSH_RX); after a MODIFY_CONFIG?

Rgrds,
Neil

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3237
    • View Profile
    • uTasker
Re: Disabling Rx Port
« Reply #1 on: August 07, 2009, 09:40:05 PM »
Hi Neil

fnDriver( SerialPortID, RX_OFF , 0 ); will disable the rx but not flush any input which has already arrived. A flush would ensure that the input buffer is really empty and so could be used as a second step.
Alternatively you could read any input data and discard it.

Regards

Mark