So, I've only been using BGLOGIC for a couple months now. In my opinion, this is something that FANUC should teach in their advanced TPP class, because it's extremely useful. If it wasn't for the suggestion of somebody here, I never would have discovered this feature on my own. I guess they expect people to read their manual cover to cover, but there isn't enough coffee in the world to keep me awake if I tried that. I've managed to take a lot of heat off of our PLC programmer, and I've already developed a few routines that I've found almost universally useful.
So as a way of saying thanks, here are a couple code snippets I thought I'd share.
One shots are used when you only want something to happen for one scan of the program. This can be used to replace macros that are triggered by inputs. Why would you want to do that? Well, input macros don't work in T1 or T2.
One Shot Method A
F[1]=(OFF)
IF (DI[1] AND !F[2]),F[1]=(ON)
F[2]=(DI[1])
Now F[1] can be used at any point to test for a one shot condition before the end of the BG program
One Shot Method B
IF (DI[1] AND !F[1]),...
(Repeat above IF instruction when needed before next line)
F[1]=(DI[1])
One Shot Output Toggle
This is handy for using a single input (like a push button or sensor) to toggle an output on and off
IF (DI[1] AND !F[1]),DO[1]=(!DO[1])
F[1]=(DI[1])
Output Strobe
We put three color stack lights on our controllers, and I use this routine to make the yellow light flash when I turn on F[1]
IF (F[1] AND !F[3]),F[2]=PULSE,0.2sec
IF (F[1] AND !F[2]),F[3]=PULSE,0.2sec
IF (!F[1]),F[2]=(OFF)
IF (!F[1]),F[3]=(OFF)
DO[1:Light]=(F[2])
If anybody wants to add, feel free!