CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > Fanuc


Fanuc Discuss Fanuc controllers here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 05-08-2009, 11:35 AM
 
Join Date: Apr 2009
Location: Canada
Posts: 20
Adam Rehorn is on a distinguished road
Transferring a Counter Value

Hey all!

Well, I've got another interesting question for you.

How can I transfer a value from a ladder logic counter to my NC? I would like to use a custom M-code to count the holes in a part, and then return this to the NC. I will be making some decision logic on further machining depending on the numbe rof holes I find.

I can transfer individual bits, I know, by setting the G1054.0 -> G1055.7 bits to change the state of #1000-#1015. However, those are only 1's and 0's, right?

I want to transfer a number like, say, "9", to one of the custom macro variable values, say, #134.

I need this, because my NC code would say something like:

IF[#134LT12]GOTO 45
...

The number in #134 would come from my counter.

Please, if you can help me out, I'd appreciate it!

Thanks!
Reply With Quote

  #2   Ban this user!
Old 05-08-2009, 02:28 PM
 
Join Date: Jun 2008
Location: United States
Posts: 1,507
stevo1 is on a distinguished road

I am not a ladder guy so I can't answer how to transfer numbers from the ladder to a variable. Is there a reason why you can't count the holes that you are doing by using the variables? I write a lot of macros and just have a variable counter every time that a hole has been completed. This will continue to count until it has reached the number of holes set to be machined, then end.

#134=#134+1
IF[#134LT12]GOTO45


There are so many ways to do this with just NC programming. By the looks of it you want to do 12 holes equally spaced 30deg apart. I would take it a few steps further and just have a variable that specifies how many holes you want to do and let the program calculate and figure out the spacing and when to stop. You can also set it up to start on any hole that you want and it will finish the proper amount of holes.

Stevo
Reply With Quote

  #3   Ban this user!
Old 05-09-2009, 07:43 AM
 
Join Date: Sep 2005
Location: USA
Age: 60
Posts: 755
Dan Fritz is on a distinguished road

You say that you're trying to "find" the number of holes in a part using the PC ladder ?? How do you plan to do this, with a touch-probe? A vision system?

If you want to transfer an integer value to a macro variable, you can use the PC ladder logic to set the 16 macro inputs UI0 thru UI15 as a binary number, then read macro variable #1032 in your macro. #1032 will return the binary value of those 16-bits.

0 = Ui0 to Ui15 all zeros
1 = Ui0 set to "1" all others "0"
2 = Ui1 set to "1" all others "0"
3 = Ui0 and Ui1 set to "1" all others "0"
4 = Ui2 set to "1" all others "0"
5 = Ui2 and Ui0 set to "1" all others "0"
6 = Ui2 and Ui1 set to "1" all others "0"
7 = Ui2 and Ui1 and Ui0 set to "0" all others "0"
8 = Ui3 set to "1" all others "0"
(etc.)

The maximum number is Ui0 thru Ui15 all "1"s, or 1111111111111111, which is 65536
Reply With Quote

  #4   Ban this user!
Old 05-11-2009, 08:11 AM
 
Join Date: Apr 2009
Location: Canada
Posts: 20
Adam Rehorn is on a distinguished road

Hey, Dan!

Yes, more or less with a vision system. I have a laser sensor that I use to check for holes. If it sees a reflection, then it's a solid area of the part, if it doesn't, then it's a hole.

I need to write an M-code (which I can now do, thanks to Shoprag) that will allow me to inspect the value of the sensor output (a 1 or 0) during a 360 degree rotation. If possible, I'd like to count the number of holes, and then I can make a decistion to repunch any missing holes. This is for a rework routine.

So, Dan, what are UI0-UI15? I've not heard of a U variable before. I know F, G, X, Y, R and A, but not U. How do I access them? Do you have any way to explain what the ladder would look like for this? Or is there some function that will take a counter value and dump it automatically to the U variables you list?

I get the idea, and it's cool that #1032 will do the translation from binary to decimal for the NC (or that's what I understood at least), but how does the initial setup look. I'm still a bit lost on the implementational details.

Please let me know.

Thanks.
Reply With Quote

  #5   Ban this user!
Old 05-11-2009, 08:36 AM
 
Join Date: Sep 2005
Location: USA
Age: 60
Posts: 755
Dan Fritz is on a distinguished road

Adam,

The Ui0 through Ui15 inputs are in the ladder somewhere as inputs to the CNC (G inputs). I'm not sure of the exact addresses in your ladder, but those are the signal names that Fanuc gives them. Also, you didn't mention what model Fanuc control you have. On the Fanuc 16/18/21 models, I believe that they are the 16 bits in G054 and G055. I would have to look in a PC ladder function manual to get the exact location of the 16 bits.

Once you know the exact addresses of the Macro inputs, try adding a rung to the ladder that sets one of the inputs to "1". Then, run a short macro program that takes the value of #1032 and puts it in a visible location (like variable #501, which you should be able to see on the MACRO VAL page. You would then see the decimal value of the binary input you just gave it.

On very old CNCs like the system 6, they didn't label the inputs as "G" or "X" or "Y" addresses, so that would take a bit of cross-referencing from an address table.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 05-19-2009, 07:41 AM
 
Join Date: Apr 2009
Location: Canada
Posts: 20
Adam Rehorn is on a distinguished road

It's a 30i controller. I was really hoping there would be a way to increment a counter in the ladder logic and then take this number and put it into a register that could take more than 1's and 0's, like say #130.

I use #115-#130 in my NC code to handle counter variables and as status flags. However, I don't know if there's any link between them and the ladder logic.

I would prefer to not have to do any binary-decimal conversions in the NC. Is there any kind of direct transfer?

Thanks!
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
need help transferring cam chadillac General CNC (Mill and Lathe) Control Software (NC) 0 05-07-2009 01:45 PM
Problem- transferring deleted programs???? spock Machine Problems, Solutions , Wireless DNC, serial port 0 05-29-2008 08:27 PM
UP/DOWN COUNTER Elijah Turner General Electronics Discussion 8 02-01-2008 10:10 AM
Need Help!- transferring dxf files to a hurco fritos HURCO 1 01-31-2008 09:48 PM
Transferring User settings HuFlungDung OneCNC 2 04-15-2003 10:05 AM




All times are GMT -5. The time now is 09:45 PM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361