Shop OBEX P1 Docs P2 Docs Learn Events
Does the basic stamp have hardware interupts? — Parallax Forums

Does the basic stamp have hardware interupts?

MovieMakerMovieMaker Posts: 502
edited 2008-10-07 02:21 in BASIC Stamp
simply put:

DOES THE BASIC STAMP HAVE HARDWARE INTERUPTS?

Comments

  • FranklinFranklin Posts: 4,747
    edited 2008-10-05 16:53
    I don't think any are implemented in a way you can get to them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • tpw_mantpw_man Posts: 276
    edited 2008-10-05 16:55
    There are no instructions to do interrupts. You can use an SX and SX/B to gain interrupts, but it is not a Basic Stamp.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I am 1011, so be surprised!


    Advertisement sponsored by dfletch:
    Come and join us on the Propeller IRC channel for fast and easy help!
    Channel: #propeller
    Server: irc.freenode.net or freenode.net
    If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
    tongue.gif
  • MovieMakerMovieMaker Posts: 502
    edited 2008-10-05 16:55
    Thanks for your answer. I know that the propeller doesn't have interupts. But, I was wondering about the stamp.
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-10-06 00:26
    Look at the POLL commands beginning on page 313 of the Basic Stamp Manual. There are related commands, but:

    "This feature should not be confused with the concept of interrupts, as the
    BASIC Stamp does not support true interrupts."
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-06 00:31
    The Stamp does not have interrupts.
  • MovieMakerMovieMaker Posts: 502
    edited 2008-10-06 01:56
    I see.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-06 02:24
    Now that the question has been answered clearly, do you feel you need interrupts? Why? Do you understand why interrupts are used? Do you understand why the Propeller doesn't have them?
  • MovieMakerMovieMaker Posts: 502
    edited 2008-10-06 11:30
    I was thinking about getting a bs2px24. It all goes back to the IRdetecting the end of the table. I was also curious about how many things I can do like, Lmotor,Rmotor,Ping,PingServo,4 pins for the SDcard reader if I can put one on it,SoundPal,IrLeft, IrRight, IrEmitLeft,IrEmitRight,Speaker, LEDS, . . . . . It looks like I will definately need to add a 74HC595. I am talking about the boebot of course.

    I think the code is more compatible with a lot of things I want to do. I did not get very far with Spin,ASM,BoebotBasic. I did everything I wanted to do individually, but not all together. I am not the programmer I was when I was younger. I wound up trying to change from one code to another to another and combine them all together and I said to myself, I would be better off just getting a language that had all the commands and codes I needed in one shot. Not that the propeller was bad or anything, I am just ignorant about it.

    Hope I did not address too many issues here.

    Thanks for letting me bend your ear.

    smile.gif
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-06 13:55
    You didn't really answer the questions ...

    Trust me ... "Interrupts" is a complex solution to the problem of having a single processor respond quickly to multiple, usually time-dependent, tasks.
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-10-06 14:06
    I've never tried to program to handle interrupts, but it seems very clear to me that it'd be a LOT easier to learn to program a Propeller chip to handle that kind of thing than it would be to program a single processor to use interrupts properly to accomplish the same tasks. I'm really amazed at how easy it is to get the Propeller to do (what for me are) relatively complex things.
  • Jesse HastyJesse Hasty Posts: 29
    edited 2008-10-06 14:37
    I have used interrupts in the past. Usually they are for life safety issues or if the machine will tear itself apart if the controller doesn't respond properly. Usually if the process requires such precise timed response it is better to design a hardware device to accomplish the task and simply have the processor monitor the hardware and set the operating parameters.

    Hardware interrupts are rife with bugs and logical collisions within your software since the processor is manually tom from whatever it is doing and transfers to a completely new task in a completely asynchronous manner.

    Each Basic Stamp token calls up a short sub routine which is written in machine code. A true hard interrupt would break in at the middle of executing this sub routine. I can't imagine the chaos which would result for many of these tokens.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2008-10-06 14:48
    I don't know why people rip on Interrupts that much. When properly used (and coded) they work just fine.

    As to your question asking if the BASIC Stamp has hardware Interrupts the answer is yes for the modules based on the SX28 and SX48 processors. It is part of the micro controllers and they are discussed on the datasheet for that particular chip. However you have no way to access them or use them through the Interpreted BASIC Stamp code. So, from a programmers perspective of a BASIC Stamp user they don't exist since you can't use them. As mentioned before the higher level BASIC Stamps have a simulated Interrupt but it just polls pins.

    If you really need access to Interrupts then you might want to take a look at the SX28 and the SX48 processors. Parallax has a BASIC compiler called SX/B that they offer as a free download. The syntax is a bit different than the BASIC Stamp but once you get use to it you can gain access to the true Hardware Interrupts, Hardware Timers, and also gain some speed.

    Robert
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-06 14:53
    Actually, interrupts have a long history and were (and still are) used for basic I/O functionality, anything from loading a byte into a UART, receiving a byte from a floppy disk drive, or loading up a display line buffer in response to a horizontal sync pulse. The main difficulty with them is that their timing is unpredictable and can effectively introduce large time delays in other routines that are interrupted. There's also a certain amount of time and memory required to save and restore the processor's state (registers) that can be partially eased by designing the processor to help with this.

    The SX microcontroller makes extensive use of interrupts to do its work (virtual peripherals) and has some hardware features to make this easier.
  • BeanBean Posts: 8,129
    edited 2008-10-06 15:05
    MovieMaker,
    By using the SX protoboard and the SX/B compiler you have access to two different types of interrupts.

    The first type is a "periodic" interrupt. This interrupt occurs every "x" clock cycles. It is useful for measure time and timing events.

    The other type is a "hardware" or pin change interrupt. This interrupt occurs wheneven a pin changes state. These are useful when you need to perform some action ASAP when a pin changes.

    Interrupts are a challange to the beginner, but they are really handy once you get the hang of them.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    "It is our choices, Harry, that show what we truly are, far more than our abilities."·Dumbledore from Harry Potter

    www.iElectronicDesigns.com

    ·
  • MovieMakerMovieMaker Posts: 502
    edited 2008-10-07 02:01
    Thank You Guys for your answers. I was thinking again about the table drop off problem I am experiencing. If I had an interupt to imediately stop the bot before it fell by continually monitoring the IR ports. That was my plan anyway. But, No, I do not know everything about the subject just what I have imagined. But, I get my new BS2px24 in this week, I hope and will learn more about it after I do a few hundred "honeydos".
  • SRLMSRLM Posts: 5,045
    edited 2008-10-07 02:21
    The regular microcontroller should be able to work the drop off sensors just fine. It does ~4000 instructions per second. How far does the BOE-BOT move in 1/4000 of a second? My guess is that you're in more danger of seeing an edge, turning and a wheel slips off.
Sign In or Register to comment.