#### Moriseikiman

##### Aluminum

- Joined
- Dec 1, 2022

How to install the app on iOS

Follow along with the video below to see how to install our site as a web app on your home screen.

**Note:** This feature may not be available in some browsers.

You should upgrade or use an alternative browser.

- Thread starter Tonytn36
- Start date
- Replies 1,142
- Views 675,003

- Joined
- Dec 1, 2022

- Joined
- Sep 10, 2010

- Location
- Victoria Australia

So, are you referring to pre staging the next tool in the program? If so, its common safe practice to call the next tool again when the Tool Change is about to be made, as in the following example:

N1

T01 (Tool to put in spindle)

M06

T02 (Next Tool)

---------------

---------------

More Program Code

---------------

---------------

N2

T02 (Tool to put in spindle)

M06

T03 (Next Tool)

---------------

---------------

More Program Code

---------------

---------------

N3

T03 (Tool to put in spindle)

M06

T04(Next Tool)

and so on.

In the event that you have to rerun a Tool Operation, the above method ensures that the correct Tool is put into the Spindle. The above method also allows for the extraction of the two least significant numbers from a 4 digit Tool Number to be included in the Tool Change Macro.

Regards,

Bill

Regards

- Joined
- Jan 5, 2014

- Location
- Vancouver, WA. USA

#2 = #1 / 100

#3 = FIX[#2]

#4 =FIX[[ V2 - V3] * 100] (#4 = 28)

Hey Bill,

Is this an error? Seems like it should be ...

#4 =FIX[[ #2 - #3] * 100] (#4 = 28)

Also, can you explain MOD to me. I don't have a control that has the MOD function so I can experiment and in reading a 15M manual, don't understand how it behaves.

- Joined
- Sep 10, 2010

- Location
- Victoria Australia

Hello Kevin,Hey Bill,

Is this an error? Seems like it should be ...

#4 =FIX[[ #2 - #3] * 100] (#4 = 28)

Also, can you explain MOD to me. I don't have a control that has the MOD function so I can experiment and in reading a 15M manual, don't understand how it behaves.

Yes, you're correct. I use Visual Basic to Debug Macro Program and sometimes create the Macro Program in VB then convert it to User Macro Syntax. V B can't use the # symbol as a Variable identifier, its the symbol for Double Precision real numbers, and therefore, I normally use "V" instead of "#" and when finished, do a Global Find and Replace of V with #. I created the simple example in my earlier Post in VB and as there weren't many Variables, changed the Vs to # manually and they were two I missed.

I would hardly call a FS15 control a newer control, but as Sinha explains, MOD is the resulting remainder when a number is divided by another.

In the following example, where 9128 is divided by 1000, 128 will be the remainder. Actually, the extra step I said would be required if the right most three numbers were greater than 099, isn't quite correct. Had #1 = #20 MOD 1000 (#1 = 128) been written as #1 = #20 MOD 100 (#1 =28) then only the right most two numbers would be returned.

(#20 (or #4120) = 9128)

#1 = #20 MOD 1000 (#1 = 128)

#1 = #1 MOD 100 (#1 = 28)

Regards,

Bill

- Joined
- Jan 5, 2014

- Location
- Vancouver, WA. USA

Ahh, I wondered if it was something related to that. I think I recall you telling me a bit about your VB application to test macros.Hello Kevin,

Yes, you're correct. I use Visual Basic to Debug Macro Program and sometimes create the Macro Program in VB then convert it to User Macro Syntax. V B can't use the # symbol as a Variable identifier, its the symbol for Double Precision real numbers, and therefore, I normally use "V" instead of "#" and when finished, do a Global Find and Replace of V with #. I created the simple example in my earlier Post in VB and as there weren't many Variables, changed the Vs to # manually and they were two I missed......

Yes, while certainly not new, it was and still is a powerful control. Quite advanced capabilities in its day. When I looked at my Mitsu M50 and FS0 manuals and found no MOD function, I turned to a FS15 manual I have. Despite the Mitsu and FS0 manual not mentioning MOD, I think it worth trying to see if the ability exists despite not being documented. Seems the MOD function would be useful in parsing a number for say an engraving macro.......I would hardly call a FS15 control a newer control, but as Sinha explains, MOD is the resulting remainder when a number is divided by another.

- Joined
- Feb 2, 2016

- Location
- Lakeland, Florida

MOD is a new one to me as well.. If I am to understand it correctly if you was to change the second line in thisHello Kevin,

Yes, you're correct. I use Visual Basic to Debug Macro Program and sometimes create the Macro Program in VB then convert it to User Macro Syntax. V B can't use the # symbol as a Variable identifier, its the symbol for Double Precision real numbers, and therefore, I normally use "V" instead of "#" and when finished, do a Global Find and Replace of V with #. I created the simple example in my earlier Post in VB and as there weren't many Variables, changed the Vs to # manually and they were two I missed.

I would hardly call a FS15 control a newer control, but as Sinha explains, MOD is the resulting remainder when a number is divided by another.

In the following example, where 9128 is divided by 1000, 128 will be the remainder. Actually, the extra step I said would be required if the right most three numbers were greater than 099, isn't quite correct. Had #1 = #20 MOD 1000 (#1 = 128) been written as #1 = #20 MOD 100 (#1 =28) then only the right most two numbers would be returned.

(#20 (or #4120) = 9128)

#1 = #20 MOD 1000 (#1 = 128)

#1 = #1 MOD 100 (#1 = 28)

Regards,

Bill

(#20 (or #4120) = 9128)

#1 = #20 MOD 1000 (#1 = 128)

#1 = #1 MOD 100 (#1 = 28)

to this

(#20 (or #4120) = 9128)

#1 = #20 MOD 1000 (#1 = 128)

#1 = #1 MOD 10 (#1 = 8)

would that be accurate ? or would you have to step it down more like this.

(#20 (or #4120) = 9128)

#1 = #20 MOD 1000 (#1 = 128)

#1 = #1 MOD 100 (#1 = 28)

#1 = #1 MOD 10 (#1 = 8)

- Joined
- Sep 10, 2010

- Location
- Victoria Australia

No, you don't have to step it down to get just the right most number as in your above example and in effect I stated that in my earlier Post with the following extract from that Post.MOD is a new one to me as well.. If I am to understand it correctly if you was to change the second line in this

(#20 (or #4120) = 9128)

#1 = #20 MOD 1000 (#1 = 128)

#1 = #1 MOD 100 (#1 = 28)

to this

(#20 (or #4120) = 9128)

#1 = #20 MOD 1000 (#1 = 128)

#1 = #1 MOD 10 (#1 = 8)

would that be accurate ? or would you have to step it down more like this.

(#20 (or #4120) = 9128)

#1 = #20 MOD 1000 (#1 = 128)

#1 = #1 MOD 100 (#1 = 28)

#1 = #1 MOD 10 (#1 = 8)

Actually, the extra step I said would be required if the right most three numbers were greater than 099, isn't quite correct. Had #1 = #20 MOD 1000 (#1 = 128) been written as #1 = #20 MOD 100 (#1 =28) then only the right most two numbers would be returned.

and you don't require the two steps shown in your example. The following will result in returning only the right most single number from the original number 9128:

(#20 (or #4120) = 9128)

#1 = #20 MOD 10 (#1 = 8)

Regards,

Bill

- Joined
- Feb 2, 2016

- Location
- Lakeland, Florida

Thanks Bill I missed your earlier explanation of that.No, you don't have to step it down to get just the right most number as in your above example and in effect I stated that in my earlier Post with the following extract from that Post.

and you don't require the two steps shown in your example. The following will result in returning only the right most single number from the original number 9128:

(#20 (or #4120) = 9128)

#1 = #20 MOD 10 (#1 = 8)

Regards,

Bill

- Joined
- Jan 5, 2014

- Location
- Vancouver, WA. USA

Today I tested MOD on a Fanuc 0MB. Doesn't work Won't even accept the character O in a macro code line. I also tried MOD on a Mitsubishi M50. It functions same as on a MOD capable Fanuc. In my initial look through the Mitsu programming manual I did not find MOD listed in the macro functions. A subsequent look and I found it mentioned outside of the list of functions. Pretty obscure.I think you are correct.

MOD is not included in the function list of 0iTC manual.

However, this is from the same manual ...

View attachment 411638

Won't even accept the character O in a macro code line

- Joined
- Jan 5, 2014

- Location
- Vancouver, WA. USA

It was an interesting thing to try. I could key in MOD, but then when you press the EOB button and then the insert button, the O vanishes.Since the MDI keyboard is an "intelligent" keyboard, chances are that if one is able to type MOD, it might be available.

- Joined
- Sep 10, 2010

- Location
- Victoria Australia

Hello Kevin,Seems the MOD function would be useful in parsing a number for say an engraving macro.

I've given this notion a bit of thought and I believe there are better methods than using MOD. With an engraving program of a number, you want to be dismantling the number one digit at a time, from either left to right, or right to left. This is more difficult to do with MOD than with other methods I've Posted on this Forum for that purpose.

In any case, unless the number to decode for engraving is always of the same fixed length, the number of digits in the number needs to be determined. This can be done with the following:

#1 = 222220 (Number to Dismantle)

#2 = 1 (First Base 10)

#3 = 0 (Counter)

WHILE [#1 GE #2] DO1

#2 = #2 * 10

#3 = #3 + 1

END1

IF [#2 GT #1] #3 = #3-1 (The number of digits in the number)

Regards,

Bill

Last edited:

- Joined
- Sep 10, 2010

- Location
- Victoria Australia

Correction to the above code is shown following:Hello Kevin,

I've given this notion a bit of thought and I believe there are better methods than using MOD. With an engraving program of a number, you want to be dismantling the number one digit at a time, from either left to right, or right to left. This is more difficult to do with MOD than with other methods I've Posted on this Forum for that purpose.

In any case, unless the number to decode for engraving is always of the same fixed length, the number of digits in the number needs to be determined. This can be done with the following:

#1 = 222220 (Number to Dismantle)

#2 = 1 (First Base 10)

#3 = 0 (Counter)

WHILE [#1 GE #2] DO1

#2 = #2 * 10

#3 = #3 + 1

END1

IF [#2 GT #1] #3 = #3-1 (The number of digits in the number)

Regards,

Bill

#1 = 222220 (Number to Dismantle)

#2 = 1 (First Base 10)

#3 = 0 (Counter)

WHILE [#1 GE #2] DO1

#2 = #2 * 10

#3 = #3 + 1

END1

(3# = The number of digits in the number)

Regards,

Bill

- Joined
- Feb 2, 2016

- Location
- Lakeland, Florida

Bill I am a little confused about what the goal is with this one. You said to dismantle a number 1 at a time from from left or right. Maybe I am overthinking it but would't it grow by a factor of 10 each iteration of the do-while?Hello Kevin,

I've given this notion a bit of thought and I believe there are better methods than using MOD. With an engraving program of a number, you want to be dismantling the number one digit at a time, from either left to right, or right to left. This is more difficult to do with MOD than with other methods I've Posted on this Forum for that purpose.

In any case, unless the number to decode for engraving is always of the same fixed length, the number of digits in the number needs to be determined. This can be done with the following:

#1 = 222220 (Number to Dismantle)

#2 = 1 (First Base 10)

#3 = 0 (Counter)

WHILE [#1 GE #2] DO1

#2 = #2 * 10

#3 = #3 + 1

END1

IF [#2 GT #1] #3 = #3-1 (The number of digits in the number)

Regards,

Bill

WHILE [#1 GE #2] DO1

#2 = #2 * 10

#3 = #3 + 1

END1

first iteration result would be #2=10

second iteration result would be #2=100

third iteration result would be #2=1000

and so on.

Or am I just missing something?

That is correct. The number of digits is the final value of #3.Bill I am a little confused about what the goal is with this one. You said to dismantle a number 1 at a time from from left or right. Maybe I am overthinking it but would't it grow by a factor of 10 each iteration of the do-while?

WHILE [#1 GE #2] DO1

#2 = #2 * 10

#3 = #3 + 1

END1

first iteration result would be #2=10

second iteration result would be #2=100

third iteration result would be #2=1000

and so on.

Or am I just missing something?

Another way, without a loop, can be this:

#3 = FIX[LN[#1]/LN[10]]+1

If #1 is 222220 then

LN[#1] = 12.311---

LN[10] = 2.302---

LN[#1]/LN[10] = 5.346---

FIX[LN[#1]/LN[10]] = 5

FIX[LN[#1]/LN[10]]+1 = 6

Hence, #3 = 6 (As expected)

- Joined
- Feb 2, 2016

- Location
- Lakeland, Florida

Never have used the natural logarithm function before that is interesting. The main thing that I was referring to was the dismantling a number 1 at a time from left or right. I was thinking decreasing by 1 each iteration instead of a factor of 10. I'm thinking I just misunderstood Bill's intent.That is correct. The number of digits is the final value of #3.

Another way, without a loop, can be this:

#3 = FIX[LN[#1]/LN[10]]+1

If #1 is 222220 then

LN[#1] = 12.311---

LN[10] = 2.302---

LN[#1]/LN[10] = 5.346---

FIX[LN[#1]/LN[10]] = 5

FIX[LN[#1]/LN[10]]+1 = 6

Hence, #3 = 6 (As expected)

- Replies
- 9

- Views
- 418

- Replies
- 2

- Views
- 293

- Replies
- 10

- Views
- 729

X

Notice

This website or its third-party tools process personal data (e.g. browsing data or IP addresses) and use cookies or other identifiers, which are necessary for its functioning and required to achieve the purposes illustrated in the cookie policy. To learn more, please refer to the cookie policy. In case of sale of your personal information, you may opt out by sending us an email via our Contact Us page. To find out more about the categories of personal information collected and the purposes for which such information will be used, please refer to our privacy policy. You accept the use of cookies or other identifiers by closing or dismissing this notice, by scrolling this page, by clicking a link or button or by continuing to browse otherwise.