May 26, 2019, 10:57:32 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
   Home   Help Search Login Register  
Pages: [1]
Author Topic: Use of interrupt in machine control program  (Read 1468 times)
Posts: 25

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

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
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.

Jack C.
Pages: [1]
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!