Release COM2 (CTS, RTS)
#1
Posted 24 July 2012 - 01:40 PM
#2
Posted 25 July 2012 - 07:54 AM
#3
Posted 25 July 2012 - 11:47 PM
#4
Posted 26 July 2012 - 12:13 AM
Hi Nobby,
Below is my statement.
m_objCommMgr = New cCommManager("COM2", 9600, Ports.Parity.None, 8, Ports.StopBits.One)
so far, I have not connected RTS and CTS since i am only using 3 wire interface. Since on the board layout, for COM2 it comes with RTS and CTS (derived from GPIO pins), I just wonder if we can disable these RTS and CTS when using COM2. Thus giving my project the much needed GPIO to measure the pulse input.
Care to share how do you initialise your COM2 without RTS & CTS?
Thanks in advance.
The general rule-of-thumb with microcontrollers is that pin assignments aren't always restricted to their architectural labelling. For example, a pin maybe labelled as PWM(Pulse Width Modulator) which would normally tie-in with a hardware clock and hardware interrupts. By default, the pin doesn't function as a PWM unless you actually configure it to be.
Much the same with the CTS and RTS pins, you can configure them as OutputPorts or InterruptPorts. If you try to use them for two purposes, you'll get a runtime exception when trying to initialise the pin for a second use. Example of using the RTS pin as a GPIO pin
SerialPort comPort = (SerialPorts.COM2, 9600, Parity.None, 8, StopBits.One); //Initialise COM2 OutputPort oPort = new OutputPort(Pins.GPIO_PIN_D7, false); //initialise the RTS pin as an output port with logic low as initial value;
#5
Posted 26 July 2012 - 01:23 AM
The general rule-of-thumb with microcontrollers is that pin assignments aren't always restricted to their architectural labelling. For example, a pin maybe labelled as PWM(Pulse Width Modulator) which would normally tie-in with a hardware clock and hardware interrupts. By default, the pin doesn't function as a PWM unless you actually configure it to be.
Much the same with the CTS and RTS pins, you can configure them as OutputPorts or InterruptPorts. If you try to use them for two purposes, you'll get a runtime exception when trying to initialise the pin for a second use. Example of using the RTS pin as a GPIO pin
SerialPort comPort = (SerialPorts.COM2, 9600, Parity.None, 8, StopBits.One); //Initialise COM2 OutputPort oPort = new OutputPort(Pins.GPIO_PIN_D7, false); //initialise the RTS pin as an output port with logic low as initial value;
Hi Nobby,
wonderful... That clears my doubts.
Just for knowledge, how can I configure PIND7 as RTS, do you have the code for it?
Thanks in advance.
#6
Posted 26 July 2012 - 12:58 PM
Hi Nobby,
wonderful... That clears my doubts.
Just for knowledge, how can I configure PIND7 as RTS, do you have the code for it?
Thanks in advance.
Sorry I've never needed CTS or RTS in any application. I'm fairly sure its only modern use is for UART communications which have multiple devices on the shared three-wire interface and have an address they respond to. There are still some ancient RS232 devices out there which require CTS & RTS for end-to-end comms.
From what I have seen with the .Net framework though, you need to specify hardware flow control on the SerialPort object. It supports XOn/XOff and RequestToSend or a hybrid. You do this through the SerialPort.Handshake property at runtime. I believe once you configure your serial port this way, it will configure the RTS and CTS pins to function with the serial port.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users