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

BG Logic - set a signal on and off for amount of time

  • Nvm123
  • September 26, 2019 at 10:17 PM
  • Thread is Unresolved
  • Nvm123
    Trophies
    3
    Posts
    7
    • September 26, 2019 at 10:17 PM
    • #1

    Hello,

    I've been thinking lately if there's a possibility to set a signal on and off variably, e.g. 2 seconds.

    I want to use a bg logic program because everytime a TP is on (SO [7]) - the light flashes for 2 seconds (On for 2 secs, off for 2 secs and so on).

    I could easily do it using Wait() but in bg logic it's impossible to use wait instruction.

  • HawkME
    Reactions Received
    568
    Trophies
    11
    Posts
    3,268
    • September 27, 2019 at 12:31 AM
    • Best Answer
    • #2

    An easy way to time in BG logic is to constantly increment a counter. The counter value will equal the number of scans. So if your scan time is 8 ms then 250 scans = 2 seconds. When your counter reaches 250 reverse your output state and reset the counter to 0. Now you have a flashing output.

  • Nvm123
    Trophies
    3
    Posts
    7
    • September 27, 2019 at 7:50 AM
    • #3

    But won't this work for 2 secs only when the light is on? I want it to be off for 2 secs too.

    Edit: nevermind I already got that working by adding another counter. Thanks for help.

    Edited 2 times, last by Nvm123 (September 27, 2019 at 12:56 PM).

  • HawkME
    Reactions Received
    568
    Trophies
    11
    Posts
    3,268
    • September 27, 2019 at 3:07 PM
    • #4

    You can get it to work with a single counter by reversing the output state:

    : IF R[x:counter]>250, (DO[x]=!DO[x]);

  • scotty
    Reactions Received
    43
    Trophies
    5
    Posts
    497
    • September 27, 2019 at 3:17 PM
    • #5

    Tip#1: Use heartbeat signal and small logic to do it.

    Tip#2: Use $FAST_CLOCK internal system clock to count 2 sec and do what you need.

    Tip#3: Use TIMERS

    Timer probably the easiest way. Just do smth like this

    IF TIMER>0 AND TIMER<2

    stay ON

    ENDIF

    IF TIMER>2AND TIMER<4

    stay OFF

    ENDIF

    IF TIMER>4

    TIMER RESET

    ENDIF

  • flashbackxxl
    Trophies
    2
    Posts
    1
    • October 17, 2022 at 7:05 AM
    • #6
    Quote from HawkME

    You can get it to work with a single counter by reversing the output state:

    : IF R[x:counter]>250, (DO[x]=!DO[x]);

    Thanks, exactly what I was searching for.... but there is a little syntax flaw:

    : IF R[x:counter]>250, DO[x]=(!DO[x]);

  • akay98
    Trophies
    1
    Posts
    13
    • October 17, 2022 at 10:55 AM
    • #7

    I am very new to the robotics field and want to use BG Logic. I have a similar problem as you had.

    I want to create a heartbeat as soon as the cycle starts. I had read all the suggestions below but was not able to code it correctly in my tp.

    Can you please tell me how did you used the counter with a proper syntax.

    Thanks in advance.

  • theRoach
    Reactions Received
    7
    Trophies
    3
    Posts
    25
    • October 17, 2022 at 12:47 PM
    • #8
    Quote from akay98

    I am very new to the robotics field and want to use BG Logic. I have a similar problem as you had.

    I want to create a heartbeat as soon as the cycle starts. I had read all the suggestions below but was not able to code it correctly in my tp.

    Can you please tell me how did you used the counter with a proper syntax.

    Thanks in advance.

    Fanuc have a heartbeat. Menu > I/O > Cell Interface

    Counter with Fanuc heartbeat:

    pasted-from-clipboard.png

    DO[1000] = Fanuc heartbeat

    F[1] = Auxiliar flag

    Edited once, last by theRoach (October 17, 2022 at 1:01 PM).

  • Kavosol
    Reactions Received
    4
    Trophies
    1
    Posts
    9
    • October 17, 2022 at 2:24 PM
    • #9
    Quote from akay98

    I am very new to the robotics field and want to use BG Logic. I have a similar problem as you had.

    I want to create a heartbeat as soon as the cycle starts. I had read all the suggestions below but was not able to code it correctly in my tp.

    Can you please tell me how did you used the counter with a proper syntax.

    Thanks in advance.

    As scotty already said, use fanuc heartbeat signal.

    Press the [MENU] key and select "I/O". Then press F1, [TYPE] and select "Cell Interface". In the output screen ("IN/OUT") you will find “7 Heartbeat signal”. 7 Heartbeat signal. To allocate the signal, press F2, "CONFIG".

    If you want change “Heartbeat timing”:

    Press the [MENU] key. Select “6 SETUP” then "1 Prog Select". Type value in milliseconds.

    For more information, please refer to the OPERATOR’S MANUAL (Basic Function) B-83284EN/10.

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

Similar Threads

  • How to Map DIO to UOP on R-30iA?

    • alive15
    • January 10, 2018 at 2:52 PM
    • Fanuc Robot Forum
  • How to Run a Background Input Checker Program?

    • alive15
    • December 21, 2017 at 5:04 PM
    • Fanuc Robot Forum
  • Interconnect scan time?

    • NewbBotTek
    • March 31, 2017 at 4:00 PM
    • Fanuc Robot Forum
  • BG LOGIC to do something IF a button is held for a certain amount of time

    • barrett50cal
    • January 20, 2016 at 5:11 PM
    • Fanuc Robot Forum
  • Cell Interface I/O pulse length

    • Stevtol
    • February 22, 2016 at 11:53 PM
    • Fanuc Robot Forum

Tags

  • bg logic SO DO
  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