Qbasicnews.com
May 26, 2019, 10:57:32 AM
 Welcome, Guest. Please login or register. 1 Hour 1 Day 1 Week 1 Month Forever Login with username, password and session length
 Home Help Search Login Register
 Pages: [1]
 Author Topic: Use of interrupt in machine control program  (Read 1468 times)
jcc3inc
Member

Posts: 25

 « on: September 09, 2004, 11:39:05 AM »

Gentlemen:

In a provious post I asked about multitasking, thinking that was what I needed. However let me describe the application to see if I could use the interrupts to do what I want.

I have a CNC program which controls three axes of a machine. The position data is obtained from the part program which is as follows:
G01 X12.344 Y3.8 Z-.12  (a straight line in X, Y, Z)
G01 X 3.789 Y-1.23 Z0
ETC.
ETC.
One block is read, parsed, processed, and then the data goes to the interpolator where the steps are "metered out" at a rate related to the desired speed (inches per minute). An external clock at 4.1667 KHz (240 uSec) is fed to the interpolator. It requires 60 uSec of the 240 uSec to do the calculations, then I loop for 180 uSec until the next clock pulse comes along. At the max output speed, the pulses are spaced 240 uSec apart.  When one block is finished, the next block must be read in and processed; this takes 10 -20 millisec resulting in a jerk or discontinuity of the speed.

My understanding of the interrupt is that processing stops, the current program data is saved, and the interrupt is handled, and the processor then returns to its original task.  I would like to use the 180 uSec of time to do the reading and data processing so that the transition between blocks will be smooth.

Is there a way with QBASIC wherein I can use an interrupt to cause my program to go to the interpolation SUB each time the clock pulse arrives
but to use the remaining 180 uSec to do the preprocessing etc which took the 10 -20 milliseconds? The calculations of the interpolator are of highest priority while the program is running the machine. Are there other options?

Thanks for your comments.

Regards,
Jack C.
 Logged
 Pages: [1]
Jump to: