reading from USB port using mex code .. the DLL is taking more time and less time in constently
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
h = CreateFile(portname,
GENERIC_READ | GENERIC_WRITE,
0, NULL,
OPEN_EXISTING, 0, NULL);
if (h == INVALID_HANDLE_VALUE)
{
mexPrintf("\n\n !! FAILED TO OPEN PORT %s\n\n", portname);
return -1;
}
dcb.DCBlength = sizeof(dcb);
dcb.BaudRate = 57600;
dcb.fBinary = 1;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
dcb.ByteSize = 8;
if (!SetCommState(h, &dcb))
{
mexPrintf("\n\n SetCommState Failed\n\n");
return -1;
}
/* Will print hex values of received bytes */
for (i = 0; i < imax; i++)
{
/* Wait for characters */
read = 0;
while(!read)
{
ReadFile(h, &ch, 1, &read, NULL);
if (read) Data[i] = ch;
}
}
CloseHandle(h);
mexPrintf("Reading from USB Completed\n");
1 Kommentar
Jan
am 31 Jan. 2013
You forgot to ask a question. The DLL is taking more time and less time (simultaneously?!) than what?
Antworten (0)
Siehe auch
Kategorien
Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!