Author Topic: Enabling/Disabling Serial port  (Read 5683 times)

Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
Enabling/Disabling Serial port
« on: June 17, 2014, 03:16:30 PM »
Hi Mark,
   Throughout my application I wish to simply switch off/on the RX side of a serial port, but also keep all settings as before (baud rate,handshaking etc..).  Can I simply use the lines:
   fnDriver( SerialPortID,RX_ON, 0 );   
            and
   fnDriver( SerialPortID,RX_OFF, 0 );   

  Regards
   Neil

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Enabling/Disabling Serial port
« Reply #1 on: June 17, 2014, 03:44:33 PM »
Hi Neil

fnDriver( SerialPortID,RX_OFF, 0 );  will disable the receiver and its interrupts and
fnDriver( SerialPortID,RX_ON, 0 );  will configure teh RX pins, enable its interrupts and enable receptiopn.

That means that you should be abel to use the two to alternate between Rx on/off.

It may also be possible to do the same by directly controlling the pin function of the RXD pin and switch it between GPIO and RXD - when set to GPIO it will not receive any data, which would have the same result the same as disabling the Rx.

Regards

Mark