Hello Guest it is April 28, 2024, 08:35:07 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mcardoso

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 »
101
Mach4 General Discussion / Re: Axis as a Spindle using Jog? (or Serial??)
« on: November 21, 2019, 01:13:27 PM »
RS232 is the standard communications protocol for serial and can support a single connection between 1 computer and 1 servo drive. RS485 is a multi-drop network that can support many nodes, but is limited to a Master-Slave type of network since no data flow control is present (unlike Ethernet). In the case of my CNC control system, I have a PC with a built in RS232 port. I use an RS232-RS485 adapter ($10 on eBay) to connect the computer to a multi-drop network using Cat5e cable as the media. I have 6 servo drives on the network, waiting for commands from the PC.

I also have an extra RS232 to RS485 converter to connect a laptop to the network to view the traffic. This has been incredibly helpful for setting up and troubleshooting my code.

I use a free program called PuTTy to access the network like a terminal. This cannot be used at the same time as Mach 4 serial since they would try to share the port. I would first try to make sure you can type your commands into PuTTy while connected to the drive and get everything to work. If you cannot do that, then serial in Mach 4 definitely wont work. When I am using Mach 4 serial, I often have my laptop with PuTTy open on the network viewing traffic.

102
Mach4 General Discussion / Re: Axis as a Spindle using Jog? (or Serial??)
« on: November 21, 2019, 11:55:40 AM »
I'll do my best to provide you with some background information on the serial communications and follow up with the actual code when I can get to it later today.

Serial communications is handled in the background in Windows. Windows offers multiple serial ports, some are hardware and some are virtual (USB to RS232 converters). When a device is plugged in, it is assigned a COM port number. These are fixed for hardware serial ports, but can change each time you plug it in for the virtual ones (there are ways to assign fixed values). Only one program can "own" a serial port, and if a second program attempts to open a COM port which is in use, that attempt will fail.

Windows buffers incoming serial transmissions for you. I think the default value is 4096 bytes. It is a FIFO buffer which is always read from the oldest byte. Reading a byte from the buffer will permanently remove it, so make sure you are copying the data somewhere if you need it later. If the buffer fills up, the oldest data is pushed out and lost forever.

The LUA implementation of serial is a wrapper around the C++ library for serial communications. It only has a few functions and is entirely undocumented. These functions are:

-Open Serial Port
-Close Serial Port
-Flush Buffer (deletes the entire contents of the buffer without reading the data)
-Read (read a given number of characters, includes an optional timeout)
-Write (writes an input string, includes an optional timeout)

These functions do return exception codes if applicable and should be used to check if your code works as intended.

Since serial communications leave your computer, you need to deal with "real world" problems like late transmissions, corrupted data, and missing replies. The timeout value included in the read and write commands specifies the maximum amount of time the function will wait for data to arrive. If try to read the port, but you didn't provide a value and no data is available to be read, your program will hang. If you use large timeout values and data doesn't arrive, your program will run very slowly. I use 5ms in my system.


103
Mach4 General Discussion / Re: Axis as a Spindle using Jog? (or Serial??)
« on: November 21, 2019, 10:47:58 AM »
Simon,

I have successfully used Mach 4 LUA to communicate over serial to my AC servo drives (ASCII protocol). These are Ultra 3000 drives so they won't use the same commands as you need, but I have painfully learned how to get serial communications working. It is extremely reliable now and I use it as a backbone to my CNC control.

If you are still interested in getting serial working, I would be happy to share my code and answer any questions you might have.

I don't think there any many users of serial and there is essentially no documentation (I know your pain... ).

Mike

104
Mach4 General Discussion / Re: S curve
« on: November 20, 2019, 12:33:56 AM »
Yaakov,

I will admit that I am not 100% sure what your are attempting to accomplish, however I will try to provide information the best that I can.

First off, I think you really need to evaluate if S curve motion planning is something that you absolutely need, if it is just a nice feature, or just something you’re interested in but don’t need. Mach 3/4 is currently not offering S curve motion planning and I wouldn’t bank on it being changed anytime soon (although I don’t work for NFS, so I don’t know what they are actively working on :) ). If you absolutely need higher order motion planning, there are many products on the market that can offer this, although I do not know of any at the price point of Mach 4. If it isn’t absolutely necessary for you then I wouldn’t try to go down the rabbit hole. Maybe there are other, possibly more elegant and cost effective, solutions for your needs.

With all that being said, there is no reason that you can’t manage your Gcode to adjust feedrates to simulate the motion generated by higher order motion planners. Many fancy CAM suites offer features like feedrate reduction into corners and high non-rapid feedrates when the software knows you are cutting air. You might be able to set up your CAM to segment all your Gcode with variable feedrates. But again, why? That seems like a lot of work and your issues might be more easily solved in other ways.

My opinion is to leave the purchased software packages to work as they are intended to.

Can you elaborate on what is driving your interest in S curve motion?

105
Mach4 General Discussion / Re: S curve
« on: November 19, 2019, 09:18:15 AM »
As an engineer who focuses on motion control and robotics in my day job, reading through Art's write-up on Tempest really made me smile. He has a wonderful knack for being able to get his stream of consciousness thrown onto a page and make it enjoyable to read. Motion control is wonderfully complex.

I could definitely see benefits for many in including a higher order motion planner within Mach, in particular the ability to specify a maximum path deviation during movement blending, rather than just CV.

Thanks for sharing that link Craig, it was enjoyable to go through.

106
When I open the profile, it starts to load the screenset (green loading bar) and at some point goes to a blank grey screen and brings up the Mach 4 dialog box which asks if you want to save the crash report. If you click OK, the entire program closes.

I do not know what I would need to edit in the XML to fix it. I also did not know you could open directly in edit mode. Neat trick!

I think I have redone all my work at this point, however it might be worth my time to go back and make sure I got all my changes. If I can...

107
Mach4 General Discussion / Re: Mach4 and mini PC
« on: November 16, 2019, 11:17:38 PM »
I'm running an industrial PC with the following specs:
-Intel quad-core Atom E3845, 1.91 GHz
-4GB DDR3
-128GB SSD
-Onboard graphics
-Windows 10 IOT Enterprise

This is well below the minimums for Mach4 however it runs quite well. I use my high end laptop to develop my Mach 4 profiles before copying them to my CNC and the only difference in performance that I see is how long it takes Mach to open and how long it takes to load Gcode files (really only huge ones though)

108
Well that sucks... Thanks for getting back with me.

I do have an individualized screenset for that reason, however any time I try to load that screenset, Mach crashes.

Fortunately my last backup was only 2 weeks ago, but I have been doing a lot of coding since then. Might take a few days to recover what I lost.

I need to make more frequent backups I guess. I have no experience with databases, but would definitely be interested in hearing if anyone does know how to do this.

109
So I have managed to crash Mach 4 to the point where I cannot even load my profile or restore the backups from the loader screen. I have an offline backup that I will be able to restore, however I do not have the changes to the Screen Load script, PLC script, or any other button scripts saved since this last backup.

Is there a way to access the Screen Script master file from the C:/Mach4Hobby directory so I can attempt to recover some of these changes?

I looked but could only find the modules I created.

Thanks :(

110
How do I create a desktop icon for my custom Mach 4 profile? I have modified the standard 4 axis profile for my needs. I can use the general Mach 4 icon to launch the loader screen, then my profile, but how can I create an icon to load my profile directly (skipping the loader window)?

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 »