Shop OBEX P1 Docs P2 Docs Learn Events
Saving Program on SumoBot — Parallax Forums

Saving Program on SumoBot

ToddHToddH Posts: 34
edited 2004-12-29 21:51 in BASIC Stamp
I have a sumobot (BS2) from TAB. I created my first program. Yippy for me [noparse]:)[/noparse] When I have the serial cable plugged into the robot and execute "RUN" it runs the program just fine. Continuing to have the cable plugged in, I can turn the robot off and on again and it will run MY program that I created.

Here is the issue: If I removed cable from the robot, the robot reverts back to the program that comes loaded on the chip (doesn't run my program anymore).

Any thoughts on how I can get my program to stay with the robot after the serial port is disconnected?

Thanks again! turn.gif

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-28 15:03
    Your program IS still on the robot after the serial port is disconnected.

    The Tab Sumobot uses a 16C505 co-processor for the 'native' behaviors. It has a on-board BS2 you program to control the co-processor, which then runs the motors etc. The first thing in your BS2 program should be a command to tell the co-processor not to do anything -- and I believe you must do this after a delay, to let the co-processor 'reset' itself and start 'listening' to the BS2.

    Check also http://groups.yahoo.com/group/tabrobotkit in their 'Database' area they have an FAQ which may help you solve your problem.

    Okay, I just went there, and no this is not a common problem.· Probably you need to send a 'RobotStop' command the first thing you do in your BS2 program.


    Post Edited (allanlane5) : 12/28/2004 3:09:49 PM GMT
  • ToddHToddH Posts: 34
    edited 2004-12-28 18:33
    Well, it has nothing to do with the cable. I did a little testing and I think you are on to something, Allan. Leaving the cable plugged in I download the program.... it runs fine. I powercycle over and over again - seems the "native" behavior runs about 4 out of 5 times. My program runs about 1 out of 5 or 6 times. I have at the top of my program:

    pause 200 ' Stop the Robot from Running
    RobotData = RobotStop
    gosub RobotSend
    pause 100 ' Wait for Robot to Get Setup
    low LED ' Flash LED Twice
    pause 200
    high LED
    pause 200
    low LED
    pause 200
    high LED
    .....

    I've tried adjusting the pause before the RobotStop from 50 to 500 and I get the same results. Any ideas?

    Thanks in advance!
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-28 18:40
    Perhaps repeat the 'RobotSend' command for the RobotStop? (Three times, with 100 mSec between repeats should do it).

    Make sure you reload the RobotData parameter each time -- I suspect it is destroyed by the RobotSend command.

    I don't know why you're having this problem. It almost sounds like a missing pull-up or pull-down on the lines between the BS2 and the co-processor. The co-processor, even when running 'native' behaviors, should still be 'listening' for signals from the BS2.

    Umm, it just occurred to me, you DO still have the:

    '· Mainline
    ·· HIGH SC··········· '· Set the I/O Bits As Output
    ·· HIGH SD··········· '·· and High
    ·· HIGH LED········ '· Turn off the LED

    lines in your code, right?· The SC and SD lines are what is used to the co-processor, and signaling won't work right if these are not set right.



    Post Edited (allanlane5) : 12/28/2004 6:47:59 PM GMT
  • ToddHToddH Posts: 34
    edited 2004-12-28 20:32
    okay - its gets interesting now:

    I coded as you described above. Here is what I see (and its consistant):
    Power on - runs my program
    Power off - Power on - runs "native" program
    Power off - Power on - runs "native" program
    Then...
    Power off - COUNT TO 10 - power on - runs my program (every time!)

    As long as I count to 10 after powering off the robot it will run my program every time. If I power down and count to 1 or 2 and turn it back on - it runs native.

    Can you explain to this novice.. why?
  • RickBRickB Posts: 395
    edited 2004-12-28 21:19
    allanlane5 is probably correct. Sounds like a floating input.

    Rick
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-29 15:56
    It is concievable that the PIC16C505 is never resetting with a less than 10 second power-down. A PIC does not pull a lot of current, and it is possible that the on-board capacitors are providing enough current for the PIC to continue running.

    Thus, when you do a 'short' power-cycle, the BS2 resets but the PIC does not. Then the PIC runs the 'native' stuff and ignores the BS2.

    With the cable plugged in, you have something to 'suck' the voltage from the SumoBot, thus resetting the 16C505 every time.

    It's only a theory, though. A 'hard reset' push button would be nice to prove this -- but then it doesn't really sound like you need it, if a 10-second delay is enough.
  • ToddHToddH Posts: 34
    edited 2004-12-29 21:51
    lol - from my beginning understanding of electrontics that sounds about right. And yes, 10 seconds isn't a lifetime to wait. Thanks for your explainations [noparse]:)[/noparse]
Sign In or Register to comment.