- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do I connect to a USB port from Fortran.
Regards
John Nichols
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A small company in Iowa has a nice device that I would like to communicate with directly as I noted before. I went looking and found a device driver INF file which notes that they are using WINUSB as the interface package, as shown in the attached file.
I would like to access this from Fortran, can I do it? Or do i ahve to use something like C#
Regards
JMN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
http://msdn.microsoft.com/en-us/windows/hardware/gg487341.aspx
Once the initialization is done, you get a file handle for the device and then use the standard ReadFile() and WriteFile() API functions. All of this can be done directly from IVF, but you may have to create your own F90 interfaces for the WinUSB API functions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot for the help.
life was simpler when one only had 2 floppies, a serial port, a printer port and black hair.
Did you all know that the first Mirosft Fortran could run on two 5.25 inch floppies on the original compaq portable sewing machine. (It looked like a sewing machine.)
Those were better times, one had time to drink a beer in comfort as the program was compiling.
Ah for a simple life.
JMN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You were LUCKY!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Fortran II compiler was on a deck of cards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We also ran FORTRAN-II in O/S 8 on that same machine, initially with 12K word of Core memory. We had 3 fixed head hard drives each 256KB (you read it right KB). We also ran the FORTRAN-D on a 4K word PDP-8L with "mass storage" as 10 character per second paper tape. In those days you kept your programs short (short symbol name choice) and you tended to program without error.
Now I have to have at least 1,000,000 as much memory anddisk. You couldn't run what we do now but the point to drive home is you can get a lot done in a small amount of memory.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I bet it was a lot of fun if you dumped that sucker on the floor.
Usually you would diagonal mark the edge with a majic marker but you had to hand sort it in the event of the oops.
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will bet the FORTRAN-II compiler was in binary format as opposet to text (Hollerith). Binary cards did not have sequence numbers.
At shool we also had a card reader on our PDP-8I and you could load binary programs. The cards had 12 rows which fit in nicely with the 12-bit word length of that machine. You would toggle in a few word program to suck in the first card and overwrite the code you toggled in. That 80-word program would be a larger loader program that read in the rest of the loader, then loader was followed by a control program that managed the compiler.
Our FORTRAN-II compiler (on paper tape)was a three pass compiler which wrote assembly source code to an output device (paper tape or card punch). The load process was toggle in a smallbootstrap that would load in a tape containing the RIM loader (Read In Mode), this tape was followed by the BIN (Binary)loader, then you loaded the tape with the FORTRAN-II compiler. Three passes of your source code through the compilerto produce a tape with assembler source.Then you had to toggle in the loader again and load in the SABR assembler, three passes later again and your had the binary for the program (six passes now plus the tree tapes to get the compiler going and the three tapes to get the assembler going). Next you had to toggle in the loader again, and load in your binary program together with runtime libraries. On a 10cps paper tape it could be several hours before you get to see your program burp and crash. This is why you tended to do your coding right the first time. I am glad I do not have to go through that any more.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Now back to USB via FORTAN:
I have a USB-GPIB interface to some lab instruments. It works fine with Agilent's software, but I want to address the instruments via Compaq Visual Fortran which is somewhat the same as IVF.
Agilent only gives examples in C++ or VB, which might as well be Latin as far as enlighteniing me any!
They say write ID = iopen ("gpib0,23") in either VB or C++
They don't give the value or type of the variable gpib0, or how it gets defined.
I guess this translates to a Fortran OPEN statement, but what would the arguments in a Fortran OPEN statement be?
All clues are appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Then you can call the C function form your Fortran code.
Once you can call the sample program (as subroutine) from fortran, then you can start modifying it.
The sample program can do something simple like identyfy device.
iopen is likely a function included in the Agilent library (which you may be able to link with your Fortran application).
Jim Dempsey

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page