Shop OBEX P1 Docs P2 Docs Learn Events
programming help!!! SOMEBODY plz — Parallax Forums

programming help!!! SOMEBODY plz

avitusavitus Posts: 23
edited 2006-11-18 22:07 in BASIC Stamp
HI, I have been working on what i thought would be a fairly easy project for some time now. However, i now find myself with a BS2 and a entire list of strange alien commands. Basically, I need help writing the script for my chip.

The purpose of my project is to mod an xbox controller to do a particullar rythem of buttons, with the push of ONE newly installed BUTTON. I have all the mechanics worked out. i just need to record the sequence of buttons and there timing then save that info, and program it to perform that sequence onscreen. Like i said all the inputs and outputs work correctly just the timing is off. so i must record myself manually on the controller to get the propper timing down. any help on how i can do this would be much appreciated. thank you.

-avitus

Comments

  • metron9metron9 Posts: 1,100
    edited 2006-10-27 05:55
    1. How many buttons are input that you need to record
    2. How much time is a sequence of button pushes maximum
    3. How many button pushes in a sequence maximum
    4. How many button sequences do you want to store

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
  • avitusavitus Posts: 23
    edited 2006-10-27 22:59
    I have1 button sequence to record off of two inputs. 8 seconds max.
  • avitusavitus Posts: 23
    edited 2006-10-27 23:00
    max of 3 button hits in the sequence
  • avitusavitus Posts: 23
    edited 2006-10-28 13:58
    120 views and no one will leave me a reply?? come on guys. someone plz help me here.
  • Tommy BotTommy Bot Posts: 60
    edited 2006-10-28 19:27
    I believe that X-box sell a controller that has three recordable buttons on it. (Macro Controller). At a cost of `$30 out of the box ready to go, can you afford to sink over $100 in parts + countless hours developement and research?

    Someone would have to do the reverse engineering to determine signal compatability in order to do it yourself.

    It is very difficult to jump into a language you don't know for the purpose of completing a dream project without first going through a learning curve.

    I have projects that I want to do with the BS2, but I don't know how to program that well. So I am stepping through WAM and Robotics with the BoeBot in order to learn.

    If you know some, others can help where you are lacking. If you know nothing, then what you're really asking is for others to do it for you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    (Frequently heard from other's)

    Tommy, I know it wasn't designed to·x, but can you make it·do x·anyway?

    ·
  • avitusavitus Posts: 23
    edited 2006-10-28 20:15
    yes i am humbling myself and asking for advise. if you dont know how to help me then plz dont patronize me. I know that there are a few simple commands that i am lacking. and there are many others out there that do know how to record multiple input timings, if you dont then fine but i am hear to listen and learn.

    as for the macro controller it wont do what i am looking to do.
  • Tommy BotTommy Bot Posts: 60
    edited 2006-10-28 20:17
    Didn't mean to come off harsh, I don't have room to talk.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    (Frequently heard from other's)

    Tommy, I know it wasn't designed to·x, but can you make it·do x·anyway?

    ·
  • avitusavitus Posts: 23
    edited 2006-10-28 20:21
    Thats fine. I'm just a bit frusterated myself. All the hardwares finished, and everything is working as it should i just cant figure out a few simple lines of script. Sorry for biting back
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-10-28 21:25
    What's the shortest time between button presses you need to record?

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    StampPlot - Graphical Data Acquisition and Control
    AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-10-28 21:38
    Ok, here's one way without knowing a lot about how things are.· Let's assume your inputs are on IN0 and IN1 and the IN2 and IN3 are not being used, collectively this group is called INA.· And your outputs are on OUT4 and out5 without anything on OUT6 and OUT 7.· Collectively this group is called OUTB

    TO record:

    WAit for the input to pressed to record a sequence (in10?) and this will store 8 seconds worth at·100mS intervals approximately.

    FOR X = 0 to 80

    · WRITE X, INA··· ' store in EEPROM
    · OUTB = INA····· ' pass to output now if needed

    ··PAUSE 100
    NEXT

    When you are ready to replay, let say you press a button IN11 and·it does this:

    FOR X = 0 to 80

    · READ·X,OUTB··· '·read from·EEPROM
    ··PAUSE 100
    NEXT

    ·THe samples at 100mSec are needed to try to reproduce the timing involved and ensure a button press is not mixed.· There's other ways it could be done, but this is a fairly simple method.· Just ensure you program memory is above address 80 or it will be written over.

    My keyboard is acting up, think I need a reboot....

    -Martin



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    StampPlot - Graphical Data Acquisition and Control
    AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-10-28 21:42
    Avitus,

    If you post your code it may help others to see where your problem is. Your initial post gives too little information detail for somebody to offer suggestions.

    Also, keep in mind that people posting here are very willing to help others, but are generally not willing to do the work for them.

    The posts that raise the most red flags, and get the least responses, are those that are 1) post number 1, 2) asking how to do something fairly complex with no solid indication of what has already been accomplished by the poster, and 3) demanding help.

    As long as your posts aren't coming across that way, you shouldn't have any trouble getting responses.
  • avitusavitus Posts: 23
    edited 2006-10-29 07:56
    Kevin and martin.

    Thank you for your help and advise.
    I dont mean to sound incompetent, but i am having trouble.
    so this is where i am at...

    pin11, pin12, pin13 are my inputs

    pin0, pin1 are my outputs.

    what i am wanting to do is record 2 seperate sequences of inputs and place one on each output.
    then be able to play the sequence on the outputs by pushing the buttons i've installed each output.

    i know this cant be very difficult. i am just missing something terribly simple im afraid.

    I am still tamperring with your code Martin, and thank you again for your advise
  • avitusavitus Posts: 23
    edited 2006-10-29 08:13
    i am also trying to store these commands into the same program. and assigning them to a single output.
    can this be stored in the EEPROM or is it to big. and or is there an easier way


    HIGH 14
    PAUSE 100
    LOW 14
    PAUSE 400

    HIGH 12
    PAUSE 100
    LOW 12
    PAUSE 100


    HIGH 14
    PAUSE 100
    LOW 14
  • FranklinFranklin Posts: 4,747
    edited 2006-10-29 17:51
    avitus, if pins 0 and 1 are your outputs why are you driving pins 12 and 14 high and low? Please attach your real code to your post for better help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • avitusavitus Posts: 23
    edited 2006-10-29 20:38
    martin

    when you say..

    "TO record:

    WAit for the input to pressed to record a sequence (in10?) and this will store 8 seconds worth at 100mS intervals approximately."
    (what do you mean by "in10?"?)

    FOR X = 0 to 80
    also, why am i getting an "expect a variable" error?
    do i need to replace X? and with what? so far nothing works
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-10-29 20:45
    avitus said...
    martin

    when you say..

    "TO record:

    WAit for the input to pressed to record a sequence (in10?) and this will store 8 seconds worth at 100mS intervals approximately."
    (what do you mean by "in10?"?)

    FOR X = 0 to 80
    also, why am i getting an "expect a variable" error?
    do i need to replace X? and with what? so far nothing works

    By IN10, I mean some button on P10 acting as input you are using to signal when to start recording your sequence.

    X needs to be defined previously
    X Var Byte.

    I gave only some snippits since most BS2 programmers understand the fundementals.

    -Martin
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-10-29 20:49
    avitus said...
    Kevin and martin.

    i know this cant be very difficult. i am just missing something terribly simple im afraid.

    No, this isn't a terribly hard project, but that depends on your level. It does require some higher level understanding, but again, the burden need to be on the poster to grasp as much as they can without asking a responder to write the program for them. Using variables is one of the most basic things you need to be able to do. I really recommend working your way though "WHat's a Microcontroller".

    -Martin
  • avitusavitus Posts: 23
    edited 2006-10-29 21:19
    thank you martin.
    I will keep you posted on my progress
  • avitusavitus Posts: 23
    edited 2006-10-30 17:42
    Does anyone know where i can find a tutorial or a easy step by step introduction to creating a macro, along with other basic uses for the BS2?

    thnk you in advance
  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-30 18:34
    There are lots of tutorial texts here on Parallax's website downloadable for free. They also have 3rd party books for sale. Start with their "Stamps in Class" webpage <http://www.parallax.com/html_pages/edu/index.asp>. I don't think you'll find a step by step introduction to creating a macro since that's a very specific application, but you will find lots of other examples that are directly applicable.

    There has been some other discussion about using a Stamp with Xbox devices. Start with something simple like just being able to read the information from an Xbox device, then a separate program that just sends Xbox commands to the Xbox in place of a peripheral device. Process control and robotics (which is where most of Parallax's educational material is oriented) is the same kind of application, just with different devices involved.

    Post Edited (Mike Green) : 10/30/2006 6:39:36 PM GMT
  • Tom WalkerTom Walker Posts: 509
    edited 2006-10-30 19:00
    ...and if you wish to search further, what you are referring to as "macros" in the Stamp world (or, indeed, the world of any microprocessor) are more accurately called programs (I mention this only to help in your searching). The texts, such as "What's a Microcontroller?", provided by Parallax (for free) are very good guides to learning how to program these devices and are well worth reading.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • metron9metron9 Posts: 1,100
    edited 2006-10-30 19:16
    Sorry I forgot about this post, i asked for Information , I have it , i will respond


    1. How many buttons are input that you need to record
    A. two

    2. How much time is a sequence of button pushes maximum
    A. 8 Seconds

    3. How many button pushes in a sequence maximum
    A. Three

    4. How many button sequences do you want to store
    A. assuming one


    If you start recording from the first button press you can record the time between press 1 and release of button 1
    Setting up a program to record would look like


    Timer=0
    Array_pointer=0

    Loop:
    Wait for either button to be pressed

    Loop1: 'Button has been pressed so we wait for it to be released
    increment timer
    if timer>8000 then set error flag-> and exit 'Assuming approximatly 1 mS for each time through the loop on BS2, may be closer to 4000 as it is 3 instructions
    if button is still pressed goto loop1
    record button number and time
    increment array pointer
    if array_pointer is less than 3 then goto Loop ' Get next button press.

    Now I would think you would need a start time of the event that causes one to press the first button but you dont have any way to know that so all you have is the three button presses and the time on to the time off.

    Button Time on
    1 300
    2 1000
    1 2300

    You would then see that time 1 is 300. Time for second button is 1000-300 = 700, and time button 3 is pressed 2300-1000 = 1300

    You can also set up a second timer to record the time between the end of press 1 release to start of press 2 and the time between press2 release and press3 start.

    that would take 8 bytes to store all the data necessary to play back the same sequence of button presses.


    So to trigger the two buttons from the basic stamp you would perhaps use two fets in parallal to the two existing switches, the stamp would then open and close those two fets in the same time pattern as its last recorded input when you press button 3. Course you have to program that part as well.


    I should note the BS2 executes about 2 instructions per millisecond so a loop that increments a word variable that has 2 instructions can count to about 1000 per second, If you need more resolution you would need a faster processor but for button presses I think you can at least be in the 2mS resolution range.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!

    Post Edited (metron9) : 10/30/2006 7:30:25 PM GMT
  • avitusavitus Posts: 23
    edited 2006-10-30 23:52
    mentrol9.

    thank you buddy you along with everyone have been a great help.
  • avitusavitus Posts: 23
    edited 2006-10-31 06:34
    ok i finally have the timing figured out. thanks to everyone who has mentored over me. now to finish up my project i could really use some direction assigning this sequence of high/lows to a single output.




    HIGH 4
    PAUSE 100
    LOW 14
    PAUSE 400

    HIGH 12
    PAUSE 100
    LOW 12
    PAUSE 100


    HIGH 14
    PAUSE 100
    LOW 14
  • avitusavitus Posts: 23
    edited 2006-11-18 22:07
    can someone plz help me and answer my question
Sign In or Register to comment.