Shop OBEX P1 Docs P2 Docs Learn Events
ASK Pollrun — Parallax Forums

ASK Pollrun

ToHaBoyToHaBoy Posts: 4
edited 2008-03-04 20:24 in BASIC Stamp
I have some homework from my lecture.
make interrupt program using Poll command. But Poll command can not return, how to make return to in last program when pollrun. Please help......

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-06 05:26
    There is no built-in way to return to the point of interruption. The best you can do is to save the state of your program in one or more variables like which slot is running, what section of the program is running or where does it have to return to, then your "interrupt routine" which is started on a successful POLLRUN runs the saved slot which starts over from the beginning, but checks all the "state" variables to restore any variables and GOTO the portion of the program that was running when the successful poll occurred.
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2008-02-06 17:11
    We might be able to help more if you can explain more what the program has to do. Is that all there is to the homework, or does the program have to do some specific task? Does the homework say that you have to use POLLRUN? There are other POLL commands, you know. For example, POLLOUT and POLLWAIT. Those too provide a kind of "interrupt".

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • lajkolajko Posts: 7
    edited 2008-03-04 20:24
    I have been thinking of the same problem. I have to receive 16 bits of serial data with a clock line at 420khz. Faster processor is one solution to have time to process data. I looked at the pollrun and also realized there is no way to return to the point of interruption.

    So maybe:
    1. Define data variables the same for all programs, so they can be safely shared.
    2. Use program 0 to init everything and get everything started and switch to your background or shell program in bank 2 (such as updating LED's, other non-critical background tasks)
    3. Put the pollrun program into another area, such as bank 1.
    4. To exit the pollrun and not execute all the initialization code, put the "background" or your "program shell" onto another bank and switch to it (such as bank 2 as mentioned earlier).
Sign In or Register to comment.