Shop OBEX P1 Docs P2 Docs Learn Events
Weird program problem — Parallax Forums

Weird program problem

RsadeikaRsadeika Posts: 3,840
edited 2008-02-12 19:46 in General Discussion
Attached, is a program, in SXB to control my Create robot. The problem is that the robot starts doing some random movements, as soon as it's turned on, but it has only been programmed to respond to the remote conrol, and not·random movements. I have double checked the interrupt code, and that seems to be OK, at least I do not see any obvious mistakes. The room that I am working in does not have anything that is putting out an IR signal, other than the remote control when I press a button. So, somehow the program is getting these random code instructions to control the robot.

This is the same program that I had worked on many, many months ago, and at that time I was having trouble with the arrays, but this time around the arrays seem to work. Must be the magic of starting from scratch. So, now I must have introduced another problem. It would be nice if another set of eyes would take a look see.

Thanks

Ray

Comments

  • ZootZoot Posts: 2,227
    edited 2008-02-11 17:10
    I can't speak to whether or not your commands to the Create are good (let's presume they are), but one thing I noticed: you are not clearing the hasCmd bit after checking it and processing the incoming IR bits from the remote. After processing, you need to clear hasCmd -- this alerts the background (ISR) and the foreground that the most recently received IR data has been dealt with and that the IR uart is free to receive another data packet.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • RsadeikaRsadeika Posts: 3,840
    edited 2008-02-12 19:20
    zoot, thanks for taking the time to look at my program. You say "After processing, you need to clear hasCmd ...", actually I thought I was doing that in the the 'main' loop. I setup an hasCmd = 0 after it came back from the processing routine, evidently you must be thinking of a different way of doing it.

    I wrote a small non-interrupt version of the program, and ran that, with the same problem occuring. Thinking that it might be a hardware problem, I pulled out a second brand new Create, and the same thing occurs with that one, testing both of the programs on it. So, now I am really stumped as to what the problem could be. The only thing left is try a different demodulator, but I thought with those things it was either they worked or they did not work.

    The second program that I wrote, I was trying to implement a State Machine technique, so if I ever solve this puzzle, I will finish the second program, and post it.

    Thanks

    Ray
  • ZootZoot Posts: 2,227
    edited 2008-02-12 19:46
    You're right about hasCmd. Sorry, I didn't see it on my first perusal. Well, that rules that out.

    You're using an SX52?

    Have you tested just the IR receive portion ( a watch+break on the command variables would do it) to see that you're getting the codes from the remote properly? That would at least tell you for sure if the problem is on the receive side of things or in the translating and tx'ing to the Create.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
Sign In or Register to comment.