![]() | ![]() | ![]() |
| | |||||||
| General Electronics Chat This forum is for general chat about electronics, eg: Dont know what a part does? Dont know how to read a circuit? Want to get an opinion? |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Hi, I'm about to be working with a USB Uart/fifo chip from ftdichip.com, its thier FT245BM model. I'm writing my own software and they have a driver that creates a com port for the usb and allows easy access, but for what I'm doing I would MUCH rather access the device directly (which they also have a driver for) However, I've never programmed for hardware i/o before. I'm a little curious as to how the algoritm goes (English description of what I'll need to do in the code). I'll be mostly sending a few bytes at a time (no file tranfers)... Sometimes writing to device, mostly reading from. I see some code in thier driver regarding the read function: Code: FT_STATUS WINAPI FT_Read(
FT_HANDLE ftHandle,
LPVOID lpBuffer,
DWORD nBufferSize,
LPDWORD lpBytesReturned
); | |
| |
| | (permalink) |
| I guess I'm curious as to how the whole read and write goes with buffers and whatnot. I see the read function has: ftHandle: pointer to the communication handle of the device to read. lpBuffer: pointer to the buffer that receives the data from the device. DwBytesToRead: Number of bytes to be read from the device. lpdwBytesReturned: Pointer to a variable of type DWORD which receives the number of bytes read from the device. ftHandle... thats the device id (?) lpBuffer... uh, the pointer to where data is stored DwBytesToRead... number of data bytes I suppose lpdwBytesReturned... dunno, isnt it the same as DwBytesToRead ? Also say I call the read()and get the data from it... when I read again, how do i know that data is new or is the same data I just read ? When does this buffer get cleared ? I read throught the manual, but 11 pages isnt exactly in depth... [/b] | |
| |
| | (permalink) |
| Ah, nevermind.... I see, there is a purge buffer function too. Ok... well I think I can manage that. But if I go with the virtual port emulator then I can still use rs232 programs to talk with my interface... Can someone explain to me how to talk to ports using C++ or Java (windows api maybe) ? General alorithm is fine. | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| Take a look at Silicon Labs USB controller www.silabs.com . It's a super fast 8051 + USB. They provide an API for both the host side and the Device side - No RS232 required. | |
| |