1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. Fanuc Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

How to Run a Background Input Checker Program?

  • alive15
  • December 21, 2017 at 5:04 PM
  • Thread is Resolved
  • alive15
    Reactions Received
    15
    Trophies
    3
    Posts
    160
    • December 21, 2017 at 5:04 PM
    • #1

    Good morning,

    I have a R30iA Fanuc Controller with a main routine running 24/7. Recently, we have added a new machine to the cell, so this machine is outputting a "cycle complete" signal; however, it is not latched in the machine program. I need to look at this input in order for the robot to know when to enter the machine and pick the part.

    I need directions on how to latch this input through the robot teach pendant program; So for example, whenever that cycle complete signal comes on, I want the robot to latch this bit internally, and then at the start of the routine, it will reset that latched bit.

    Thanks,

  • alive15
    Reactions Received
    15
    Trophies
    3
    Posts
    160
    • December 21, 2017 at 5:31 PM
    • #2

    Currently looking through three different choices: BG Logic, Flags, and Data Registers. I feel a few of these options may help me with the task at hand, but I'm doing more research on these right now.

  • HawkME
    Reactions Received
    568
    Trophies
    10
    Posts
    3,268
    • December 21, 2017 at 7:24 PM
    • #3

    Use a BG logic program to turn on a Flag if the input is on. The BG Logic will always be running in the background, even after a power cycle. Your regular TP program can turn the flag back off at the start of the routine.

  • moln4r
    Reactions Received
    6
    Trophies
    2
    Posts
    128
    • December 21, 2017 at 8:10 PM
    • #4

    Like HawkME posted.BGLogic is your friend

  • alive15
    Reactions Received
    15
    Trophies
    3
    Posts
    160
    • December 21, 2017 at 9:44 PM
    • #5

    Yes, now I am using BG Logic, but I'm getting a intp-443. The website says "There is an operator or data that cannot be used in Mixed Logic. Mixed Logic statements are those that have parentheses." ??? The only thing I have with parentheses is F[1] = (on). Can I not use "on" ?

  • alive15
    Reactions Received
    15
    Trophies
    3
    Posts
    160
    • December 21, 2017 at 9:51 PM
    • #6

    This is the code so far:

    Label [100]

    If DI[17] = On, jump label 1

    If DI[18] = On, jump label 2

    Jump Label 100

    Label 1
    F[1] = (ON)
    Jump label 100

    Label 2
    F[2] = (ON)
    Jump label 100

  • HawkME
    Reactions Received
    568
    Trophies
    10
    Posts
    3,268
    • December 22, 2017 at 3:28 AM
    • #7

    You can't jump up, only down. BG logic programs automatically loop so no need to jump up.

    You don't need to use any jumps at all. Your code can simply be:

    If (DI[17]), F[1]=on
    If (DI[18]), F[2]=on

    Edited once, last by HawkME (December 22, 2017 at 3:31 AM).

  • alive15
    Reactions Received
    15
    Trophies
    3
    Posts
    160
    • December 22, 2017 at 2:55 PM
    • #8

    Thanks for the reply, I will try your code later today. To understand your code, If you put parenthesis around (DI[17]), that's the same as saying "If DI[17] = On" ?

  • HawkME
    Reactions Received
    568
    Trophies
    10
    Posts
    3,268
    • December 22, 2017 at 4:15 PM
    • #9

    Yes, it's Boolean logic.

    You can negate it by putting a "!" in front. ! is the "not" symbol.

    Sent from my SM-G930V using Tapatalk

  • alive15
    Reactions Received
    15
    Trophies
    3
    Posts
    160
    • December 22, 2017 at 4:27 PM
    • #10

    HawkME Thanks, is there a guide available for how to code in Boolean? I've studied Boolean Algebra, but the symbols seem different. I could not find any good guides through Google.
    Out of curiosity, can one switch from Boolean to just regular logic inside the BG code as well?

  • HawkME
    Reactions Received
    568
    Trophies
    10
    Posts
    3,268
    • December 23, 2017 at 12:56 AM
    • #11

    There's very little difference in the syntax. Each item in parentheses evaluates to True or false, with on=true and off=false.

    You can use any normal operator:
    ! (Not)
    And
    Or
    =
    <> (not equal)
    <
    >

    And you can group logical items in parentheses.

    (DI[1]=on) works the same as simply (DI[1]), you can use either syntax, they both evaluate to True.

    Just forget about jump labels and you will be fine. They can be used to jump downward but even that is unnecessary with the properly written logic.

    Sent from my SM-G930V using Tapatalk

  • Jaycephus
    Reactions Received
    15
    Trophies
    4
    Posts
    109
    • December 27, 2017 at 4:15 AM
    • #12
    Quote from alive15


    Yes, now I am using BG Logic, but I'm getting a intp-443. The website says "There is an operator or data that cannot be used in Mixed Logic. Mixed Logic statements are those that have parentheses." ??? The only thing I have with parentheses is F[1] = (on). Can I not use "on" ?


    That error, INTP-443 is referring to the fact that you don't have parenthesis in the IF statement. It is not referring to the Flags.
    I believe your version (or no version so far) permits any IF statement that is not "Mixed Logic" meaning you HAVE to use the parentheses with the IF statement, like:
    IF (DI[17]), F[1]=(ON)
    or something more complex like
    IF (!(DI[17] AND DI[18]) OR (DI[19] AND !DI[20])),JMP LBL[10]
    or
    IF (GI[1]>0 AND !(DI[1] OR DI[2])), DO[1]=ON ;


    So, HawkME's code is the only IF statement syntax that is permissible in a Background Logic program. (Even though regular TP will use either Mixed Logic, or the plain IF DI[17]=ON,JMP LBL[1] )

    Well, the newest systems permit the new IF () THEN ; ELSE ; ENDIF ;, but R30iA wouldn't have that.

    Like HawkME said, Background Logic automatically loops, so you treat it like writing ladder or structured text programs in a PLC. You can have a single IF (logic) statement, and that's all. It will loop as fast as it can, which is 4ms at best, or 8ms by default, I think on newish robots. Not sure if R30iA is that fast, or double those timings. If you have too much code in a program, or maybe certain instructions as well, you will not be able to go to the higher rate.

    The rate matters if you are doing anything complex because the only way to do timing for on-delay or similar is to have a Register act as a counter with a line that increments it every pass through the code. If you know that 250 counts is 1 second, then you can check if the register exceeds your desired timing value. But if the Background Logic rate changes from 4ms to 8ms due to adding code or someone setting the rate to Normal, then your timings will suddenly be twice as long.

    Anyway, there are some gotchas for BG Logic, like non-Mixed Logic IF statements, TIMER, and JMP up, etc.

    - Jay
    (This account has been screwed up by new Robot-Forum, and it no longer allows replies or new posts for an unknown reason that Robot-Forum has been unable to determine or help with. So, I have been unable to reply to any questions on my past posts. Apologies. I'm not ignoring people on purpose.) :frowning_face:

  • alive15
    Reactions Received
    15
    Trophies
    3
    Posts
    160
    • December 27, 2017 at 10:49 PM
    • #13

    HawkME Thanks for all the information, I will definitely use these in the future. The code you gave works with the teach pendant and robot controller in e-stop.

    Jaycephus Thank you for your explanation; I'm only switching on and off one flag through BG logic, checking for a machine ready signal. The robot can wait a few more ms before it's safe and clear to go in.

    Btw, Are you saying the data registers and flags can be used as timers? I didn't know you can do that. How would I figure out the loop rate? Is there an information tab on the teach pendant that automatically updates to tell you the loop rate speed based off the amount of code you have or do you have to make some educated guesses? I am interested to learn more about implementing timers into my robot logic if ever need be.

    Thank you,

  • Jaycephus
    Reactions Received
    15
    Trophies
    4
    Posts
    109
    • January 2, 2018 at 6:59 PM
    • #14

    The default (Normal speed) rate might be mentioned at the top of the BG Logic page. Not sure how that looks on a R30iA. It might be 8ms. If so, then 125 counts should, approximately, equal a second. If your timing is actually 16ms, then 63 counts would be about 1 second. Or you might be able to run in High speed mode on a given program like yours, and your timing would be 250 counts per second.

    I use a line like:
    IF(DI[1]),R[1:DwellTimeCnt1]=R[1:DwellTimeCnt1]+1 ; (increment R[1] while DI[1] is on)
    IF (!DI[1:MonitoredInput]),R[1:DwellTimeCnt1]=0 ; (reset R[1] when DI[1] is off)

    Then check for dwell being done:
    IF (R[1:DwellTimeCnt1]>R[2:DwellDuration]),F[1]=(ON) ; (trigger something when dwell or de-bounce is done)

    Then once some event happens, F[1] needs to be reset. The event could be another dwell timer acting as a conveyor-move watchdog timer, or a timer for retracting a pneumatic cylinder that doesn't have a retract sensor, etc. Or DI[1] goes low. Depends on the system.

    IF (<monitored event>),F[1]=(OFF) ;

    Now you can tweak R[2] value on the fly to get your de-bounce timer tweaked in.

    - Jay
    (This account has been screwed up by new Robot-Forum, and it no longer allows replies or new posts for an unknown reason that Robot-Forum has been unable to determine or help with. So, I have been unable to reply to any questions on my past posts. Apologies. I'm not ignoring people on purpose.) :frowning_face:

    Edited once, last by Jaycephus (January 2, 2018 at 7:12 PM).

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download