I have a FT232R device controlled by a VXM Stepping Motor Controller. I was able to communicate with the device on Mac(using Matlab). But I'm having trouble doing it on Windows.
I installed the VCP driver for Windows 64-bit from here: http://www.ftdichip.com/Drivers/VCP.htm I already checked that the driver is properly installed.
Here is my code:
#include <windows.h>
#include <setupapi.h>
#include <stdio.h>
int main()
{
char command[34] = "I2M10,R";
HANDLE hSerial = CreateFile(
"\\.\COM8", FILE_SHARE_READ | FILE_SHARE_WRITE, 0, NULL,//pass path as a parameter instead of \\.\COM6
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hSerial == INVALID_HANDLE_VALUE)
{
fprintf(stderr, "Erro");
}
else fprintf(stderr, "OKn");
DWORD bytes_written = 0;
BOOL res = WriteFile(hSerial, command, 34, &bytes_written, NULL);
if (res == false || bytes_written != 34) {
printf("error in write file");
}
res = CloseHandle(hSerial);
if (res == false) {
printf("error in close handler");
}
retu 0;
}
There is no error in the functions I use, but when I run the program nothing happens. I also checked the command I sent and I'm sure it is correct. I created a new Win32 Console Application in VS 2015 and I build it using 'x64'. Do you have ideas on what could be the problem ?
Recent Questions...
ما را در سایت Recent Questions دنبال میکنید
برچسب: having trouble communicating with game center,having trouble communicating,having trouble communicating with boyfriend,having trouble communicating with the game center server,having trouble communicating with my wife,having trouble communicating with spouse,having trouble communicating with my girlfriend,having trouble communicating with my boyfriend,having trouble communicating with the harmony platform service,having trouble communicating with girlfriend,
نویسنده: استخدام کار
بازدید: 415
تاريخ: چهارشنبه
3 شهريور
1395 ساعت: 21:36