Article View: borland.public.cppbuilder.nativeapi
Article #6479Re: Response not in que?
From: Neil P.
Date: Wed, 11 May 2005 19:53
Date: Wed, 11 May 2005 19:53
102 lines
4702 bytes
4702 bytes
My colleague and I believe your absolutetly correct!!!!!!!!
We can't believe we missed that, timing issue!!!!!
Your right about the 2 bits missing in my equation (Start & Stop bit), your
also right about
immediately after my write I jump into my read. By the time I initiate my
write and actual bits
start pumping out, I am already started in my read routine counting down
time. Not only that,
but it takes time for the embeded unit to process that byte determine what
it needs to do with it
and then dishout a response, which then it has to be placed in the uart of
the pc, then go thru
who knows how many Window layers, before it actually gets placed in the que!
I will take a good look at what you told me to try, but I believe that by
just incrementing my
millisecond multiplier it will take care of the issue I am seeing.
Here is my init function of the port by the way:
/---------------------------------------------------------------------------
---
// Initialize and configure the port
//--------------------------------------------------------------------------
----
bool __fastcall Comm::PortInitialize(char *COMSEL)
{
// Local variable declarations
DCB dcbPort; // Structure for a serial communications device.
bool bRespond; // Signals if the COMM tested, is free
// Open the serial COMM port
hComm = CreateFile (COMSEL, // Port name
GENERIC_READ | GENERIC_WRITE, // Access (read/write)
// mode
0, // Share mode(object cannot be
share)
NULL, // No security attribute
OPEN_EXISTING, // How to open the serial port
FILE_FLAG_OVERLAPPED, // File attributes
NULL // hTemplate is NULL for comm
devices
);
// Check if the commport is free
if (hComm == INVALID_HANDLE_VALUE)
bRespond = false;
else
{ // Begin else statement (comm is free)
dcbPort.DCBlength = sizeof (DCB);
// Get the default port setting information
if (!GetCommState (hComm, &dcbPort))
// Report the error
ReportError();
else
{ // Begin else statement (GetCommState)
// Change the DCB structure settings
dcbPort.BaudRate = 9600; // Current baud
dcbPort.ByteSize = 8; // Number of bytes
dcbPort.Parity = NOPARITY; // Parity
dcbPort.StopBits = ONESTOPBIT; // Stop bit
// Configure the port according to the specifications of the DCB
// structure
if (!SetCommState (hComm, &dcbPort))
bRespond = false;
else
{ // Begin else statement
// The next three lines tell the read function to return
// immediately when no bytes are waiting in the port's receive
// queue
memset(&comtime, 0, sizeof(comtime));
comtime.ReadIntervalTimeout = MAXDWORD;
SetCommTimeouts(hComm, &comtime);
// Port available
bRespond = true;
} // End else statement
} // End else statement (GetCommState)
} // End else statement (comm is free)
return bRespond;
}
I probably will not respond until tomorrow, since I am going to go ahead and
test, everything out!
Thank you,
Thank you,
Thank you,
Neil P.
Technical Details
Message-ID:
<428264a9$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<427fa27e@newsgroups.borland.com> <vugv711ona1kdbekucqqkg6csqkcd4agrd@4ax.com> <427fca8b$1@newsgroups.borland.com> <427fce92$1@newsgroups.borland.com> <427fd0af@newsgroups.borland.com> <427ff371$1@newsgroups.borland.com> <42820cad$1@newsgroups.borland.com> <0fd4815hque964clpuqu52okn4rsq7n2fh@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,369fa724017da622 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Neil P." <nporve01@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <427fa27e@newsgroups.borland.com> <vugv711ona1kdbekucqqkg6csqkcd4agrd@4ax.com> <427fca8b$1@newsgroups.borland.com> <427fce92$1@newsgroups.borland.com> <427fd0af@newsgroups.borland.com> <427ff371$1@newsgroups.borland.com> <42820cad$1@newsgroups.borland.com> <0fd4815hque964clpuqu52okn4rsq7n2fh@4ax.com> Subject: Re: Response not in que? Date: Wed, 11 May 2005 15:53:34 -0400 Lines: 105 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 68.209.111.59 Message-ID: <428264a9$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1115841705 68.209.111.59 (11 May 2005 13:01:45 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail