The following warnings occurred: | |||||||||||||||
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.1.28 (Linux)
|
Sending data from RAM to USB - Printable Version +- CBMSTUFF FORUM (https://www.cbmstuff.com/forum) +-- Forum: CBMSTUFF PRODUCTS (https://www.cbmstuff.com/forum/forumdisplay.php?fid=1) +--- Forum: SuperCard Pro (https://www.cbmstuff.com/forum/forumdisplay.php?fid=3) +---- Forum: Developer Area (https://www.cbmstuff.com/forum/forumdisplay.php?fid=13) +---- Thread: Sending data from RAM to USB (/showthread.php?tid=287) |
RE: Sending data from RAM to USB - dfstudios - 01-27-2016 I'm just wondering if this is an issue with the FTDI API. If I use Code: FT_GetQueueStatus(ftHandle, lpdwAmountInRxQueue) it seems to max out at 65,536. However, if I bypass this and use Code: FT_Read(ftHandle, lpBuffer, dwBytesToRead, ldpwBytesReturned) and set dwBytesToRead to 512*1024 then it is possible for lpdwBytesReturned to be higher than 65,536. Kind regards, Francis RE: Sending data from RAM to USB - admin - 01-27-2016 I have never used the command to get the queue status, but it is possible that it only returns the amount in the queue (which could be full). I would use the FT_Read (that's what I use). Are you doing this in PureBasic? If so, how are you opening the FTDXXXX.dll? I downloaded PureBasic and I am interested in writing some sample code for SCP so that it can be used under Windows, Mac, and Linux. RE: Sending data from RAM to USB - dfstudios - 01-27-2016 (01-27-2016, 04:30 PM)admin Wrote: Yes, you get as many bytes sent as requested. I'm using the USB COM port, and I am using the FTDXXX.dll. Baud rate is not an issue as I can let the program wait until the Rx buffer is full and then receive the data. It just seems to max out at 64k, which fits in with what you say. Kind regards, Francis RE: Sending data from RAM to USB - admin - 01-27-2016 Are you actually opening a COM port? If you use the .dll you don't open a COM port, you just call the FT_Read and FT_Write to transfer data. RE: Sending data from RAM to USB - admin - 01-27-2016 Here is the code I used in Visual Basic for opening and closing the FTDI device, using the .dll: Code: Public Sub OpenFTDI() RE: Sending data from RAM to USB - dfstudios - 01-27-2016 (01-27-2016, 04:35 PM)admin Wrote: I have never used the command to get the queue status, but it is possible that it only returns the amount in the queue (which could be full). First you need to open the dll: Code: hndFTDLL = OpenLibrary(#PB_Any, GetFolderPath(#CSIDL_SYSTEM) + "\ftd2xx.dll") You can then call the functions using something like: Code: CallFunction(hndFTDLL, "FT_Read", ftHandle, @Buffer, BytesToRead, @BytesReturned) All this is explained in more detail in the online PureBasic manual. If I remember right, the demo version of PureBasic is quite restrictive in what you can do with it, so the above may not work if it is just the demo version you have. Kind regards, Francis RE: Sending data from RAM to USB - dfstudios - 01-27-2016 (01-27-2016, 04:41 PM)admin Wrote: Are you actually opening a COM port? If you use the .dll you don't open a COM port, you just call the FT_Read and FT_Write to transfer data. No I am not having to explicitly open a COM port. I'm just initialising the FTD2XX library and calling the functions such as FT_Read(). Kind regards, Francis RE: Sending data from RAM to USB - dfstudios - 01-27-2016 (01-27-2016, 04:44 PM)admin Wrote: Here is the code I used in Visual Basic for opening and closing the FTDI device, using the .dll: Thanks! That's useful to know. Kind regards, Francis RE: Sending data from RAM to USB - admin - 01-27-2016 It's not optional to call FT_Open. It's best to use FT_OpenEx though, using the proper name. Otherwise, it's possible that you could be opening another FTDI device if one is present! Thanks for the info on how to open the .dll. I got the full version because it is necessary for using .dll's. RE: Sending data from RAM to USB - admin - 01-27-2016 This should help you with the transfers. This is code I use for reading and writing data to the USB port: Code: ' This routine gets data from the SCP USB port and stores "ReadLength" number of bytes starting Note: Visual Basic treats memory as an array. So, RawBuffer(RawOffset) is the same thing as RawBuffer+RawOffset if you were dealing with memory directly. |