Hey all!

I'm back. I've got the writing of M-codes down cold, so that's fine.

However, now here's what I want to do now.

I need to have an M-code that will rotate a part 360 degrees, and count the number of holes around the top of it.

I can write the start and finish of the M-code. I'm having problems with the counter, though.

I have looked up the CTR counters, and I know how to set it to be a count up, starting at zero, and how to reset it. I also know how to use the input from my sensor to drive the counting action.

What I cannot figure out is what to do with the output. The only examples I have are of the counters turning a bit on or off. I don't want that. I want to export the number it counts. It could see anywhere from 1-12 holes.

Where can I access the number accumulated by the counter?

Ideally, I would like to use the number in the NC. I have no idea how to get it to the NC though. How do I assign a value to a user variable, say #122, that is the counter output? Is this possible?

If this isn't possible, then I know a cheater's way to do it. I'll have to use some kind of compare function (CMPB?) to say "if <counter value> = 1, set #1000 high", "if <counter value> = 2, set #1001 high", etc.

It sucks, but it might work. However, it definitely WON'T work if I can't get the bloody value out of my counter!

So, can anybody help me?? I have to have this working ASAP (of course...)

Thanks!