Hi everyone, I am pretty new to C++ Programming... but am currently working on a project where I need to try and get an old fortrans program working again... I have the executable which can start up and run through initialization, but once I try to run the simulation it freezes up due to the lack of a timer interrupt.

I am basically hoping to use C++ as a 'wrapper' to create a timer interrupt and timing system that can be ported into the old program... has anyone done this?

I am thinking of using the COMM ports to transfer data between the C++ and the Fortrans programs.

I have found some code to be able to create and open the COMM1 port but am unable to find anything that refers to sending a timer interrupt through a COMM port. (and yes I have used google and various forum search engines)

any help would be greatly appreciated!

I don't understand how sending something thru a comm port is going to generate a timer interrupt ? If you have the source code maybe you can just recompile it with a more modern fortran compiler, such as this one.

A timer interrupt is generally one that uses the processor's clock to generate an interrupt periodically, not one that uses an outside signal.

Thanks for the replies everyone... I'm not sure if I mentioned that I am not a programmer, I am just starting to try and understand it so I can finish this project that I was tasked with...

I am able to call the Executable in C++ using:

system("FortransProgram.exe");

Which works perfect on running the existing program.

Since I am still learning how this all works together, I tried to first print out the time @ the specific interval of 0.125 sec.
I used:

char strDate [9];	//Initializing Date String
	char strTime [9];	//Initializing Time String
	int x;
	x=0;

	do
	{
		_strdate( strDate); 
		_strtime( strTime);
		printf( "%s %s \n", strDate, strTime); // %s gets the respective strings
		x++;

		clock_t start_tick( clock() );
        while ( clock() - start_tick < CLK_TCK*0.125 ); //Allows Delay
	}
	while (x!=40); //how many iterations

Now, I am trying to figure out if there is a way to send this date/time stamp (obtained from the CPU) to a Comm port... I was told that I could use a Comm port to send this too, and try to change some of the source code (which we only have some) to look at the Comm port for the timing reference instead of the timing card it originally used...

Does this make more sense?

Again, I really appreciate the help, as google as proved to be helpful, yet sometimes unrelevant.
-Ryan

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.