January 17, 2019, 09:32:54 PM
Robotforum | Industrial Robots Community

 BGLOGIC code that I have found useful


Author Topic:  BGLOGIC code that I have found useful  (Read 61217 times)

0 Members and 1 Guest are viewing this topic.

December 13, 2017, 08:20:18 AM
Reply #50
Offline

Philippe54


Hello,
One thing I found very useful is the shifted override.
Instead of going from 5 to 5%, when you activate $SHFTOV_END=1 then it goes 100-50-5-1 and the same way back.
Great for integrators but it's better to disable it for real production  :icon_wink:
  • Like    Thanks

Today at 09:32:54 PM
Reply #51

Advertisement

Guest

December 13, 2017, 08:24:01 AM
Reply #51
Offline

bidzej


well, this has nothing to do with BG-Logic.
The variable you mentioned is usually set to 1 in smaller robots (like ArcMates), so the override can be set in steps 1-25-50-100[%].
But you're right, better to leave it at 0 in bigger ones.
  • Like    Thanks

January 09, 2018, 06:10:18 AM
Reply #52
Offline

tacheson


   6:  --eg:Initialize Strobe ;
   7:  !-------------------------------- ;
   8:  IF (F[42:OFF:Flasher .2sec]=OFF),F[43:OFF:Flasher .5sec]=PULSE,1.0sec ;
   9:  IF (F[43:OFF:Flasher .5sec]=OFF),F[42:OFF:Flasher .2sec]=PULSE,1.0sec ;
  10:  IF ($PWRUP_DELAY.$SY_READY=0),F[42:OFF:Flasher .2sec]=(ON) ;

This always helped me.  These two flags pulse back and forth.  Also, you don't have to worry about initializing it because it triggers when the sysvar PWRUP_DELAY is complete. 

I always use these flashers, and maybe more than just two, to indicate to operators what's happening if I only have a stack light with the standard 3 colors (Green=Running, Red=Faulted, Amber=Hold).  Then I can flash the yellow or other colors for other action items.

Example below.  When the inbound stack of parts is running out, i would indicate to the fork truck operator to prepare a new skid of parts.

   1:  !-------------------------------- ;
   2:  !Background Logic ;
   3:  !-------------------------------- ;
   4:   ;
   5:   ;
   6:  --eg:Initialize Strobe ;
   7:  !-------------------------------- ;
   8:  IF (F[42:OFF:Flasher .2sec]=OFF),F[43:OFF:Flasher .5sec]=PULSE,1.0sec ;
   9:  IF (F[43:OFF:Flasher .5sec]=OFF),F[42:OFF:Flasher .2sec]=PULSE,1.0sec ;
  10:  IF ($PWRUP_DELAY.$SY_READY=0),F[42:OFF:Flasher .2sec]=(ON) ;
  11:   ;
  12:  --eg:Flash Lights to Indicate to Operator Inspect Part is ready ;
  13:  !-------------------------------- ;
  14:  IF (F[15:OFF:Low Stack SrchVis]=ON),UO[3:OFF:Prg running]=(F[42:OFF:Flasher .2sec]) ;
  15:  IF (F[15:OFF:Low Stack SrchVis]=ON),UO[5:OFF:Motion held]=(F[42:OFF:Flasher .2sec]) ;
  16:  IF (F[15:OFF:Low Stack SrchVis]=ON),UO[6:ON :Fault]=(F[42:OFF:Flasher .2sec]) ;
  17:   ;
  18:  --eg:If UO is on or if Flasher is on Turn light On ;
  19:  !-------------------------------- ;
  20:  IF ((F[15:OFF:Low Stack SrchVis]=ON AND F[42:OFF:Flasher .2sec]=ON) OR UO[3:OFF:Prg running]=ON),DO[1017:OFF:Intrcnct EXGOP]=(ON) ;
  21:  IF (F[15:OFF:Low Stack SrchVis]=OFF AND UO[3:OFF:Prg running]=OFF),DO[1017:OFF:Intrcnct EXGOP]=(OFF) ;
  22:   ;
  23:  IF ((F[15:OFF:Low Stack SrchVis]=ON AND F[42:OFF:Flasher .2sec]=ON) OR UO[5:OFF:Motion held]=ON),DO[1018:OFF:Intrcnct EMGTP]=(ON) ;
  24:  IF (F[15:OFF:Low Stack SrchVis]=OFF AND UO[5:OFF:Motion held]=OFF),DO[1018:OFF:Intrcnct EMGTP]=(OFF) ;
  25:   ;
  26:  IF ((F[15:OFF:Low Stack SrchVis]=ON AND F[42:OFF:Flasher .2sec]=ON) OR UO[6:ON :Fault]=ON),DO[1019:OFF:Intrcnct EMGEX]=(ON) ;
  27:  IF (F[15:OFF:Low Stack SrchVis]=OFF AND UO[3:OFF:Prg running]=OFF),DO[1019:OFF:Intrcnct EMGEX]=(OFF) ;



Also, mapping your UOPs to virtual bits is slick too.  (Rack 0, Slot 0, Start 1-1000)  Then, you can have ALL THE POWER! 
  • Like    Thanks

June 13, 2018, 04:48:36 PM
Reply #53
Offline

MooseHorns


We often want to send a negative value to the robot for either an offset modifier, or to modify other registers.

We use mostly 16-bit words to communicate a negative number actually subtracts from the high end 65535, so when the PLC sends a -1 it actually sends to the robot 65535, we modify that using a BG Logic program similar to this:

1:  IF (GI[X]<=32768), R[X]=(GI[X])
2:  IF (GI[X]>32768), R[X]=(GI[X]-65536)

which sets the GI's to a register and gives them the appropriate sign, this does obviously limit your total value options to -32,768 thru 32,768; but we rarely need a value higher than 10,000.
  • Like    Thanks

June 13, 2018, 09:01:19 PM
Reply #54
Offline

YellowOneKonbie


You can actually do that in one line if you want.

1:R[X]=(GI[X]-(GI[X]DIV 32768)*65536)
« Last Edit: June 13, 2018, 09:03:56 PM by YellowOneKonbie »
  • Like    Thanks


Share via facebook Share via linkedin Share via pinterest Share via reddit Share via twitter

xx
BGLOGIC code questions

Started by Paulfedoniuk on Fanuc Robot Forum

7 Replies
1258 Views
Last post July 05, 2017, 02:01:19 PM
by Paulfedoniuk
xx
BGLOGIC

Started by Skipp on Fanuc Robot Forum

4 Replies
344 Views
Last post November 14, 2018, 06:22:10 PM
by HawkME
xx
R J2 BGLogic

Started by mortoch on Fanuc Robot Forum

1 Replies
1053 Views
Last post October 07, 2016, 02:15:05 AM
by ESIELI
question
PLC , BGLogic , or both?

Started by sean.ad on Fanuc Robot Forum

7 Replies
1579 Views
Last post June 28, 2017, 07:17:26 PM
by sean.ad