hello...
anybody here know how to control the I/O, comm port etc. I have a gps receiver and i want to control it (extract data) by comm port.
anyone can help?
This is a discussion on I/o within the C Programming forums, part of the General Programming Boards category; hello... anybody here know how to control the I/O, comm port etc. I have a gps receiver and i want ...
hello...
anybody here know how to control the I/O, comm port etc. I have a gps receiver and i want to control it (extract data) by comm port.
anyone can help?
You could experiment with the following code to get you started. Check the error return codes on these calls.
Code:DCB dcb; char Buffer[BUFFER_SIZE]; int iNoOfBytesRead; hComPortHandle = CreateFile("COM1", GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); ErrorCheck = GetCommState(hComPortHandle, &dcb); dcb.BaudRate = 1200; // change to your requirments dcb.ByteSize = 8; // .. dcb.Parity = 0; // .. dcb.StopBits = 0; // .. SetCommState(hComPortHandle, &dcb); for(;;) { ReadFile(hComPortHandle, &Buffer, BUFFER_SIZE, (unsigned long*)&iNoOfBytesRead, NULL); }
Try a board search too, this has been asked a few times before.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]