Shop OBEX P1 Docs P2 Docs Learn Events
A bit of help plz — Parallax Forums

A bit of help plz

newnew Posts: 6
edited 2011-07-21 10:13 in BASIC Stamp
Ok we are student at a technical school. We are not really that far in programming but the final project we need to do things we are not familar with. Now I am hoping someone can point us in the right direction most of my time is looking online with no direction and getting no where. Here is what we are doing, we are making a ech-schetch clock run by the basic stamp. Now we are using a seperate program for a clock that works, now we have 24LC32A chips for memory. How can we put programs on to these chips and have another basic stamp access these numbers to control the servos to write on the echo schetch?

Comments

  • Clive WakehamClive Wakeham Posts: 152
    edited 2011-07-18 18:00
    Well I hope your using one of the "P" versions of the Basic Stamp since the 24LC32A chips are I2C controlled EEPROMs.

    You can program the 24LC32A's via a PC if you have a device that interfaces the Pc's USB to a I2C circuit.

    http://www.robot-electronics.co.uk/acatalog/USB_I2C.html
  • stamptrolstamptrol Posts: 1,731
    edited 2011-07-18 18:12
    Welcome to the forums.

    Tell us a bit more about your project. Which Stamp are you using?, which clock chip? what are the memory chips for? Do you have a drawing or pics or programs written?

    Where are you having the problem? Have you thought of how the servos will get connected to the ETCH-A-SKETCH? Don't forget most packaged servos will either do about one revolution with reasonable positioning accuracy or they will rotate many revolutions at a variable speed; If I understand your project, you'll need many revolutions plus positioning accuracy so that your system will be able to create the numbers on the screen.

    Other than getting the motors/servos to actually be able to turn the knobs (need enough torque) on the etch-a-sketch, most of the programming will be to create the numbers you'll need. Take your project and break it down into small steps. Solve one problem at a time.

    Heres a list of problems you might encounter. Hopefully you've already solved most of them.
    1. do you have the Stamp programming software?
    2. do you have a computer and cables to connect to the stamp?
    3. how does the stamp know what time it is?
    4. how do you set the time on the clock?
    5. How much torque is required to turn the etch-a-sketc knobs?
    6. How many turns of the knob to go from top to bottom and left to right.
    7. What happens at the ends of travel?
    8. How do you erase the screen?
    9. How do you draw the numbers 1, 2, 3, etc?
    10. Can certain motions be used to draw more than one number?
  • newnew Posts: 6
    edited 2011-07-19 15:16
    Ok thank you both for the replies. Let us tell you more about our project. We have delt with most of the issues you stated Tom, and to be honest we delt with them as the problems occured. We have 10 seperate programs one for each 0 - 9 and each works well on the ETCH-A-SKETCH. We have a sperate clock program and chip that reads the time well and displays it on our computer. The chip for our clock is: RTC DS1302 Real time clock IC circuit. Now that works where we run into a problem is that we don't know where to go now. We have 10 24LC32A chips that we are thinking about using to store the 10 0-9 numbers but then how do we access that to be ran on the ETCH-A-SKETCH? This is our class project and we each have our own basic Stamp, so can we have one basic stamp run the clock, and output a trigger to another basic stamp that will hold the memory chips with pre-programmed files of our numbers 0-9, which will then run our servos to the ETCH-A-SKETCH? We are using a "P" verison of the basic stamp and have the usb connection to go to the computer and the software for basic stamp.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-07-19 16:43
    The BS2p/pe/px Stamps have several statements (I2CIN/I2COUT) that are used to communicate with a variety of devices like the 24LC32A that use the I2C protocol originally developed by Philips (now NXP). I believe there are some examples of this in the Stamp Manual in the sections on these commands and in some of the Nuts and Volts columns you can find via the Resources tab on the main Parallax webpage. Have a look there. You might also consider storing your Etch-A-Sketch programs in the Stamp itself. The BS2p and BS2px have a total of 16K of EEPROM and the BS2pe has 32K, both broken up into 2K "slots". Most programs will fit into one "slot" and you can read and write the EEPROM using the READ and WRITE statements to keep data there. The 24LC32A is the same size as two "slots". Were you going to use all of that storage for an Etch-A-Sketch program?
  • stamptrolstamptrol Posts: 1,731
    edited 2011-07-19 17:25
    As Mike noted, the whole system could be implemented in one of your stamps.

    However, because its a class project, why not build it in the form of a network?

    Have one stamp be the Master controller, have one stamp in charge of setting and reading the clock, have one stamp talking to the servos to turn the knobs on the etch-a-sketch.

    The master will ask the clock stamp what time it is then transfer that to the servo stamp. The servo stamp figures out how to make the required digits and puts them on the screen.

    The communication basics are described in the helpfile for SERIN and SEROUT.

    You might have enough equipment so that several teams could each build a whole system.

    Keep at it!

    Tom
  • newnew Posts: 6
    edited 2011-07-20 15:53
    Thank you all for the help and continueing support on this. Mike we have just the BS2 that comes with the board of education so as far as I read it has not exta EEPROM memory that we can use. But as stated in my first post we have 10 of the 24LC32A chips that has 4k EEPROM memory. We like the idea Tom suggested about using multiple stamps which we have 6 of them. We are currently reading up on how to network them together which might be a bit more advance then were we are, but we were told its the journey to get there rather then the final results so lol we are trying our best. Any suggested reading or other advice we would love that. We have been given alot of good information here which we are grateful, thanks again.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-07-20 15:57
    As I mentioned, there's lots of useful information in the Nuts and Volts columns. There's a pair of columns describing a multi-Stamp network. I don't remember which column numbers, but it would be a good investment in time to browse through the columns and save bookmarks on those that look like they might deserve a full reading.

    Unless you have a very large program, there's probably some room in the EEPROM that's not used for the program and you could use that for some data.
  • newnew Posts: 6
    edited 2011-07-21 09:38
    Our program is fairly large right now we have 11 sperate programs for this project. 10 being for servo control one for each number 0-9. Each of these programs control two servos connected to the knobs of the ETCH-A-SKETCH. The number 8 program is our largest being 3k, the rest are about 2k. We ran into a bit of trouble starting when we had one servo run and other other start it would round off the number which we didn't like so we added more code. Basically we added another servo the third isn't really hooked up to anything but the delay it caused made our number more square in design which we like. After doing that we had very large programs, so in our attempt to make them smaller we made the "ghost" servo a sub so we used less code for it. The 11th program is our clock. Now we are looking into how to connect them all, I read about networking with basic stamp and it talked about Master/slave which I am unsure that will work if we set it up the way Tom was describing. From what I gather is that with Master/Slave only one stamp can transmit data. So having one stamp as the master get information form another stamp that has the clock and then relay instructions to a third stamp to control the servo wouldn't work because unless the stamp with the clock is the master how will it transmit when the time changes? What I'm thinking is that if we can get a stamp to tell another stamp to run set files and those files being programs that might work. Like for example if it is 12:31 the stamp would then send a signal to stamp a to flip the ETCH-A-SKETCH and clear the last data. Then tell stamp b to run the following programs in this work. Home, one, two, three, one, and End. Home being a program we wrote to move the line of the ETCH-A-SKETCH to a place to start writing the numbers, and End being returning it to the starting point.
  • newnew Posts: 6
    edited 2011-07-21 09:44
    I have read alot on nuts and bolts but my trouble is I can spend hours reading about something to only finally understandning it to find that it won't work. And with us being new at all this I think we chose a project that is more advance then what we should be at. We are told by our program director that its the journey that is more important meaning that all of our research and trial and error we are learning alot that if it doesn't work its ok, but I hate failing at anything.... lol I want to thing to flip and write the time at least once to satisfied with my effort. Again thank you all for the advice we are trying to look into what you all suggest and either way we shall post the results of our effort. That way at least you all :)
  • Mike GreenMike Green Posts: 23,101
    edited 2011-07-21 10:13
    One of the things you should think about is how to make your programs smaller. It sounds like the individual programs use Basic statements directly to move the servos for each line segment. You probably have a FOR/NEXT loop and two PULSOUTs along with a PAUSE for each line segment yet there's only 3 pieces of information that determine the line to be drawn, the FOR loop count and the delta (change) to the servo position for each FOR loop step. You can store all that information in 3 bytes or less using DATA statements and read the information from the DATA statements using READ statements. I'm talking about something like:
    table  DATA  30, 10, 20  ' 30 steps changing X PULSOUT by 10 and Y PULSOUT by 20
       DATA   15, -25, -5   ' 15 steps changing X PULSOUT by -25 and Y PULSOUT by -5
       DATA   0, 0, 0   ' zero steps marks end of table
    pointer   VAR   WORD
    steps   VAR   BYTE
    xStep   VAR   WORD
    yStep   VAR   WORD
    xWidth   VAR   WORD
    yWidth   VAR   WORD
    '   program initialization
    pointer = table   ' initialize pointer to table
    xWidth = 750   ' x servo to mid-position initially (could be different)
    yWidth = 750   ' y servo to mid-position initially
    '   get a line segment
    doStep:   read   pointer,steps
       read   pointer+1,xStep
       read   pointer+2,yStep
       pointer = pointer + 3
       if steps = 0 then goto finishUp
       if xStep > 127 then xStep = 256 - xStep   ' allow for negative steps (in 2's complement arithmetic)
       if yStep > 127 then yStep = 256 - yStep
       for i = 1 to steps   ' do requested number of steps
          pulsout   xServo,xWidth   ' use current servo pulse width
          xWidth = xWidth + xStep   ' adjust the pulse width for next time
          pulsout   yServo,yWidth
          yWidth = yWidth + yStep
          pause   20   ' pulse need to be send about every 20ms
       next i
       goto doStep
    finishUp:   ' do whatever you want at the end of it all
       end
    
Sign In or Register to comment.