Precise interval timer using MFC and VC++ - can anyone help?
Posted on 1998-04-18
I have written a program using Borland's Turbo C++ 3.0 for DOS which is reading
data from hardware port 300h in 1ms intervalls. To do this I had to redirect the
timer interrupt #08h to a self written subroutine. Because the PC's timer intervall
is set to some strange 18ms by default I also had to reprogram the timer chip (8253)
to get the desired 1ms. This program works well but since it is a DOS
program using only pure C code the user interface is very limited. I don't
want to spent weeks only for programming a nice UI when I can do this
in hours using MFC. So I tried to port it to MS VC++. But the compilation
ends up with a "function returns function" error message for the
declaration of the function which installs the new interrupt service routine.
This is the logic of the program:
void InstallTimer(void interrupt (*intrserv)(), int freq_Hz); /* <-- this line leads to VC++ syntax error */
void interrupt IntrServerRoutine(void) /* here I define the interrupt service routine */
/* does the timer dependent IO stuff */
InstallTimer(IntrServRoutine, 1000/*Hz*/); /* here I reprogram the 8253 chip and install interrupt service routine */
Why does this work with Turbo C but not with MS VC++? Does
anyone know how to implement this with VC++? I can give
the Turbo C source code to anyone who thinks he/she is
able to help me or just to anyone who's interested in it.