PDA

View Full Version : Interrupt handling. How use the interrupt pins on the SX-processor from BSsx?



J.We
08-09-2005, 04:51 PM
I·use a BSsx, with UBICOM sx processor, it is a powerful processor with 8 pin interrupt and own interrupt stack. I want to use them!· What I can see, you cannot get to the interrupt pins on the processor from the BSsx. Is there any BASIC STAMP module who can handle interrupts?
Regards//Johan
·

Jon Williams
08-09-2005, 07:27 PM
No; the PBASIC interpreter does not do interrupts.·

If you want to use interrupts you can program "plain" SX chips with the SX/B compiler (it's very close to PBASIC) and SX/B does allow interrupt programming.·

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax

allanlane5
08-09-2005, 07:56 PM
The BS2p variants do have a "Basic" interrupt, which allows you to check interrupt statuses between PBasic tokens. However, the BS2sx has an SX built into it as a run-time engine. It's intended to run the PBasic op-codes, which do not support assembly level interrupts. And you're not allowed to 'tweak' the PBasic run-time to support them either. So no, you can't use the interrupt features of the SX on the BS2sx.

Note that 'tweaking the PBasic run-time' is a non-trivial exercise, in fact that's what Parallax has built their company around.

Now, what Jon is saying is that Parallax does sell a $100 package that lets you program SX chips yourself -- along with a very nice SX/B IDE/compiler that lets you have a mix of Basic and Assembly. They also sell $10 SX48 and SX52 boards, which are VERY nice. So you could easily go that route.

Bean
08-09-2005, 08:25 PM
Johan,
Can you tell us what you need interrupts for ? Maybe there is a way to do it with some external circuit.
Bean.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95

http://www.parallax.com/detail.asp?product_id=30012

Product web site: www.sxvm.com (http://www.sxvm.com)

"One experiment is worth a thousand theories"
·

J.We
08-12-2005, 05:21 PM
Thank you for your kind support (as always)!

Bean,
I want to use the interrupt as the same way as for a microprocessor, when condition/state is changed,·physically (on a pin) or logically (RS232-register flag), the program will·branch to a interrupt routine.

What can I do with my BS,(BSp) can I use Polling (POLLMODE, POLLIN, POLLOUT) for this?

Regards//J.We

Jon Williams
08-12-2005, 11:32 PM
Pin polling only works with a change of pin state, and this feature is only available on the BS2p family (BS2p, BS2pe, BS2px). And, it does not cause a branch to a interrupt routine per se. There is a POLLRUN instruction that can cause the program to RUN another program bank, but you will not automatically be returned to the point where you were called.

This is why I don't like to call pin polling "interrupt" because it does not work like standard microcontroller interrupts and I think that's really what you're looking for. For that, you can use your PBASIC skills with SX/B (our free BASIC compiler for the SX micro [not BS2sx]).

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax

J.We
08-16-2005, 05:40 PM
Ok, Thanks!
I will try to get around my problem in some other way.
·
My original problem had to do with buffering. I control my BS with a java program witch constantly sending commands to my BS via RS232. I didn’t want to “loose” instructions because BS didn’t have buffering ore interrupt handling and only is able to do “one thing at the time”. The problem is totally my fault, and I should have looked these things up more carefully before I started my project.
·
But ok, anyway, I will try to program my BS so that it doesn’t matter if it misses some commands..
·
Thank you !
·
Regards//Johan

Jon Williams
08-16-2005, 08:27 PM
One thing you could do is use flow control so that the BASIC Stamp lets the other device know that it is ready to receive serial data.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax