Buy an Axon, Axon II, or Axon Mote and build a great robot, while helping to support SoR.
0 Members and 1 Guest are viewing this topic.
@Ro-Bot-X: I already tried that. By setting up the safe baud rate 9600. It shows up on the arduino console. But my Visual C++ program couldn't read the serial data from arduino. Did you ever make any serial programmer to burn program into your microcontroller? If so, you will probably understand what I'm trying to do.
Try using POSIX C to interface with whatever Serial Port (\\.\COM*) is being emulated by the FTDI cable. Remember to use a baud rate of 9600, 8 bit packets, no parity bits, one stop bit, and no flow control.
/* * http://www.codeproject.com/KB/system/ftdi-chip.aspx */#include <iostream>#include <tchar.h>#include <windows.h>#include <exception>#include "ftd2xx.h"int _tmain(int argc, _TCHAR* argv[]){ FT_STATUS ftStatus; FT_HANDLE ftHandle; DWORD TotalRead=0; _TCHAR Buf[64]; OVERLAPPED osReader = {0}; ftStatus = FT_ListDevices(0, Buf, FT_LIST_BY_INDEX | FT_OPEN_BY_SERIAL_NUMBER); if (ftStatus!=FT_OK) { printf("Couldn't find FTDI device!\n"); return 0; } ftHandle = FT_W32_CreateFile(Buf, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED | FT_OPEN_BY_SERIAL_NUMBER, 0); if (ftHandle != INVALID_HANDLE_VALUE) { try { //setting up the port ftStatus=FT_SetBaudRate(ftHandle, FT_BAUD_9600); if (ftStatus!=FT_OK) throw std::exception("Can't set baud rate"); ftStatus = FT_SetDataCharacteristics(ftHandle, FT_BITS_8, FT_STOP_BITS_1, FT_PARITY_NONE); if (ftStatus!=FT_OK) throw std::exception("Can't set data characteristics"); // Create the overlapped event. Must be closed before exiting // to avoid a handle leak. osReader.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); if (osReader.hEvent == NULL) { printf("Error creating overlapped event."); return 0; } char Buf[256]; FT_W32_ReadFile(ftHandle, Buf, sizeof(Buf), &TotalRead, &osReader); if (WaitForSingleObject(osReader.hEvent, 1000) != WAIT_OBJECT_0) throw std::exception("Error waiting read operation"); } catch (std::exception & e) { printf("%d\n", TotalRead); printf(e.what()); } FT_W32_CloseHandle(ftHandle); } return 0;}
Just curious on why you are using the FTDI API rather than just a serial connection?I have the same breakout board, it provides me with a serial port (Com Port) when i connect it to my PC.