I guess the general Code questions are allowed here, so let me ask for feedback from C experts (I use the old Turbo C ver 2.0 running under MS-DOS ver 5.0).
Controlling the H-bridge via the PC's parallel port, everything works fine, the control bandwidth is there, an infinite loop is preferred so I am using the for(;
or do-while 1 loops (both work fine), and for now I am using bit-banging (I can maintain the UL1741 60Hz freq tolerance using this simple scheme).
The question is how to get out of this loop on forced program termination, without testing any conditions to cause return(), such as kbhit(), that mess up the control timing. The loop must only contain the outportb() and delay() control functions, nothing else, or the control signal timing to the parallel port may be disturbed (even with the interrupts disabled).
Ctrlbrk() work ONLY if there is printf() inside the loop
– I can't have that. Otherwise it will not get out of the loop and stop the program on hitting ctrl-C or ctrl-Break.
Also tried setcbrk() and signal(), but was not successful.
Has anyone dealt with this before, how to terminate tight infinite control loops and programs, using ctrl-C/ctrl-Break, or in any other way that does not disturb the signal timing while controlling something?
Thanks, Jack