Today we will be looking at the procedure for adding the ability to handle “%” signs to a standard serial port. This will allow us to run programs that do not have percent signs on machines that require them at the beginning and end of programs without editing the program. Let’s say for instance that we have a machine down and need to run production on another machine. We don’t want to edit the program written for a specific machine so we will modify the port to translate the program on the fly.
This only applies to machine ports that were created using the “Generic Serial Template” in DNC-Max. If you are creating a new port, there is a template that adds this functionality by default. This template is called “Generic Serial Template – Handle % Characters”. In the case of our example, we want to use an existing machine port but add this ability to it. Here is how we do it.
Removing Existing Feed Characters
We will start by adding the following translators under Transmit> Translators:
Translator 1:
The first translator is to remove any existing “%” from the beginning of the program to avoid adding a second if one already exists. “<^ *% *$>” (without the quotes) is the actual string that belongs in the Trigger box. We want to set the ‘When’ field to “always” and the ‘Operation’ field to “Delete Line”.
Translator 2:
The second translator is to remove any additional ones that are found outside of a comment. It will only remove the “%” character. For this one, the ‘Trigger’ is “%”, the ‘When’ is “Outside Comments”, and the ‘Operation’ is “Remove”.
Adding Them Back
Now that we have removed any existing characters, we want to add them to the beginning and end of the file. (Or add them back if we removed them.) This is required to stop the software from adding a “%” every time we send the program to the machine. If a program has 2 percent signs at the beginning, it will treat the second as an end of feed character and send an empty program to the machine.
Under Transmit> Start of feed, we want to check the boxes for “Send data before start of feed” and “No translation of feed data”. The second thing is to add a “%” into the send data box. It is also very important that we add a carriage return (press ‘Enter’) to the ‘Send data’ box as well. We want to make sure that the cursor is on the line below the “%” or DNC-Max will not put it on its own line.
We need to do the same thing under Transmit> End of feed. Remember to add a carriage return (press ‘Enter’) after the “%” sign in the ‘Send data’ field so that DNC-Max puts the character on its own line.
If needed, we can set up a receive translator that will remove them from the program when we send it back to the computer.
The port will now be able to handle programs that do not have “%” signs by adding them automatically on the way to the control. It will still be able to run its original programs, but it will also be able to successfully transmit programs that do not have them. This will save programmers from having to keep track of which machines need them. By setting it up on the port, DNC-Max knows that it needs to add them to programs sent to the machine and can be set up to automatically remove them if needed as well. This allows us to keep production running until we are able to get our original machine running without having to modify all of the original programs. Once the down machine is repaired, everything goes back to normal on both machines without changing anything.
I knew the power of translators, but you have done it with good documentation. Thanks for sharing.
Thanks Deepak! Good to see you stopping by our website! Hope all is well with you.