Shop OBEX P1 Docs P2 Docs Learn Events
Interupts software or hardware driving?????? w/ the SX/b — Parallax Forums

Interupts software or hardware driving?????? w/ the SX/b

$WMc%$WMc% Posts: 1,884
edited 2008-11-08 20:47 in General Discussion
$WMc%

· What is an "interupt"?... Is· it HardWare or SoftWare driving...????___I have a lot other ? on This matter; But for now an expl. on "interupts" will due..........



_____I've never Posted here So be·kind______________________$WMc%_____looking for info_____

Comments

  • VelocitVelocit Posts: 119
    edited 2008-11-02 23:46
    There are several kinds of interrupts. Some are "software" based in that they are triggered by internal events (i.e. a timer rolling over), and others are hardware based in that they are triggered by an external event (i.e. a pulse on an I/O pin). What makes an interrupt an interrupt is that they pull the microcontroller away, no matter what it's doing, to perform a set of tasks whenever one of these triggers occur.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Paul
  • $WMc%$WMc% Posts: 1,884
    edited 2008-11-05 01:20
    Mr. Paul

    Thank You for Your reply. The answer I was looking for is the the MicroController can only do one thing at a time, And I see this. The MircoC. stops what it was doing and then goes to do and interupt task then back to what it was doing before the interupt.So interupts don't mean multitasking.... Am I rite on this???

    ___________________________________________________$WMc%____________________????____
  • JonnyMacJonnyMac Posts: 9,214
    edited 2008-11-05 02:04
    Does your single processor Windows machine do multitasking? If you say yes, then the SX does, too (via interrupts). Just as your Windows PC gives each program a little bit of time to each process and switches quickly between them -- so quickly that you think that they're all running at the same time -- the SX can give background processes a little bit of time in the interrupt so that they seem to be running at the same time as the foreground process. With VPs (virtual peripherals) the SX can send and receive serial data (in the background) at the same time it's updating LEDs and reading sensors in the foreground.

    You've got a bit of studying to do before you get to that. Get an SX kit and start with simple programs before you dive into interrupts.
  • SteelSteel Posts: 313
    edited 2008-11-05 21:41
    For the first question:

    Technically, an interrupt is just a subroutine...however it requires hardware support (Interrupts reside as both hardware and firmware entities)

    When you set up an interrupt to trigger, it polls the interrupt states to see if there is any criteria that matches your interrupt trigger.

    If a trigger occurs, then the interrupt occurs, which stores the program counter (hardware) onto the stack (hardware) and re-assigns the program counter to zero, which is where the interrupt vector runs(hardware). The program counter then begins, and runs the code (firmware) that you put in that vector. When the code completes, it reads the program counter value stored on the stack (hardware) and begins incrementing the program counter to run code.

    So the interrupt is firmware controlled, however it is hardware executed.



    For the second question:
    Interrupts are not 'background run' or separate threads. They aren't on SX chips, PICs, or even PC's. In fact, the software term 'thread' in itself is misleading. You can look at interrupts the same as sub-routines, except there is hardware support that is constantly polling for an interrupt criteria.

    A processor is only able to run one command at a time. There are many processors that have peripherals built in that are able to run at the same time...but the core of the processor handles one command at a time (such as controlling/reading/writing the internal peripherals.)

    In software, when you create a new 'thread' or timer function, you are not running 2 things at once. The 2 or more 'threads' are 'toggling' their commands on the processor core...but the core is not running 2 programs at once.

    The Propeller chip is an example of true multi-processing, as it has 8 processors running simultaneously inside that share program space and memory...

    Post Edited (Steel) : 11/5/2008 9:49:13 PM GMT
  • $WMc%$WMc% Posts: 1,884
    edited 2008-11-06 02:37
    Mr. JonnyMac: Mr. Steel:

    ·I thank You both for Your replys;...What I gather from this is An "Interupt" is software driving but it needs··hardware to make it happen.??? like a high on pin(?) and it needs to have Pirority... Why does Parllax say the chip doesn't support Interups????? I see the speed gimeck and hogging the bus for and Interupt, But It seems to Me that anything can have and Interupt????· I'm Still confused on this "interupt" thing?????????????????



    ________________________________________$WMc%
  • JonnyMacJonnyMac Posts: 9,214
    edited 2008-11-06 06:11
    The SX family does support interrupts. They can be based on an internal timer (RTCC), on edge detection of pins on RB, and (I think) from the comparator; the SX48 also has interrupts connected to its timer/counters. The BASIC Stamp doesn't support interrupts, and the Propeller is designed as a multiprocessor so interrupts are not needed.

    You may be confusing the SX chip with the BASIC Stamp 2sx -- they are not the same (though one is used in the other).
  • $WMc%$WMc% Posts: 1,884
    edited 2008-11-07 00:00
    Hello EveyBody

    I can't spell " Interupts" , But I have a hole new understanding of how They work...I think You for the clarity on SX and BS2sx chips.I think this is were most of My confusion came from.I read and Artc.. in Nut&Volts by Jon Williams "Nov./08 issue" useing Interrupts.I thought the SX and the BS2Psx were all the same, just diff. package's and Serial driver's...When I read the Doc.s on the BS2sx,It clearly stated that it didn't support Interrupts, So then the thinking was Mr. Williams had wrote some major $stamp code "Bufoolry" or A simulated Interrupt...I Thank All of You for Your replys...I hope to learn some more Assm. lingo to help Me progress to the Prop.The SX offering both Basic and Assm,I think will be a good start.

    _________________________$WMc%_____________________________nose in the books_______________________
  • JonnyMacJonnyMac Posts: 9,214
    edited 2008-11-07 00:25
    If your goal is the Propeller you should probably just go straight to it. The architecture and programming paradigm is different enough that learning SX Assembly with interrupts will not be very useful in the Propeller. The Propeller is a multiprocessor so it doesn't need interrupts and its assembly language is fairly advanced vis-a-vis the SX. That said, these are just my opinions -- don't let me dissuade you from the SX as it's a very cool chip (I work with/design with it every day).

    BTW, I prefer to be called "Jon" -- "Mr. Williams" makes me sound old....
  • $WMc%$WMc% Posts: 1,884
    edited 2008-11-08 20:47
    JonnyMac

    I didn't realize that My post was replied by THE Jon Williams, I feel Honored, As I'm A Big Fan,And really liked the work You Have done w/ other $stamps...I'm just getting up to speed w/ the SX, And I really like what You've done here...I'm self thought,And I owe quite Abit to the Great Forrest M. Mimms III....When He announced His retirement My heart sank...It was His writting's That I learned the Basics...I can't say enough about the knowledge I gained from His work w/ RadioShack..I feel You are the next "Forrest" in the new Millenium....I look forward to the Artc.s in N/V Mag......I'll take Your Advise w/ the Propeller as well,I see Your point and It's well takin.I keep waiting for that "aAH-HAa",But it has'nt come yet w/ the Prop........Thanks again

    ____The "MR." was all about__Respect__,And not age..._________________$WMc%________________Honored______
Sign In or Register to comment.