Threaded View
-
28-02-2012 #6
Brave ! Here's a taster...
Firstly we don't know which serial port holds the USB to serial adaptor with a mill on the end of it so the software has to find it. We can draw the tool paths on the screen and have lots of neat buttons but how to find the mill?
USB devices can be either Hand Held or serial. The latter is a lot more friendly so best to go with that so as not to frighten people off writing controllers.
We can ask Windows for a list of available serial ports then send an ASCII ENQuiry character to each in turn and see what comes back. ENQ is kind of safe to send to any serial device. Now the mill is USB it can be anywhere on the list, we can't insist on COM1: it could be COM17: for all we know. The mill controller responds to ENQ with a filename, if that name exists on disk we have found a mill and we have a text file that defines it. Windows likes text files and they are dead easy to update with NotePad.
If we have more than one mill connected then we should have more than one mill definition file. The software can ask which one you want. If definition files include pet names for the mills the choice won't be gobble-de-gook. If you only have one mill definition file, it knows where to go. We could just insist you only plug one mill in at a time but how boring is that when you can run multiple mills simultaneously in different windows?
The software now hits a Windows snag. If a program doesn't release the processor umpteen times a second it will be declared as "Not responding", unfriendly and needs to be time sliced. Don't want that. My way to get around it is to start a second program that goes around in a loop, real easy to "spawn" off a new program you just write a subroutine that returns twice.
My version of this seperate program sends an 'S' on the USB which is my request for the mill status. The status will be several bytes long so while waiting for them to arrive I can releases the processor and keep Windows happy. Once I have the status I know what the mill is doing, where it is, the current feed rate, what space is available in the buffers, have we been paused etc. I can then update it accordingly, give my main program the opportunity to update the PC screen then loop back to the top for another status request.
Is anyone still with me? :naughty:
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
25 pin serial cable advice
By Fivetide in forum Computer HardwareReplies: 12Last Post: 14-09-2012, 08:45 PM -
Boxford 160 serial cable pinouts
By j.c.freeman in forum Boxford LathesReplies: 0Last Post: 27-08-2012, 02:18 PM -
UHU Servo Controller
By gbar in forum Stepper & Servo MotorsReplies: 4Last Post: 11-05-2012, 12:12 PM -
FOR SALE: Controller Box for sale
By lateAtNight in forum Items For SaleReplies: 12Last Post: 04-03-2012, 10:17 AM -
Controller Box
By M250cnc in forum Motor Drivers & ControllersReplies: 1Last Post: 21-11-2010, 01:34 AM
Bookmarks