Results 1 to 7 of 7

Thread: On Bioloid: How did Robotis make the CALLBACK function in RoboPlus Task?

  1. Question On Bioloid: How did Robotis make the CALLBACK function in RoboPlus Task?

    How did Robotis make the CALLBACK function in RoboPlus Task? I've been trying for a while to make a function that executes every 0.1 seconds with atmega2561, but without success. Does someone know how and could share a simple code example please?

    Thanks!
    Mathieu, student in physical engineering at Laval University

  2. #2
    Join Date
    Sep 2010
    Location
    ಠ_ಠ
    Posts
    2,317
    Images
    27
    Rep Power
    283

    Re: On Bioloid: How did Robotis make the CALLBACK function in RoboPlus Task?

    To try to make me seem a bit less like a mean little * and put my original post into some sort of perspective. I went to a very large University (~44500 people in all) where, until the last 2~3 years, >90% of everyone (students, teachers, etc.) did not know the engineering department even existed (~500 people in the southern-most academic building on main campus). Learning about microcontrollers was with assembly language on a rather obsolete Motorola 68HC11 dev board with horrible software that deleted all your work when it crashed (this was still only ~2 years ago). Learning about timers and interrupts on the system was essentially: "here's a printout of the relevant pages of the manual, and the originals are on that cabinet over there if you need them. you'll get a little bit of a hint/nudge in the right direction, but figure it out for yourselves. you're big boys and girls^." (^yes, there really are women in the engineering program and they consistently make the guys look like the idiots we are - as if we need any help with that).



    Quote Originally Posted by tician View Post
    It is with 'Timers' and 'Interrupts'. Otherwise, RTFM.

    Why are you in college if not to learn?


    alright, a small hint on Interrupts in embedded-c:
    Code:
    SIGNAL(WHATEVER_TIMER_vector_you_decide_upon) 
    { 
        a_call_to_your_callback_function();
    }
    Basically you will: 1) select a timer to use, 2) initialize it, 3) define the function to be called when the code execution jumps to the interrupt vector (a set location in memory that contains the address to another location in memory) (that little bit of code above). Every time the timer's count rolls over or reaches a target value, it will cause the AVR to dump the program counter (and perhaps a few other values/registers) to the stack and begin executing the code at the address located in the corresponding vector. You will also have to make sure that your callback function is small enough to actually complete itself within the 0.1 seconds between interrupts.
    Last edited by tician; 08-11-2011 at 02:27 PM. Reason: regret/guilt
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    [git][mech][hack]
    gives free advice only on public threads

  3. #3
    Join Date
    Mar 2008
    Location
    Knoxville, TN
    Posts
    274
    Images
    35
    Rep Power
    58

    Re: On Bioloid: How did Robotis make the CALLBACK function in RoboPlus Task?

    Quote Originally Posted by tician View Post
    It is with 'Timers' and 'Interrupts'. Otherwise, RTFM.

    Why are you in college if not to learn?


    alright, a small hint on Interrupts in embedded-c:
    Code:
    SIGNAL(WHATEVER_TIMER_vector_you_decide_upon) 
    { 
        a_call_to_your_callback_function();
    }
    Dude, That's just a bit harsh. We're all on this forum so we can learn, build and create. I saw nothing in that request that warranted that kind of response. He's not asking us to do his homework.. He asked for examples.

  4. #4
    Join Date
    Sep 2010
    Location
    ಠ_ಠ
    Posts
    2,317
    Images
    27
    Rep Power
    283

    Re: On Bioloid: How did Robotis make the CALLBACK function in RoboPlus Task?

    Since my last post wasn't originally very useful...

    You will still need to check the manual for using timers (choosing a timer, setting its clock source/clock division value, and enabling the timer's interrupt).


    A brief introduction to interrupts from the great and powerful lnxfergy (although it is using some Arduino specific functions)
    http://forums.trossenrobotics.com/tu...terrupts-3248/

    All about interrupt functions included in avr-gcc
    http://www.nongnu.org/avr-libc/user-...nterrupts.html

    Specific interrupt vector names (you will want the ATmega2561)
    http://www.nongnu.org/avr-libc/user-...l#avr_signames

    A short reminder when dealing with 16-bit timer values
    http://www.nongnu.org/avr-libc/user-...ml#faq_16bitio

    Another potentially useful reference for a callback function/16-bit values
    http://www.nongnu.org/avr-libc/user-...l__atomic.html


    A very useful general reference for using avr-gcc
    http://www.nongnu.org/avr-libc/user-manual/modules.html
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    [git][mech][hack]
    gives free advice only on public threads

  5. #5
    Join Date
    Dec 2007
    Location
    Portland, OR
    Posts
    3,198
    Images
    952
    Rep Power
    146

    Re: On Bioloid: How did Robotis make the CALLBACK function in RoboPlus Task?

    Quote Originally Posted by tician View Post
    Since my last post wasn't originally very useful...

    You will still need to check the manual for using timers (choosing a timer, setting its clock source/clock division value, and enabling the timer's interrupt).


    A brief introduction to interrupts from the great and powerful lnxfergy (although it is using some Arduino specific functions)
    http://forums.trossenrobotics.com/tu...terrupts-3248/

    All about interrupt functions included in avr-gcc
    http://www.nongnu.org/avr-libc/user-...nterrupts.html

    Specific interrupt vector names (you will want the ATmega2561)
    http://www.nongnu.org/avr-libc/user-...l#avr_signames

    A short reminder when dealing with 16-bit timer values
    http://www.nongnu.org/avr-libc/user-...ml#faq_16bitio

    Another potentially useful reference for a callback function/16-bit values
    http://www.nongnu.org/avr-libc/user-...l__atomic.html


    A very useful general reference for using avr-gcc
    http://www.nongnu.org/avr-libc/user-manual/modules.html
    Kudos to you man for bringing this one around, + rep again.
    Last edited by DresnerRobotics; 08-12-2011 at 12:55 PM.

  6. #6
    Join Date
    May 2008
    Posts
    2,228
    Images
    155
    Rep Power
    132

    Re: On Bioloid: How did Robotis make the CALLBACK function in RoboPlus Task?

    Yep, +Rep.

    Also note, Atmel publishes many appnotes, which cover specific applications of timers on certain platforms.

    -Fergs

  7. Re: On Bioloid: How did Robotis make the CALLBACK function in RoboPlus Task?

    Thanks for editing your post and for the help. It now works.
    Mathieu, student in physical engineering at Laval University

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Question(s) Writing an educatonal book on robotics
    By darkback2 in forum Robotics General Discussion
    Replies: 107
    Last Post: 05-25-2010, 12:51 AM
  2. Question(s) Using CM-5 with Roboplus Task
    By jarred in forum Software and Programming
    Replies: 4
    Last Post: 04-30-2010, 01:04 PM
  3. Question(s) AVR Studio help - my first robot
    By grixxlee in forum Robotics General Discussion
    Replies: 6
    Last Post: 02-28-2010, 09:17 PM
  4. Bioloid Roboplus beta software from Robotis!
    By altwolf in forum Humanoids, Walkers & Crawlers
    Replies: 15
    Last Post: 09-17-2009, 11:31 AM
  5. Kondo web page translated.
    By Droid Works in forum Humanoids, Walkers & Crawlers
    Replies: 4
    Last Post: 10-06-2007, 06:49 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •