Visual Basic Controller Project


Page 1 of 2 12 LastLast
Results 1 to 20 of 31

Thread: Visual Basic Controller Project

  1. #1
    Registered
    Join Date
    Nov 2004
    Location
    usa
    Posts
    33
    Downloads
    0
    Uploads
    0

    Default Visual Basic Controller Project

    Thanks for setting up the new VB Forum. I'm going to continue posting my work log of my visual basic controller from here.

    To bring it up to date, I haven't had much time to work on it. I was last working on recompiling and converting the gcode back to a dxf file for export. I got stumped on trying to convert a ellipse, but found that other commercial programs don't import them either. The code that I'm using for the dxf also will help on parsing out the positions to move the xyz motors. I should have time in the next couple of weeks to work on it again.

    Here is a screen shot:



    Similar Threads:
    Darren
    http://www.darrensshop.com


  2. #2
    Registered
    Join Date
    Nov 2004
    Location
    usa
    Posts
    33
    Downloads
    0
    Uploads
    0

    Default Here's the source

    I've not had anytime to work on this. The vb timer doesn't give very good performance, maybe someone else will have better luck. I haven't done any documentation and it has been a while since I dug into it, if you have a question I'll do my best to answer it. The source is in VB6.

    Attached Files Attached Files
    Darren
    http://www.darrensshop.com


  3. #3
    Registered
    Join Date
    Dec 2005
    Location
    USA
    Posts
    10
    Downloads
    0
    Uploads
    0

    Default

    Can I help you with this project? If so what is the issue with the timer?

    By the way, I see your into stainglass. Have you made a machine that would dispence the liquid lead onto a glass using CNC?

    Carl
    cboudrea@pressenter.com



  4. #4
    Registered
    Join Date
    Aug 2006
    Location
    Egypt
    Posts
    10
    Downloads
    0
    Uploads
    0

    Default

    I've finished my Software which controls through parallel port...but i've problems with the timer...it give slow performance...if i made loop for sending -for ex. "255"- 1000 times without timer it talkes about 1 second ...if i used timer with 1 mms interval it takes about 17 Seconds...this means it sends 60 mms not every 1 mms ...how can i overcome this .....thanks



  5. #5
    Registered
    Join Date
    Dec 2005
    Location
    USA
    Posts
    10
    Downloads
    0
    Uploads
    0

    Default Treading

    By threading the timer routine, you separate it from the main process which would be your CNC application. Isolate the timer functions in another form and create a separate process for that form. This is called multi threading, and it allows the processor to give that thread the attention needed for this process (your CNC application).

    Lets use people as an example. Picture yourself standing in the middle of 6 people, who are giving you command. 5 of those people represent a diffrent process running on the computer, and the 6th person is your CNC application. You as the processor turns to each person in your circle and asks for instructions. As each person gives to an instruction to you, you complete it and turn to the next person in the circle. When you get an instruction from the CNC person, you execute it and move on to the next person.

    So if the CNC person, asks you for the current system time, you give it to him or her, and then move on. By the time you get back to the CNC person, the process as a whole has actually lost ns(nano seconds). Lets say the CNC hears the time from you and it is time to move a Motor, the next command he will give you is to move the motor. You as the CPU comply and move onto the next person (process). When you get back to the CNC person again, he has a list of commands for you but is limited to only one command at time. This limit is your timing issue.

    By creating another person(process) and call her Timer Girl. You will actually give your CNC application more face to face time, and therefore speed up your application. Because now you have two people working on your CNC application.

    It has been a long time, since I have heard from anyone on this project, if you would like more help, can you update the Zip file and post it here please

    Carl Boudreau
    Developer / Architect
    VB.Net , ASP.Net, VB6, ASP, MSSQL, mySQL - and more...
    612-220-8720
    cboudrea@pressenter.com

    Last edited by cboudreau; 08-31-2006 at 09:16 AM. Reason: Typo's


  6. #6
    Registered
    Join Date
    Dec 2005
    Location
    USA
    Posts
    10
    Downloads
    0
    Uploads
    0

    Default Open Source Visual Basic CNC Software

    Anyone working on this project?



  7. #7
    Registered
    Join Date
    Nov 2004
    Location
    usa
    Posts
    33
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by cboudreau View Post
    Can I help you with this project? If so what is the issue with the timer?

    By the way, I see your into stainglass. Have you made a machine that would dispence the liquid lead onto a glass using CNC?

    Carl
    cboudrea@pressenter.com
    Sounds like a feasible task since I use a glass design software that can output dxf files. However that would take all the fun out of the glass work for me personally, so doubt I'll pursue it.

    Darren
    http://www.darrensshop.com


  8. #8
    Registered
    Join Date
    Sep 2007
    Location
    United States of America
    Posts
    33
    Downloads
    0
    Uploads
    0

    Default Higher Resolution Visual Basic Timer

    I am new to this forum/site. I noticed that they had VB forums and was just poking around. I do all of my coding in VB and have just started playing around with the parallel port, stepper motors, etc.

    I ran into a similar problem and found that there is a much higher resolution timer in vb than just the "timer" function. I was able to get 500 steps per second using this timer a ULN2003A and some Vexta 12V stepper motors. I was.am trying to build a translating XY table using 1/4-20 all thread. This will result in 7.5 inches per minute. Not bad. Not sure what limits this, but beyond ~600 the steppers really start losing steps and are not reliable anymore. If the limiter is the computer than it might be increased for a faster computer. I am using a very old 500 MHz AMD for this and have not tried any other.

    The functions are queryperformancefrequency and queryperformancecounter. These functions use the actual speed of the processor as the timer. I've heard that they are accurate to ~5 microseconds!!!!

    I have been able to plot things using an etch a sketch very quickly using this method and simply a X,Y coordinate linear interpolation strategy which works alright for the spacial resolution of an etch a sketch. I would post a picture, but my etch a sketch has since broken. Also taking a picture of an etch a sketch is like taking a picture of yourself in the mirror. All your going to see is a nice reflection of my camera and hand.

    Not sure if anyone is still watching this thread!!!! If so hope this helps. I can post a better description later if anyone would like it.



  9. #9
    Registered
    Join Date
    Dec 2005
    Location
    USA
    Posts
    10
    Downloads
    0
    Uploads
    0

    Default

    I am watching this thread. And I am interested in continuing the WinCNC application, although I'd like to see it done in VB.Net2005.



  10. #10
    Registered
    Join Date
    Apr 2007
    Location
    canada
    Posts
    7
    Downloads
    0
    Uploads
    0

    Default

    Gentlemen, I am trying to port my dos based app to a VBA app run within Autocad and I am currently up against the timer issue. Would the new dual core processors help out here? One core devoted to the stepper control thread and the other left to take care of Windows needs? I would hate to run out and buy one only to find out it doesn't work that way. Thanks



  11. #11
    Registered
    Join Date
    Dec 2005
    Location
    USA
    Posts
    10
    Downloads
    0
    Uploads
    0

    Default Dual core processors is faster but the timer issue is software based not hardware bas

    Of course a Dual Core is faster, and if you need validation to ask Mrs. Santa for a New Computer, then your answer is yes “You have to have it.”

    But unfortunately, the timer issue is a software operating system issue, and not hardware. I don’t think you can isolate the AutoCAD application to use only one processor would go against the foundation of the hardware architecture.

    The fundamental issue if the time is based on the OS. The operating system can still only do one process at a time. A dual core only gives the OS to double the process speed because it duals out the work load to two processors in stead on just one. The OS was not designed to be a PLC, there fore there was no separate timer control built into the OS. Although it looks like things are running at the same time, it is only an illusion, much like to see in an old movie projector, The projector like the OS simply flashes still pictures in your eyes so fast that they seem to be animated. But in reality they are just single pictures or single processors. So if we could speed our brains up to the speed of the computer we would see one process at a time, like we would see one image at a time in the old movie projectors.

    The timer is inaccurate because, depending on how many processes are running will determine when the timer process will run. It isn’t, but if the timer process was the only thing running then you could say it is accurate, but if there are 50-60 processes running the timer process runs every 61 times.

    Carl Boudreau
    Senior Developer VB.Net, VB, ASP.net VB, VBA




    Quote Originally Posted by innova View Post
    Gentlemen, I am trying to port my dos based app to a VBA app run within Autocad and I am currently up against the timer issue. Would the new dual core processors help out here? One core devoted to the stepper control thread and the other left to take care of Windows needs? I would hate to run out and buy one only to find out it doesn't work that way. Thanks




  12. #12
    Registered
    Join Date
    Feb 2008
    Location
    usa
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default problems with function Move_Steppers

    Dear Mr. Darren Wright,

    I hope you can help me in reviving this project. I am quite experienced in VB but am quite a newbie in CNC and motor control. I hope you can explain to me a couple of things in the function Move_Steppers (in the "main" form):
    1. Why did you choose CreateWaitableTimer approach for timing control? It appears that its nanosecond resolution is an overkill for this since this function needs to be called 50,000 times a second at most for a regular microstepper controller. So, we only need 20 ms resolution which is attainable with regular VB timer. There is also a more precise ActiveX timer available at http://www.easycode.cat/English/ActiveX.htm which is easy to use in VB.
    2. To increment time between the motor steps you are using mySleeper.SleepTime to evoke GoToSleep in the CSleeper. During each increment, you are switching between the STEP and STOP states while the joystick is kept activated. During the STOP state, you send 0 to the step line but keep the value for the direction line.
    Then, at the end of the function, you send 0s to all lines but just briefly (probably a few nanosecs) until the function is called again and output is set to the next state. Is this nanosec-long zeroing of outputs between states important?

    Thank you,
    Victor



  13. #13
    Registered
    Join Date
    Oct 2006
    Location
    South Africa
    Posts
    48
    Downloads
    0
    Uploads
    0

    Default

    Hi Victor

    I would also like to help if i can. I am not a VB programmer by trade, but can help out here and there. i also have a Stepper table as well as a small test board to run the steppers via pc interface.

    it would be nice to see this project revived.

    cheers

    Anthony



  14. #14
    Registered
    Join Date
    Jul 2007
    Location
    Sweden
    Posts
    887
    Downloads
    0
    Uploads
    0

    Default

    Hi,
    1. Why did you choose CreateWaitableTimer approach for timing control? It appears that its nanosecond resolution is an overkill for this since this function needs to be called 50,000 times a second at most for a regular microstepper controller. So, we only need 20 ms resolution which is attainable with regular VB timer.
    I'm no VB expert but 50,000 times per second = 50kHz = 0.02mS = 20uS as in microseconds, not 20mS. Can you really get 20uS resolution with an ordinary VB-timer?



  15. #15
    Registered
    Join Date
    Sep 2007
    Location
    United States of America
    Posts
    33
    Downloads
    0
    Uploads
    0

    Default

    I have read other places that a pulse frequency anywhere close to this high is impractical for Windows (without serious hacking of the operating system). I would love to be proven wrong about this!!! I think timers might help, but I don't think they are the entire problem. I have been very interested to finding out what limits the pulse frequency. Is it Windows, VB, timer used, circuit, stepper motor, etc??????

    Love to help out with this anyway I can!!!

    To date, I can get maybe 650 pulses per second with my very simple circuit (ULN2003), but as I mentioned above, I cannot put my finger on the limiting component. My suspicion is that it is indeed Windows; therefore, a timer with nanosecond resolution that has to run through a millisecond resolution platform is irrelevant.

    w102acd



  16. #16
    Registered
    Join Date
    Jan 2006
    Location
    USA
    Posts
    121
    Downloads
    0
    Uploads
    0

    Default

    A little bit of documentation would be a great addition, any notes available?

    Jon



  17. #17
    Registered
    Join Date
    Feb 2008
    Location
    usa
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default Completely revised program for simple lasing/etching

    I decided to use simple For-Next loops for obtaining sub-msec resolution in outputting the microstep signals. This way, a user controls not individual microsteps but groups of 4000-40000 microsteps in 0.1 - 1 sec intervals. This is adequate for my application, which is lasing/etching of simple rectangular shapes. Here I attach the VB program along with notes and a picture of my setup. The main advantage of this versus an earlier program is the ability to control the X-Y stage based on the visual input from the CCD camera mounted on the microscope. The program also has an Autolasing feature, where the user can click on the left-top and right-bottom corners of the rectangle and the program will automatically etch the specified shape. Feel free to use and modify this program for your application.
    Victor Pikov

    Attached Files Attached Files


  18. #18
    Registered
    Join Date
    Sep 2007
    Location
    Philippines
    Posts
    1
    Downloads
    0
    Uploads
    0

    Default

    Anyone still working on this project?



  19. #19
    Member neilw20's Avatar
    Join Date
    Jun 2007
    Location
    Australia
    Posts
    3757
    Downloads
    0
    Uploads
    0

    Cool I am looking.

    I would like to keep this alive. I am looking...

    I am using the LPT for a 4 bit data analyzer at 400MHz. With a fifth line for start/stop.
    That is data change capture with 2.5nS resolution, time stamped into a file after I fill memory or turn off the switch.
    If you were using windows then this would be not possible. It is DOS.
    In Windows if you disable() interrupts Windows just says you are not interested in interrupts, and honors your enable() in some future timeslice if you ask it to. Because everything is virtual it only looks like timers and stuff work well. Windows goes off into the weeds on a regular basis. If you use a fast enough machine you can get VB6 to do respectable controlling. A few low level hooks via some drivers can overcome some timing problems like running timers/counters without Windows introduced errors.
    Mach3 handles these problems well. Look inside the Mach3 drivers to get some idea of how this can be made to work. You need to be able to feed a queue that is processed by a low level driver to defeat Windows timeslice theft when you need the CPU most.

    Super X3. 3600rpm. Sheridan 6"x24" Lathe + more. THREE ways to fix things: The RIGHT way, the OTHER way, and maybe YOUR way, which is possibly a FASTER WRONG WAY!


  20. #20
    Registered
    Join Date
    Sep 2005
    Location
    UK
    Posts
    1
    Downloads
    0
    Uploads
    0

    Default Anyone Still Working On This Project ??

    i have just started leaning VB2008.net and i have managed to get most of WinCNC working in .net
    is anyone else trying to do this i would be interested in their code!



Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Visual Basic Controller Project

Visual Basic Controller Project