Skip to content
Snippets Groups Projects
Commit a4f0515a authored by rswindell's avatar rswindell
Browse files

Have comOpen() force the port to N-8-1 as some com devices apparently default

to E-7-1.
parent e6d45b5e
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2007 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
......@@ -52,6 +52,7 @@ COM_HANDLE comOpen(const char* device)
{
COM_HANDLE handle;
COMMTIMEOUTS timeouts;
DCB dcb;
if((handle=CreateFile(device
,GENERIC_READ|GENERIC_WRITE /* Access */
......@@ -73,6 +74,14 @@ COM_HANDLE comOpen(const char* device)
SetCommTimeouts(handle,&timeouts);
}
/* Force N-8-1 mode: */
if(GetCommState(handle, &dcb)==TRUE) {
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
SetCommState(handle, &dcb);
}
return handle;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment