I just freehanded most of this, so there may be some errors. It should give you a basic idea though. It of course is by no means complete, but should provide a start for you. The first part you should already be familiar with.
const char *portName = "\\\\.\\COM1";
//Open the port
portHandle=CreateFileA(portName, GENERIC_READ|GENERIC_WRITE,0, NULL, OPEN_EXISTING, 0, NULL);
if (portHandle == INVALID_HANDLE_VALUE)
unsigned long confSize = sizeof(COMMCONFIG);
Win_CommConfig.dwSize = confSize;
GetCommConfig(portHandle, &Win_CommConfig, &confSize);
Win_CommConfig.dcb.Parity = 0;
Win_CommConfig.dcb.fRtsControl = RTS_CONTROL_DISABLE;
Win_CommConfig.dcb.fOutxCtsFlow = FALSE;
Win_CommConfig.dcb.fOutxDsrFlow = FALSE;
Win_CommConfig.dcb.fDtrControl = DTR_CONTROL_DISABLE;
Win_CommConfig.dcb.fDsrSensitivity = FALSE;
Win_CommConfig.dcb.fTXContinueOnXoff = FALSE;
Win_CommConfig.dcb.DCBlength = sizeof(DCB);
//Set the baud rate to 160, I THINK this works....
Win_CommConfig.dcb.BaudRate = 160;
Win_CommConfig.dcb.ByteSize = 8;
Win_CommTimeouts.ReadIntervalTimeout = 50;
Win_CommTimeouts.ReadTotalTimeoutMultiplier = 0;
Win_CommTimeouts.ReadTotalTimeoutConstant = 110;
Win_CommTimeouts.WriteTotalTimeoutMultiplier = 0;
Win_CommTimeouts.WriteTotalTimeoutConstant = 110;
SetCommConfig(portHandle, &Win_CommConfig, sizeof(COMMCONFIG));
//This is the part you should pay attention to right here.
unsigned char *tmp = new unsigned char;
int bufferSize = 0;
//Read a chunk from the serial port buffer assuming there is something there. You may need to send something before receiving data back.
if (bufferSize <= 0)
printf("No bytes read\n");
//At this point, we assume that tmp has in it your 11 bytes, from byte 0-10. You should check to make sure, as to avoid segfaults or faulty data.
//Byte 7 is engine speed, RPM = n x 25 according to the techedge page
int rpm = tmp * 25;
printf("Engine RPM is: %i\n",rpm);
//Byte 5 is vehicle speed directly
int mph = tmp;
printf("Vehicle Speed is %i\n",mph);