squarewave
10-12-2004, 05:29 PM
I have a situation where I would like to use the contents of a variable to specify an IO number, such as #(\53)=1. Is there any way of doing this?
I have a 12 tool changer where each tool has its own status switches (tool 2 is up; tool 2 is down) and would like to pass the tool number as a variable to a subroutine. I have numbered the switches such that I can define them in a subroutine with a constant offset, like tool 2 up and down would be #22 and #23, and tool 3 up and down would be #24 and #25, etc. So my expression would be "tool X is up" is #(2X+18) and "tool X is down" is #(2X+19).
I was hoping I might be able to do this with some string function, but haven't been able to come up with anything that works yet. Has anyone tackled this problem yet?
Thanks for any thoughts!
I have a 12 tool changer where each tool has its own status switches (tool 2 is up; tool 2 is down) and would like to pass the tool number as a variable to a subroutine. I have numbered the switches such that I can define them in a subroutine with a constant offset, like tool 2 up and down would be #22 and #23, and tool 3 up and down would be #24 and #25, etc. So my expression would be "tool X is up" is #(2X+18) and "tool X is down" is #(2X+19).
I was hoping I might be able to do this with some string function, but haven't been able to come up with anything that works yet. Has anyone tackled this problem yet?
Thanks for any thoughts!