Fortran Data acquisition using Fortran and RS232 Port

  • Thread starter Thread starter Ariche
  • Start date Start date
  • Tags Tags
    Data Fortran
Click For Summary
To handle data flow through the RS232 port using Fortran on Linux, a driver is necessary for effective communication. While there are discussions suggesting that Fortran may not be the best choice for serial port interfacing, there are useful tips available online. The choice to use Fortran may stem from existing signal processing functions already implemented in that language. An alternative approach involves writing the control functions in C, which can then interface with Fortran, allowing for data buffers to be prepared in C and passed to Fortran for processing. In Linux, the serial port is treated as a file, which can be read from, though specific methods for opening and reading from it in Fortran need to be researched further.
Ariche
Messages
1
Reaction score
0
I'm on Linux, and I want to treat the flow of data through the RS232 port, using the Fortran language , how can I do?
 
Technology news on Phys.org
Hello Ariche, :welcome:

I see you don't get a rapid response, so I'll put in my two cents (fortran knowledge OK, interfacing directly via serial port, ...?):

You'd need a driver of some sort to do this. To write fortran calls like https://www.xlsoft.com/jp/products/intel/cvf/docs/vf-html_e/pg/pggsport.htm

Googling gives a lot of discussions on why not to use fortran for such things, but they are interspersed with tips that might be useful (this one? this ? Or in PF ?)
 
Last edited by a moderator:
What is the reasoning behind your decision to implement in Fortran?
Is is because the signal processing functions are implemented in Fortran, and you don't want to, or can't convert to another language?

An alternate approach might be to write the controlling functions in C and interface to the Fortran from there.
I'd prepare buffers of data with C and pass them to the fortran processing. You can research calling fortran from C.

In Linux the serial port (as does all IO) appears as a file you can read from. I'm not sure how to open it and read it from Fortran.
 
  • Like
Likes Silicon Waffle
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

Replies
64
Views
9K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 20 ·
Replies
20
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 62 ·
3
Replies
62
Views
13K
  • · Replies 14 ·
Replies
14
Views
5K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 9 ·
Replies
9
Views
6K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 17 ·
Replies
17
Views
6K