Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Serial Port software handshaking

Status
Not open for further replies.

enemra

Junior Member level 1
Joined
Oct 19, 2011
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,440
Dear all,

I am struck with serial port programming. The scenario is like this-

PROBLEM 1:

Establish a communication between PC and a microcontroller board via serial port. There are options in microcontroller to set HARDWARE HANDSHAKE or SOFTWARE HANDSHAKE.

My program in PC side is like this...........

if (iHandshakeType=="SOFTWARE")
{
dcb.fOutxCtsFlow = FALSE;
dcb.fOutxDsrFlow = FALSE;
dcb.fDtrControl = DTR_CONTROL_DISABLE;
dcb.fRtsControl = RTS_CONTROL_DISABLE;
dcb.fOutX = TRUE;
dcb.fInX = TRUE;
dcb.XonChar = 0x11;
dcb.XoffChar = 0x13;
dcb.XoffLim = 100;
dcb.XonLim = 100;

}
if (iHandshakeType=="HARDWARE)
{
dcb.fDtrControl = DTR_CONTROL_HANDSHAKE;
dcb.fOutxDsrFlow = FALSE;
dcb.fRtsControl = RTS_CONTROL_DISABLE;
dcb.fOutX = FALSE;
dcb.fInX = FALSE;
}

The hardware handshaking works fine but software handshaking doesn't work.

It is given in microcontroller datasheet that it sends data if it receives XON from PC side. Other than this, nothing else is mentioned.

I also doub't whether XON lim should be 1 ????

PROBLEM 2:

Suppose if the above program works fine, can I write like this..???

"
dcb.fOutxCtsFlow = FALSE;
dcb.fOutxDsrFlow = FALSE;
dcb.fDtrControl = DTR_CONTROL_DISABLE;
dcb.fRtsControl = RTS_CONTROL_DISABLE;
dcb.fOutX = TRUE;
dcb.fInX = TRUE;
dcb.XonChar = 0x11;
dcb.XoffChar = 0x13;
dcb.XoffLim = 100;
dcb.XonLim = 100;

dcb.fDtrControl = DTR_CONTROL_HANDSHAKE;
dcb.fOutxDsrFlow = FALSE;
dcb.fRtsControl = RTS_CONTROL_DISABLE;
dcb.fOutX = FALSE;
dcb.fInX = FALSE;

"- enable both hardware and software handshake no matter either any option is selected in the board. Will this work??

PROBLEM 3:

Is it necessary that I should mention these lines in code?

dcb.XonChar = 0x11;
dcb.XoffChar = 0x13;
dcb.XoffLim = 100;
dcb.XonLim = 100;

Won't dcb.fOutX = TRUE;
dcb.fInX = TRUE; Isn't these are just enough for SOFTWARE handshake?

Thanks
 
Last edited:

Anyone please...........
 

which pc language you r using whatever data you need to send or recieve can be done through VTerminal in start menu and microcontroller has SCON register which is used to set baud rate and bits check baud rate and bits should be matching in pc and ucontroller.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top