CTS and RTS on software com port

Discussion of issues related specifically to writing code for native mode devices. This includes ZBasic code as well as assembly language code and C code, both inline and standalone.
Post Reply
sturgessb
Posts: 287
Joined: 25 April 2008, 6:34 AM
Location: Norwich, UK

CTS and RTS on software com port

Post by sturgessb »

Hello

Sorry have been trying this every which way I can think of but I'm doing something wrong.

I just need RTS and CTS flow control on my software com port.

I am adding setting up like this..

Code: Select all

Call OpenQueue(com3RXQueue, SizeOf(com3RXQueue))
	Call OpenQueue(com3TXQueue, SizeOf(com3TXQueue))
	Call DefineCom(3, com3rx_pn, com3tx_pn, &H08)
	
	Call OpenCom(3, 9600, com3RXQueue, com3TXQueue)
	Call ControlCom(3, 27, 28)
Have tried swapping the pin numbers incase i have them wrong and tried both flags, also tried placing control com before open com.

What am i missing?

Cheers

Ben
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: CTS and RTS on software com port

Post by dkinzer »

sturgessb wrote:What am i missing?
What are you seeing?

The ControlCom() call should be made after the OpenCom() call as you've shown. As soon as it is executed, pin 27 should be high indicating that it is OK to transmit to the ZX. Pin 28 should be an input and if that pin is high the ZX will transmit any data available in the output queue.

You can test the operation by connecting pullup resistor and a switch to ground to pin 28. Closing the switch should prevent the ZX from transmitting, opening it should allow transmission. Similarly, you can send characters to the ZX and if they are not removed from the receive queue pin 27 will eventually go low indicating that nothing more should be sent.
- Don Kinzer
dlh
Posts: 395
Joined: 15 December 2006, 12:12 PM
Location: ~Cincinnati

Post by dlh »

Also, what's on the other end of the serial link? Some USB-Serial adapters do not handle handshaking lines as they should.
Post Reply