![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Fanuc Discuss Fanuc controllers here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
Hello, I am wondering if it is possible to set variables from the program via an array. For instance, at the end of the program I want to reset variable #500 through #550 to equal 0. I can do it line by line (#500=0, etc) but would really like to do it in 1 line. Any help would be greatly appreciated. Thanks! Dave |
|
#2
| ||||
| ||||
| Hi Dave, You can't do this all in 1 line, but you can use a short loop: #1=500 (FIRST VARIABLE NUMBER) WHILE[#1LE550]DO1 (START OF LOOP) ##1=0 (SETS THE VARIABLE *POINTED TO* BY VARIABLE #1 TO ZERO) #1=#1+1 (ADDS 1 TO VARIABLE #1) END1 Give that a try, it should do the trick. Regards, Scott |
|
#4
| |||
| |||
| Scott, Thanks, but that doesn't work. I get a 114 "Format error in macro" when I try and run the following program: O6025(RE-SET ALL VARIABLES TO 0) #1=500 (FIRST VARIABLE NUMBER) WHILE[#1LE550]DO1 (START OF LOOP) ##1=0 (SETS THE VARIABLE *POINTED TO* BY VARIABLE #1 TO ZERO) #1=#1+1 (ADDS 1 TO VARIABLE #1) END1 G30 As I said, I am tyring to re-set variable #500 thru #550 to 0. Any ideas? Thanks. Dave |
|
#5
| ||||
| ||||
| Hi Dave, Try this: O6025(RE-SET ALL VARIABLES TO 0) #1=500 (FIRST VARIABLE NUMBER) N1 #[#1]=0 (SETS THE VARIABLE *POINTED TO* BY VARIABLE #1 TO ZERO) #1=#1+1 (ADDS 1 TO VARIABLE #1) IF[#1LE550]GOTO1 G30 Note the addition of the brackets [] on N1 Regards, Scott |
| Sponsored Links |
|
#6
| |||
| |||
WHILE [#1LT550]DO1 not WHILE [#1LE550]DO1 it should be LessThan not LessEqual Alan B |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |